Skip to content

Commit

Permalink
chore: use npm run-scripts instead of npx (#3407)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-bompart authored Nov 16, 2023
1 parent 543e3df commit f3792d3
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 27 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"notify:docs": "node ./scripts/notify-docs/published-ui-kit.mjs",
"release": "npm run nx:graph && npm run release:phase0 && npm run release:phase1-3 && npm run release:phase4",
"nx:graph": "nx graph --file=topology.json",
"release:phase0": "npx --offline -p=@coveo/release git-lock",
"release:phase1-3": "npm run release:phase2 && npx --offline -p=@coveo/release reify",
"release:phase0": "npm run-script -w=@coveo/release git-lock",
"release:phase1-3": "npm run release:phase2 && npm run-script -w=@coveo/release reify",
"release:phase2": "nx run-many --targets=release:phase2 --all --parallel=false --output-style=stream",
"release:phase4": "npx --offline -p=@coveo/release git-publish-all",
"release:phase4": "npm run-script -w=@coveo/release git-publish-all",
"release:phase5": "nx run-many --targets=release:phase5 --all"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/atomic-angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"release:phase1": {
"executor": "nx:run-commands",
"options": {
"command": "npx --offline -p=@coveo/release bump",
"command": "npm run-script -w=@coveo/release bump",
"cwd": "packages/atomic-angular/projects/atomic-angular"
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/atomic-hosted-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"e2e:watch": "cypress open --browser chrome --e2e",
"e2e": "cypress run --browser chrome",
"validate:definitions": "tsc --noEmit --esModuleInterop --skipLibCheck ./dist/types/components.d.ts",
"release:phase1": "npx --offline -p=@coveo/release bump",
"release:phase1": "npm run-script -w=@coveo/release bump",
"release:phase2": "npm run publish:npm",
"release:phase5": "npm run publish:npm",
"publish:npm": "npx --offline -p=@coveo/release npm-publish",
"publish:npm": "npm run-script -w=@coveo/release npm-publish",
"promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/atomic-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"build:bundles:cjs": "tsc -p tsconfig.cjs.json",
"build:bundles:iife": "rollup --config rollup.config.mjs",
"build:bundles": "concurrently \"npm run build:bundles:esm\" \"npm run build:bundles:cjs\" \"npm run build:bundles:iife\"",
"release:phase1": "npx --offline -p=@coveo/release bump",
"release:phase1": "npm run-script -w=@coveo/release bump",
"release:phase2": "npm run publish:npm",
"release:phase5": "npm run publish:npm",
"publish:npm": "npx --offline -p=@coveo/release npm-publish",
"publish:npm": "npm run-script -w=@coveo/release npm-publish",
"promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest",
"build:assets": "ncp ../atomic/dist/atomic/assets dist/assets && ncp ../atomic/dist/atomic/lang dist/lang "
},
Expand Down
4 changes: 2 additions & 2 deletions packages/atomic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
"e2e:snapshots:watch": "cypress open --config-file cypress-screenshots.config.ts --browser chrome",
"e2e:insight": "cypress run --config-file cypress-insight-panel.config.ts --browser chrome",
"e2e:insight:watch": "cypress open --config-file cypress-insight-panel.config.ts --browser chrome",
"release:phase1": "npx --offline -p=@coveo/release bump",
"release:phase1": "npm run-script -w=@coveo/release bump",
"release:phase2": "npm run publish:npm",
"release:phase5": "npm run publish:npm",
"publish:npm": "npx --offline -p=@coveo/release npm-publish",
"publish:npm": "npm run-script -w=@coveo/release npm-publish",
"promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest",
"validate:definitions": "tsc --noEmit --esModuleInterop --skipLibCheck ./dist/types/components.d.ts"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"build:bundles": "node esbuild.mjs",
"build:definitions": "tsc -p src/tsconfig.build.json -d --emitDeclarationOnly --declarationDir dist/definitions",
"clean": "rimraf -rf dist/*",
"release:phase1": "npx --offline -p=@coveo/release bump",
"release:phase1": "npm run-script -w=@coveo/release bump",
"release:phase2": "npm run publish:npm",
"release:phase5": "npm run publish:npm",
"publish:npm": "npx --offline -p=@coveo/release npm-publish",
"publish:npm": "npm run-script -w=@coveo/release npm-publish",
"promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest",
"e2e": "npm run e2e:saml",
"e2e:saml": "vite manual-e2e/saml/"
Expand Down
4 changes: 2 additions & 2 deletions packages/bueno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"clean": "rimraf -rf dist/*",
"test": "jest",
"test:watch": "jest --watch --colors --no-cache",
"release:phase1": "npx --offline -p=@coveo/release bump",
"release:phase1": "npm run-script -w=@coveo/release bump",
"release:phase2": "npm run publish:npm",
"release:phase5": "npm run publish:npm",
"publish:npm": "npx --offline -p=@coveo/release npm-publish",
"publish:npm": "npm run-script -w=@coveo/release npm-publish",
"promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/headless-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"test": "jest",
"test:watch": "jest --watch --colors --no-cache",
"lint": "eslint .; publint",
"release:phase1": "npx --offline -p=@coveo/release bump",
"release:phase1": "npm run-script -w=@coveo/release bump",
"release:phase2": "npm run publish:npm",
"release:phase5": "npm run publish:npm",
"publish:npm": "npx --offline -p=@coveo/release npm-publish",
"publish:npm": "npm run-script -w=@coveo/release npm-publish",
"promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/headless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"test:watch": "jest --watch --colors --no-cache --silent=false",
"test:unit": "jest --testPathIgnorePatterns=src/integration-tests",
"test:integration": "jest --testPathPattern=src/integration-tests",
"release:phase1": "npx --offline -p=@coveo/release bump",
"release:phase1": "npm run-script -w=@coveo/release bump",
"release:phase2": "npm run publish:npm",
"release:phase5": "npm run publish:npm",
"publish:npm": "npx --offline -p=@coveo/release npm-publish",
"publish:npm": "npm run-script -w=@coveo/release npm-publish",
"promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest",
"build:doc": "npm run build:doc:extract && npm run build:doc:parse",
"build:doc:extract": "node ./scripts/extract-documentation.mjs",
Expand Down
4 changes: 2 additions & 2 deletions packages/quantic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"publish:sfdx": "../../node_modules/.bin/ts-node scripts/build/create-package.ts --remove-translations",
"promote:sfdx": "npm run publish:sfdx -- --promote",
"promote:sfdx:ci": "npm run publish:sfdx -- --promote --ci",
"release:phase1": "npx --offline -p=@coveo/release bump",
"release:phase1": "npm run-script -w=@coveo/release bump",
"release:phase2": "npm run publish:npm",
"release:phase5": "npm run publish:npm",
"publish:npm": "npx --offline -p=@coveo/release npm-publish",
"publish:npm": "npm run-script -w=@coveo/release npm-publish",
"promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest",
"preinstall": "node scripts/npm/check-sfdx-project.js",
"postinstall": "node scripts/npm/setup-quantic.js"
Expand Down
5 changes: 5 additions & 0 deletions utils/release/bump-package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import {
REPO_OWNER,
} from './common/constants.mjs';

if (!process.env.INIT_CWD) {
throw new Error('Should be called using npm run-script');
}
process.chdir(process.env.INIT_CWD);

/**
* Check if the package json in the provided folder has changed since the last commit
* @param {string} directoryPath
Expand Down
5 changes: 5 additions & 0 deletions utils/release/git-lock.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import {
removeWriteAccessRestrictions,
} from './lock-master.mjs';

if (!process.env.INIT_CWD) {
throw new Error('Should be called using npm run-script');
}
process.chdir(process.env.INIT_CWD);

const isPrerelease = process.env.IS_PRERELEASE === 'true';
const PATH = '.';
const GIT_SSH_REMOTE = 'deploy';
Expand Down
5 changes: 5 additions & 0 deletions utils/release/git-publish-all.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ import {
} from './common/constants.mjs';
import {removeWriteAccessRestrictions} from './lock-master.mjs';

if (!process.env.INIT_CWD) {
throw new Error('Should be called using npm run-script');
}
process.chdir(process.env.INIT_CWD);

// Commit, tag and push
(async () => {
const octokit = new Octokit({
Expand Down
5 changes: 5 additions & 0 deletions utils/release/npm-publish-package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import {describeNpmTag, npmPublish} from '@coveo/semantic-monorepo-tools';
import retry from 'async-retry';
import {readFileSync} from 'node:fs';

if (!process.env.INIT_CWD) {
throw new Error('Should be called using npm run-script');
}
process.chdir(process.env.INIT_CWD);

/**
* @param {string} name
* @param {string} version
Expand Down
12 changes: 5 additions & 7 deletions utils/release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
"@types/npmcli__arborist": "5.6.5",
"typescript": "5.2.2"
},
"bin": {
"git-lock": "git-lock.mjs",
"bump": "bump-package.mjs",
"npm-publish": "npm-publish-package.mjs",
"git-publish-all": "git-publish-all.mjs",
"reify": "reify.mjs"
},
"scripts": {
"git-lock": "./git-lock.mjs",
"bump": "./bump-package.mjs",
"npm-publish": "./npm-publish-package.mjs",
"git-publish-all": "./git-publish-all.mjs",
"reify": "./reify.mjs",
"test": "tsc"
}
}
5 changes: 5 additions & 0 deletions utils/release/reify.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import Arborist from '@npmcli/arborist';
import {DepGraph} from 'dependency-graph';
import {REPO_FS_ROOT} from './common/constants.mjs';

if (!process.env.INIT_CWD) {
throw new Error('Should be called using npm run-script');
}
process.chdir(process.env.INIT_CWD);

/**
* Current strategy: reify each package (along with their dependants transitively) in topological (parents->dependants) order.
*
Expand Down

0 comments on commit f3792d3

Please sign in to comment.