From ab473f4a3e2132fc53ddd54e04ab5184e00389b1 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 | 2 +- package.json | 9 ++++++--- packages/cli/package.json | 6 ++++-- .../cli/patches}/@oclif+core+3.12.0.patch | 0 packages/cli/scripts/validate-tsconfig | 14 ++++++++++++++ packages/cli/tsconfig.json | 4 ++-- packages/cli/validate-tsconfig.js | 0 7 files changed, 27 insertions(+), 8 deletions(-) rename {patches => packages/cli/patches}/@oclif+core+3.12.0.patch (100%) create mode 100755 packages/cli/scripts/validate-tsconfig create mode 100644 packages/cli/validate-tsconfig.js diff --git a/.github/workflows/npm-publish-canary.yaml b/.github/workflows/npm-publish-canary.yaml index 6f92e073..838f8542 100644 --- a/.github/workflows/npm-publish-canary.yaml +++ b/.github/workflows/npm-publish-canary.yaml @@ -64,7 +64,7 @@ jobs: git commit -m "canary version $VERSION" lerna.json packages/*/package.json # 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 --yes # undo the commit git reset --hard HEAD^1 diff --git a/package.json b/package.json index 2287254d..630d7a5b 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,11 @@ { "private": true, - "workspaces": [ - "packages/*" - ], + "workspaces": { + "packages": [ + "packages/*" + ], + "nohoist": ["**/@oclif/core", "**/patch-package", "**/patch-package/**"] + }, "devDependencies": { "husky": "^8.0.0", "lerna": "^6.6.2", diff --git a/packages/cli/package.json b/packages/cli/package.json index 531d0cd6..7e3a999d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -34,6 +34,7 @@ "inquirer-autocomplete-prompt": "^2.0.0", "iter-tools-es": "^7.5.3", "lodash": "^4.17.21", + "patch-package": "^8.0.0", "shell-escape": "^0.2.0", "yaml": "^2.3.2" }, @@ -102,9 +103,10 @@ "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" + "version": "oclif readme && git add README.md", + "postinstall": "patch-package" }, "engines": { "node": ">=18.0.0" diff --git a/patches/@oclif+core+3.12.0.patch b/packages/cli/patches/@oclif+core+3.12.0.patch similarity index 100% rename from patches/@oclif+core+3.12.0.patch rename to packages/cli/patches/@oclif+core+3.12.0.patch 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/cli/validate-tsconfig.js b/packages/cli/validate-tsconfig.js new file mode 100644 index 00000000..e69de29b