From 71dcfd7b813a4178d89562bb4c28d7d6579fae4f Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Wed, 29 Mar 2023 17:35:36 -0400 Subject: [PATCH] Rename prepare script to prepack for compat with yarn (#1980) * Rename prepare script to prepack * Update justfile * Update build-manifest.mjs --- justfile | 4 ++-- package.json | 4 ++-- scripts/build-manifest.mjs | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/justfile b/justfile index 4ed6cdf8b..e120756ce 100644 --- a/justfile +++ b/justfile @@ -64,9 +64,9 @@ pre-debug *ARGS: just build-tsc && just build-pack "$@" coverage-report *ARGS: nyc report --reporter=lcov "$@" -__prepare_template__ *ARGS: +__prepack_template__ *ARGS: just clean && just build-nopack "$@" -prepare *ARGS: +prepack *ARGS: rimraf temp dist tsconfig.schema.json tsconfig.schemastore-schema.json tsconfig.tsbuildinfo tests/ts-node-packed.tgz tests/node_modules tests/tmp && tsc -b ./tsconfig.build-dist.json && typescript-json-schema --topRef --refs --validationKeywords allOf --out tsconfig.schema.json tsconfig.build-schema.json TsConfigSchema && node --require ./register ./scripts/create-merged-schema "$@" api-extractor *ARGS: api-extractor run --local --verbose "$@" diff --git a/package.json b/package.json index ecbc6322e..8f3f4464e 100644 --- a/package.json +++ b/package.json @@ -74,8 +74,8 @@ "test-local": "yarn fmt && yarn build-tsc && yarn build-pack && yarn test-spec", "pre-debug": "yarn build-tsc && yarn build-pack", "coverage-report": "nyc report --reporter=lcov", - "__prepare_template__": "yarn clean && yarn build-nopack", - "prepare": "rimraf temp dist tsconfig.schema.json tsconfig.schemastore-schema.json tsconfig.tsbuildinfo tests/ts-node-packed.tgz tests/node_modules tests/tmp && tsc -b ./tsconfig.build-dist.json && typescript-json-schema --topRef --refs --validationKeywords allOf --out tsconfig.schema.json tsconfig.build-schema.json TsConfigSchema && node --require ./register ./scripts/create-merged-schema", + "__prepack_template__": "yarn clean && yarn build-nopack", + "prepack": "rimraf temp dist tsconfig.schema.json tsconfig.schemastore-schema.json tsconfig.tsbuildinfo tests/ts-node-packed.tgz tests/node_modules tests/tmp && tsc -b ./tsconfig.build-dist.json && typescript-json-schema --topRef --refs --validationKeywords allOf --out tsconfig.schema.json tsconfig.build-schema.json TsConfigSchema && node --require ./register ./scripts/create-merged-schema", "api-extractor": "api-extractor run --local --verbose" }, "repository": { diff --git a/scripts/build-manifest.mjs b/scripts/build-manifest.mjs index 0c2d9432f..6f743c9f5 100755 --- a/scripts/build-manifest.mjs +++ b/scripts/build-manifest.mjs @@ -10,15 +10,15 @@ const manifestPath = resolve( ); const pkg = JSON.parse(readFileSync(manifestPath, 'utf8')); -// Fully splat the "prepare" script so that it does not contain references to a package manager, neither `yarn` nor `npm` -pkg.scripts.prepare = pkg.scripts.__prepare_template__; +// Fully splat the "prepack" script so that it does not contain references to a package manager, neither `yarn` nor `npm` +pkg.scripts.prepack = pkg.scripts.__prepack_template__; while (true) { - let before = pkg.scripts.prepare; - pkg.scripts.prepare = pkg.scripts.prepare.replace( + let before = pkg.scripts.prepack; + pkg.scripts.prepack = pkg.scripts.prepack.replace( /yarn (\S+)/g, ($0, $1) => pkg.scripts[$1] ); - if (pkg.scripts.prepare === before) break; + if (pkg.scripts.prepack === before) break; } writeFileSync(manifestPath, JSON.stringify(pkg, null, 2) + '\n');