Skip to content

Commit

Permalink
Rename prepare script to prepack for compat with yarn (#1980)
Browse files Browse the repository at this point in the history
* Rename prepare script to prepack

* Update justfile

* Update build-manifest.mjs
  • Loading branch information
cspotcode authored Mar 29, 2023
1 parent 6558cbe commit 71dcfd7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
10 changes: 5 additions & 5 deletions scripts/build-manifest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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');

0 comments on commit 71dcfd7

Please sign in to comment.