From ce429bd02541b0bb791e63241ed798bc82c0ac95 Mon Sep 17 00:00:00 2001 From: Casey Marshall Date: Thu, 16 Dec 2021 13:36:07 -0600 Subject: [PATCH] fix: npm package script, semantic release This fixes the configured "binary" script that should be installed into node_modules/.bin. Adding the shebang to build/index.js directly (via src/index.ts) seems to break the Docker build, so a separate wrapper script was needed. This also fixes semantic release. semantic-release creates a tag and publishes to npm, the tag then triggers a docker build. --- .circleci/config.yml | 20 +++++++------------- package.json | 4 ++-- scripts/sweater-comb.js | 3 +++ 3 files changed, 12 insertions(+), 15 deletions(-) create mode 100755 scripts/sweater-comb.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 25e7b441..cb7bc7cb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,24 +66,18 @@ workflows: jobs: - test: name: Test - filters: - # In CircleCI, branches are on by default and do not need to be specified. - # However tags are off by default and need to be specified. - tags: - only: '/^v.*$/' - - docker-release: - name: Docker Image Release + - npm-release: + name: NPM Release - Tag requires: - Test + context: nodejs-app-release filters: branches: only: 'main' - tags: - only: '/^v.*$/' - - npm-release: - name: NPM Release - Tag - requires: - - Test + docker_publish: + jobs: + - docker-release: + name: Docker Image Release filters: branches: ignore: '/.*/' diff --git a/package.json b/package.json index 48e81876..b19ac6e8 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "@snyk/sweater-comb", "packageManager": "yarn@3.0.2", - "version": "1.0.0-alpha.0", + "version": "1.0.0", "main": "build/index.js", "types": "build/index.d.ts", "bin": { - "sweater-comb": "build/index.js" + "sweater-comb": "scripts/sweater-comb.js" }, "files": [ "/build" diff --git a/scripts/sweater-comb.js b/scripts/sweater-comb.js new file mode 100755 index 00000000..3508e978 --- /dev/null +++ b/scripts/sweater-comb.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node + +require('../build/index.js');