From f9f3d90d7d7913a04cacb738c51ee160fe3a1c1a Mon Sep 17 00:00:00 2001 From: Roy Razon Date: Mon, 27 Nov 2023 09:40:57 +0200 Subject: [PATCH] publish patched @oclif/core --- .github/workflows/npm-publish-canary.yaml | 10 +++-- package.json | 7 ++-- packages/cli-common/package.json | 2 +- .../cli-common/src/commands/base-command.ts | 1 + packages/cli/package.json | 6 +-- packages/cli/scripts/validate-tsconfig | 14 +++++++ packages/cli/tsconfig.json | 4 +- packages/driver-azure/package.json | 2 +- packages/driver-gce/package.json | 2 +- packages/driver-kube-pod/package.json | 2 +- packages/driver-lightsail/package.json | 2 +- packages/plugin-github/package.json | 2 +- patches/@oclif+core+3.12.0.patch | 38 ------------------- yarn.lock | 37 +++++++++--------- 14 files changed, 55 insertions(+), 74 deletions(-) create mode 100755 packages/cli/scripts/validate-tsconfig delete mode 100644 patches/@oclif+core+3.12.0.patch diff --git a/.github/workflows/npm-publish-canary.yaml b/.github/workflows/npm-publish-canary.yaml index 6f92e073..a0b485da 100644 --- a/.github/workflows/npm-publish-canary.yaml +++ b/.github/workflows/npm-publish-canary.yaml @@ -22,7 +22,11 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '18.x' - cache: yarn + # cache: yarn + + - run: | + rm -rf node_modules packages/*/node_modules + find `yarn cache dir` -maxdepth 1 -name '*oclif*' -delete - run: yarn @@ -61,10 +65,10 @@ jobs: yarn -s lerna version $VERSION --no-git-tag-version --preid $GIT_ID --ignore-scripts --exact --yes # commit that goes nowhere - git commit -m "canary version $VERSION" lerna.json packages/*/package.json + git commit -m "canary version $VERSION" lerna.json packages/*/package.json yarn.lock # publish - yarn -s lerna publish from-package --pre-dist-tag $GIT_ID --yes + yarn -s lerna publish from-package --pre-dist-tag $GIT_ID --dist-tag $GIT_ID --pre-dist-tag $GIT_ID --yes # undo the commit git reset --hard HEAD^1 diff --git a/package.json b/package.json index 2287254d..f6a904cd 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,6 @@ { "private": true, - "workspaces": [ - "packages/*" - ], + "workspaces": ["packages/*"], "devDependencies": { "husky": "^8.0.0", "lerna": "^6.6.2", @@ -13,6 +11,9 @@ "syncpack": "^9.8.4", "typescript": "^5.0.4" }, + "resolutions": { + "**/@oclif/core": "livecycle/oclif-core-patched-for-preevy#v3.12.0-preevy-patch-9" + }, "lint-staged": { "*.{ts,tsx}": [ "eslint --cache --fix" diff --git a/packages/cli-common/package.json b/packages/cli-common/package.json index debfdddd..d489f2e1 100644 --- a/packages/cli-common/package.json +++ b/packages/cli-common/package.json @@ -8,7 +8,7 @@ ], "license": "Apache-2.0", "dependencies": { - "@oclif/core": "^3", + "@oclif/core": "3.12.0", "@preevy/core": "0.0.56", "chalk": "^4.1.2", "iter-tools-es": "^7.5.3", diff --git a/packages/cli-common/src/commands/base-command.ts b/packages/cli-common/src/commands/base-command.ts index a1459300..1e4a3951 100644 --- a/packages/cli-common/src/commands/base-command.ts +++ b/packages/cli-common/src/commands/base-command.ts @@ -114,6 +114,7 @@ abstract class BaseCommand extends Comm }) emitter.unref() await emitter.flush() + // eslint-disable-next-line @typescript-eslint/return-await return await super.catch(error) } } diff --git a/packages/cli/package.json b/packages/cli/package.json index 531d0cd6..a26b7dba 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -19,7 +19,7 @@ ], "dependencies": { "@inquirer/confirm": "^2.0.14", - "@oclif/core": "^3", + "@oclif/core": "3.12.0", "@oclif/plugin-help": "^5", "@preevy/cli-common": "0.0.56", "@preevy/common": "0.0.56", @@ -38,6 +38,7 @@ "yaml": "^2.3.2" }, "devDependencies": { + "@types/cli-progress": "^3.11.5", "@types/inquirer": "^8.0.0", "@types/inquirer-autocomplete-prompt": "^3.0.3", "@types/lodash": "^4.14.192", @@ -95,14 +96,13 @@ "dist/hooks/**/*.js" ] }, - "bundleDependencies": ["@oclif/core"], "scripts": { "build": "yarn clean && tsc -b", "clean": "shx rm -rf dist", "lint": "eslint . --ext .ts --cache", "postpack": "shx rm -f oclif.manifest.json", "posttest": "yarn lint", - "prepack": "yarn build && oclif manifest && oclif readme --dir docs --multi && ./scripts/prepare_and_copy_docs.sh", + "prepack": "yarn build && ./scripts/validate-tsconfig && oclif manifest && oclif readme --dir docs --multi && ./scripts/prepare_and_copy_docs.sh", "cli": "./bin/dev", "version": "oclif readme && git add README.md" }, diff --git a/packages/cli/scripts/validate-tsconfig b/packages/cli/scripts/validate-tsconfig new file mode 100755 index 00000000..507b6b0d --- /dev/null +++ b/packages/cli/scripts/validate-tsconfig @@ -0,0 +1,14 @@ +#!/usr/bin/env node +const path = require('path') +const util = require('util') +const fs = require('fs') + +const tsConfig = path.join(__dirname, '..', './tsconfig.json') + +try { + JSON.parse(fs.readFileSync('./tsconfig.json')) +} catch (e) { + console.error('Error parsing %s: oclif expects valid JSON: %j', tsConfig, util.inspect(e)) + process.exit(1) +} + diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 6a6122df..9712537f 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -10,7 +10,7 @@ "lib": ["es2022"], "esModuleInterop": true, "sourceMap": true, - "baseUrl": ".", + "baseUrl": "." }, "include": [ "src/**/*" @@ -25,6 +25,6 @@ { "path": "../driver-gce" }, { "path": "../driver-azure" }, { "path": "../driver-kube-pod" }, - { "path": "../plugin-github" }, + { "path": "../plugin-github" } ] } diff --git a/packages/driver-azure/package.json b/packages/driver-azure/package.json index ece83d7b..e89b3684 100644 --- a/packages/driver-azure/package.json +++ b/packages/driver-azure/package.json @@ -17,7 +17,7 @@ "@azure/arm-subscriptions": "^5.1.0", "@azure/identity": "^3.2.2", "@azure/logger": "^1.0.4", - "@oclif/core": "^3", + "@oclif/core": "3.12.0", "@preevy/core": "0.0.56", "inquirer": "^8.0.0", "inquirer-autocomplete-prompt": "^2.0.0", diff --git a/packages/driver-gce/package.json b/packages/driver-gce/package.json index 9e734f4e..a7747f80 100644 --- a/packages/driver-gce/package.json +++ b/packages/driver-gce/package.json @@ -12,7 +12,7 @@ "dependencies": { "@google-cloud/compute": "^4.0.1", "@google-cloud/storage": "^6.9.5", - "@oclif/core": "^3", + "@oclif/core": "3.12.0", "@preevy/core": "0.0.56", "google-auth-library": "^8.7.0", "google-gax": "^4.0.4", diff --git a/packages/driver-kube-pod/package.json b/packages/driver-kube-pod/package.json index e558b85b..36169d6c 100644 --- a/packages/driver-kube-pod/package.json +++ b/packages/driver-kube-pod/package.json @@ -11,7 +11,7 @@ "license": "Apache-2.0", "dependencies": { "@kubernetes/client-node": "^0.18.1", - "@oclif/core": "^3", + "@oclif/core": "3.12.0", "@preevy/common": "0.0.56", "@preevy/core": "0.0.56", "fast-safe-stringify": "^2.1.1", diff --git a/packages/driver-lightsail/package.json b/packages/driver-lightsail/package.json index ca075b2b..411abef3 100644 --- a/packages/driver-lightsail/package.json +++ b/packages/driver-lightsail/package.json @@ -14,7 +14,7 @@ "@aws-sdk/client-s3": "^3.271.0", "@aws-sdk/client-sts": "^3.289.0", "@aws-sdk/util-waiter": "^3.271.0", - "@oclif/core": "^3", + "@oclif/core": "3.12.0", "@preevy/core": "0.0.56", "inquirer": "^8.0.0", "inquirer-autocomplete-prompt": "^2.0.0", diff --git a/packages/plugin-github/package.json b/packages/plugin-github/package.json index 3e29ed36..e3b8e62d 100644 --- a/packages/plugin-github/package.json +++ b/packages/plugin-github/package.json @@ -8,7 +8,7 @@ ], "license": "Apache-2.0", "dependencies": { - "@oclif/core": "^3", + "@oclif/core": "3.12.0", "@preevy/cli-common": "0.0.56", "@preevy/core": "0.0.56", "lodash": "^4.17.21", diff --git a/patches/@oclif+core+3.12.0.patch b/patches/@oclif+core+3.12.0.patch deleted file mode 100644 index 1c47b06b..00000000 --- a/patches/@oclif+core+3.12.0.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/node_modules/@oclif/core/lib/help/util.js b/node_modules/@oclif/core/lib/help/util.js -index 6c97a31..3a7ace6 100644 ---- a/node_modules/@oclif/core/lib/help/util.js -+++ b/node_modules/@oclif/core/lib/help/util.js -@@ -43,7 +43,7 @@ function collateSpacedCmdIDFromArgs(argv, config) { - const ids = (0, util_1.collectUsableIds)(config.commandIDs); - const final = []; - const idPresent = (id) => ids.has(id); -- const finalizeId = (s) => (s ? [...final, s].join(':') : final.join(':')); -+ const finalizeId = (s) => (s ? [...final, s] : final).filter(Boolean).join(':'); - const hasArgs = () => { - const id = finalizeId(); - if (!id) -diff --git a/node_modules/@oclif/core/lib/interfaces/parser.d.ts b/node_modules/@oclif/core/lib/interfaces/parser.d.ts -index acb8583..2d53745 100644 ---- a/node_modules/@oclif/core/lib/interfaces/parser.d.ts -+++ b/node_modules/@oclif/core/lib/interfaces/parser.d.ts -@@ -200,6 +200,7 @@ export type OptionFlagProps = FlagProps & { - helpValue?: string; - options?: readonly string[]; - multiple?: boolean; -+ singleValue?: boolean; - /** - * Delimiter to separate the values for a multiple value flag. - * Only respected if multiple is set to true. Default behavior is to -diff --git a/node_modules/@oclif/core/lib/parser/parse.js b/node_modules/@oclif/core/lib/parser/parse.js -index 032063d..72d2ed5 100644 ---- a/node_modules/@oclif/core/lib/parser/parse.js -+++ b/node_modules/@oclif/core/lib/parser/parse.js -@@ -145,7 +145,7 @@ class Parser { - continue; - } - } -- if (parsingFlags && this.currentFlag && this.currentFlag.multiple) { -+ if (parsingFlags && this.currentFlag && this.currentFlag.multiple && !this.currentFlag.singleValue) { - this.raw.push({ flag: this.currentFlag.name, input, type: 'flag' }); - continue; - } diff --git a/yarn.lock b/yarn.lock index 0fa88379..e02c109c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2528,20 +2528,19 @@ dependencies: nx "15.9.4" -"@oclif/core@^2.15.0": - version "2.15.0" - resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.15.0.tgz#f27797b30a77d13279fba88c1698fc34a0bd0d2a" - integrity sha512-fNEMG5DzJHhYmI3MgpByTvltBOMyFcnRIUMxbiz2ai8rhaYgaTHMG3Q38HcosfIvtw9nCjxpcQtC8MN8QtVCcA== +"@oclif/core@3.12.0", "@oclif/core@^3.0.4", "@oclif/core@^3.11.0": + version "3.12.0" + resolved "https://codeload.github.com/livecycle/oclif-core-patched-for-preevy/tar.gz/a76886f9c73fbedc4d18d43134387aadc53ca4f3" dependencies: - "@types/cli-progress" "^3.11.0" ansi-escapes "^4.3.2" ansi-styles "^4.3.0" cardinal "^2.1.1" chalk "^4.1.2" clean-stack "^3.0.1" cli-progress "^3.12.0" + color "^4.2.3" debug "^4.3.4" - ejs "^3.1.8" + ejs "^3.1.9" get-package-type "^0.1.0" globby "^11.1.0" hyperlinker "^1.0.0" @@ -2556,26 +2555,25 @@ strip-ansi "^6.0.1" supports-color "^8.1.1" supports-hyperlinks "^2.2.0" - ts-node "^10.9.1" - tslib "^2.5.0" + tsconfck "^3.0.0" widest-line "^3.1.0" wordwrap "^1.0.0" wrap-ansi "^7.0.0" -"@oclif/core@^3", "@oclif/core@^3.0.4", "@oclif/core@^3.11.0": - version "3.12.0" - resolved "https://registry.yarnpkg.com/@oclif/core/-/core-3.12.0.tgz#4b38b1b5dab2f7585f89c3927a8a157b258b4bd6" - integrity sha512-mT1Vpd1E20IJ7P6GDYOivylPdTHq/xVgFjeCDjitFW86UAklFM8BEFyFB7KpsTvpmjRbCoda3yU10lSI1224lw== +"@oclif/core@^2.15.0": + version "2.15.0" + resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.15.0.tgz#f27797b30a77d13279fba88c1698fc34a0bd0d2a" + integrity sha512-fNEMG5DzJHhYmI3MgpByTvltBOMyFcnRIUMxbiz2ai8rhaYgaTHMG3Q38HcosfIvtw9nCjxpcQtC8MN8QtVCcA== dependencies: + "@types/cli-progress" "^3.11.0" ansi-escapes "^4.3.2" ansi-styles "^4.3.0" cardinal "^2.1.1" chalk "^4.1.2" clean-stack "^3.0.1" cli-progress "^3.12.0" - color "^4.2.3" debug "^4.3.4" - ejs "^3.1.9" + ejs "^3.1.8" get-package-type "^0.1.0" globby "^11.1.0" hyperlinker "^1.0.0" @@ -2590,7 +2588,8 @@ strip-ansi "^6.0.1" supports-color "^8.1.1" supports-hyperlinks "^2.2.0" - tsconfck "^3.0.0" + ts-node "^10.9.1" + tslib "^2.5.0" widest-line "^3.1.0" wordwrap "^1.0.0" wrap-ansi "^7.0.0" @@ -3789,10 +3788,10 @@ resolved "https://registry.yarnpkg.com/@types/caseless/-/caseless-0.12.2.tgz#f65d3d6389e01eeb458bd54dc8f52b95a9463bc8" integrity sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w== -"@types/cli-progress@^3.11.0": - version "3.11.0" - resolved "https://registry.yarnpkg.com/@types/cli-progress/-/cli-progress-3.11.0.tgz#ec79df99b26757c3d1c7170af8422e0fc95eef7e" - integrity sha512-XhXhBv1R/q2ahF3BM7qT5HLzJNlIL0wbcGyZVjqOTqAybAnsLisd7gy1UCyIqpL+5Iv6XhlSyzjLCnI2sIdbCg== +"@types/cli-progress@^3.11.0", "@types/cli-progress@^3.11.5": + version "3.11.5" + resolved "https://registry.yarnpkg.com/@types/cli-progress/-/cli-progress-3.11.5.tgz#9518c745e78557efda057e3f96a5990c717268c3" + integrity sha512-D4PbNRbviKyppS5ivBGyFO29POlySLmA2HyUFE4p5QGazAMM3CwkKWcvTl8gvElSuxRh6FPKL8XmidX873ou4g== dependencies: "@types/node" "*"