Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 24ec3b9

Browse files
Make prepack scripts more consistent (#1020)
Somewhere between Typescript 3.5.x and 4.0.x, the behavior of the compiler changed in a subtle way when using the `-b` flag. In 3.5.x, if `outDir` was removed after a build but `tsconfig.tsbuildinfo` remained, running `tsc -b` again would fully reproduce `outDir`. Technically, this is incorrect behavior because the compiler state should be fully derived from the `include`/`rootDir` files and the `tsconfig.tsbuildinfo` file. In 4.0.x, `outDir` is not reproduced because the compiler properly loads its state from `tsconfig.tsbuildinfo` and does not perform any recompilation. Why did this affect `packages/plugins`? The `prepack` script runs `rimraf lib && tsc -b`. In the 3.5.x compiler version, this would reproduce the `lib` directory. In 4.0.x, it would not. This, the packaged set of files does not include the `lib` directory. This commit makes `prepack` scripts more consistent by using `npm run clean` and `npm run build`. The `clean` scripts already properly clean up both `outDir` and the `tsconfig.tsbuildinfo` file.
1 parent e6ea353 commit 24ec3b9

File tree

8 files changed

+8
-4
lines changed

8 files changed

+8
-4
lines changed

packages/command/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"main": "lib/index.js",
1616
"repository": "https://github.com/microsoft/botframework-cli",
1717
"scripts": {
18-
"prepack": "",
1918
"postpack": "",
19+
"prepack": "npm run clean && npm run build",
2020
"posttest": "",
2121
"build": "tsc -b",
2222
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",

packages/config/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"repository": "https://github.com/microsoft/botframework-cli/tree/master/packages/config",
2727
"scripts": {
2828
"postpack": "rimraf oclif.manifest.json",
29+
"prepack": "npm run clean && npm run build && npm run doc:readme",
2930
"posttest": "tslint -p test -t stylish",
3031
"build": "tsc -b",
3132
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",

packages/dialog/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"repository": "https://github.com/microsoft/botframework-cli/tree/master/packages/dialog",
2828
"scripts": {
2929
"postpack": "rimraf oclif.manifest.json",
30+
"prepack": "npm run clean && npm run build && npm run doc:readme",
3031
"posttest": "tslint -p test -t stylish",
3132
"build": "tsc -b",
3233
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",

packages/lg/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"scripts": {
6464
"unittest": "rush test -t @microsoft/bf-lg-cli",
6565
"posttest": "eslint . --ext .ts --config .eslintrc",
66-
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
66+
"prepack": "npm run clean && npm run build && npm run doc:readme",
6767
"postpack": "rimraf oclif.manifest.json",
6868
"build": "tsc -b",
6969
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",

packages/lu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"license": "MIT",
1717
"repository": "https://github.com/microsoft/botframework-cli/tree/master/packages/lu",
1818
"scripts": {
19-
"postpack": "",
19+
"prepack": "npm run clean && npm run build",
2020
"posttest": "tslint -p test -t stylish",
2121
"build": "tsc -b",
2222
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",

packages/luis/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"repository": "https://github.com/microsoft/botframework-cli/tree/master/packages/luis",
2727
"scripts": {
2828
"postpack": "rimraf oclif.manifest.json",
29+
"prepack": "npm run clean && npm run build && npm run doc:readme",
2930
"posttest": "tslint -p test -t stylish",
3031
"build": "tsc -b",
3132
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",

packages/plugins/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"scripts": {
5454
"postpack": "rimraf oclif.manifest.json",
5555
"posttest": "eslint . --ext .ts --config .eslintrc",
56-
"prepack": "rimraf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
56+
"prepack": "npm run clean && npm run build && oclif-dev manifest && oclif-dev readme",
5757
"build": "tsc -b",
5858
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",
5959
"test": "mocha",

packages/qnamaker/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"repository": "https://github.com/microsoft/botframework-cli/tree/master/packages/qnamaker",
2828
"scripts": {
2929
"postpack": "rimraf oclif.manifest.json",
30+
"prepack": "npm run clean && npm run build && npm run doc:readme",
3031
"posttest": "",
3132
"build": "tsc -b",
3233
"clean": "rimraf ./.nyc_output ./lib ./package-lock.json ./tsconfig.tsbuildinfo",

0 commit comments

Comments
 (0)