From 5e29c239d964ee8d652326e77d0f6ad24d517ff9 Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Sat, 1 May 2021 11:20:17 +0300 Subject: [PATCH] feat: provide configurable npmPath closes #107 --- .github/workflows/ci.yaml | 3 +-- src/main/ts/util.ts | 3 +-- src/test/ts/util.ts | 4 +-- yarn.lock | 57 +++++---------------------------------- 4 files changed, 10 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 95569b96..3925c263 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -172,8 +172,7 @@ jobs: extends: | @qiwi/semrel-config env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GIT_AUTHOR_EMAIL: 'mailbox@antongolub.ru' GIT_COMMITTER_EMAIL: 'mailbox@antongolub.ru' diff --git a/src/main/ts/util.ts b/src/main/ts/util.ts index 2ee42c69..f237d5ae 100644 --- a/src/main/ts/util.ts +++ b/src/main/ts/util.ts @@ -110,8 +110,7 @@ export const getNpm = (npmPath = 'local', isWin = isWindows()): string => { return getClosestNpm(cmd) } - // TODO support custom path to npm bin - throw new Error(`Unsupported npm path value: ${npmPath}`) + return npmPath } export const getWorkspaces = ( diff --git a/src/test/ts/util.ts b/src/test/ts/util.ts index b1a50ba7..bba0875f 100644 --- a/src/test/ts/util.ts +++ b/src/test/ts/util.ts @@ -82,8 +82,8 @@ describe('util', () => { const cases: [any, string?, string?][] = [ ['local', localNpm], ['system', cmd], - ['unknown', undefined, 'Unsupported npm path value: unknown'], - [NaN, undefined, 'Unsupported npm path value: NaN'], + [cmd, cmd], + [localNpm, localNpm], ] cases.forEach(([npmPath, result, err]) => { it(`resolves npm ref: npmPath=${npmPath}, isWin=${isWin}`, () => { diff --git a/yarn.lock b/yarn.lock index 14b73ee9..afc2f1c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -560,40 +560,7 @@ "@nodelib/fs.scandir" "2.1.4" fastq "^1.6.0" -"@npmcli/arborist@^2.0.0", "@npmcli/arborist@^2.3.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@npmcli/arborist/-/arborist-2.4.0.tgz#34e7d7ead0140268ff7f9418b305993e8f2ce0d7" - integrity "sha1-NOfX6tAUAmj/f5QYswWZPo8s4Nc= sha512-rCoRrUSmXdBDBBgL/O0oehIR53ey99Pds8dId7gztARZmx6/NBoeiUOu9RnvXSe15XZLc3JSz9sHPcbQ9NQ53Q==" - dependencies: - "@npmcli/installed-package-contents" "^1.0.7" - "@npmcli/map-workspaces" "^1.0.2" - "@npmcli/metavuln-calculator" "^1.1.0" - "@npmcli/move-file" "^1.1.0" - "@npmcli/name-from-folder" "^1.0.1" - "@npmcli/node-gyp" "^1.0.1" - "@npmcli/run-script" "^1.8.2" - bin-links "^2.2.1" - cacache "^15.0.3" - common-ancestor-path "^1.0.1" - json-parse-even-better-errors "^2.3.1" - json-stringify-nice "^1.1.2" - mkdirp-infer-owner "^2.0.0" - npm-install-checks "^4.0.0" - npm-package-arg "^8.1.0" - npm-pick-manifest "^6.1.0" - npm-registry-fetch "^10.0.0" - pacote "^11.2.6" - parse-conflict-json "^1.1.1" - promise-all-reject-late "^1.0.0" - promise-call-limit "^1.0.1" - read-package-json-fast "^2.0.2" - readdir-scoped-modules "^1.1.0" - semver "^7.3.5" - tar "^6.1.0" - treeverse "^1.0.4" - walk-up-path "^1.0.0" - -"@npmcli/arborist@^2.4.1": +"@npmcli/arborist@^2.0.0", "@npmcli/arborist@^2.3.0", "@npmcli/arborist@^2.4.1": version "2.4.1" resolved "https://registry.yarnpkg.com/@npmcli/arborist/-/arborist-2.4.1.tgz#e98c77f7e17924876b89907237516eb65d46005f" integrity sha512-LivXfK+LjtvzFjnwK6E41Pkw1C8+MYrgdXinzqpDc8MDYp7gMT0nvGvnpQd47OV2GhLRyBkbUSEcLk6P1d1s0g== @@ -4335,9 +4302,9 @@ libnpmdiff@^2.0.4: tar "^6.1.0" libnpmexec@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/libnpmexec/-/libnpmexec-1.0.1.tgz#a23f5bbe2bd4f8103a4f53eea8b113f7742f1903" - integrity sha512-YK2kEhZNCcaDEqOIUWjadhJl9MgS69YHgMmGD5P3yntF0UXNOQfEqABoMTZv9ngPOJTJQGlU4Dfp2xb3bpUKzw== + version "1.1.0" + resolved "https://registry.yarnpkg.com/libnpmexec/-/libnpmexec-1.1.0.tgz#daa79d4545e21d0eb6887a33e0bbc8ab466099b2" + integrity "sha1-2qedRUXiHQ62iHoz4LvIq0ZgmbI= sha512-OWpsPWtD6CAn66JouyjBfhQ9eS1mAtXgZXXd1SoAyUP3Mol+ao9IJ2THcJQcgX96keVmZkUA11uJS5ZNEd9DwA==" dependencies: "@npmcli/arborist" "^2.3.0" "@npmcli/ci-detect" "^1.3.0" @@ -4349,6 +4316,7 @@ libnpmexec@^1.0.1: proc-log "^1.0.0" read "^1.0.7" read-package-json-fast "^2.0.2" + walk-up-path "^1.0.0" libnpmfund@^1.0.2: version "1.0.2" @@ -4979,20 +4947,7 @@ npm-profile@^5.0.3: dependencies: npm-registry-fetch "^10.0.0" -npm-registry-fetch@^10.0.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-10.1.0.tgz#3b618126b1011af74c12e75d6077712bda411da4" - integrity sha512-XcKu0h6OuRTB7HO5uv8htavPQJ1dYTLAXLE5AMs4GFQ1LbY+LlHiNoqIbVshE3rk0vLk+nKxpA/4WJm1kE7eqg== - dependencies: - lru-cache "^6.0.0" - make-fetch-happen "^8.0.9" - minipass "^3.1.3" - minipass-fetch "^1.3.0" - minipass-json-stream "^1.0.1" - minizlib "^2.0.0" - npm-package-arg "^8.0.0" - -npm-registry-fetch@^10.1.1: +npm-registry-fetch@^10.0.0, npm-registry-fetch@^10.1.1: version "10.1.1" resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-10.1.1.tgz#97bc7a0fca5e8f76cc5162185b8de8caa8bea639" integrity sha512-F6a3l+ffCQ7hvvN16YG5bpm1rPZntCg66PLHDQ1apWJPOCUVHoKnL2w5fqEaTVhp42dmossTyXeR7hTGirfXrg==