@storm-software/workspace-tools 1.270.1 → 1.271.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.md +1 -1
- package/dist/chunk-4QYM3VS4.mjs +282 -0
- package/dist/{chunk-ZP76EMBE.js → chunk-FYXWAGK3.js} +97 -27
- package/dist/chunk-MJMN2T4N.mjs +166 -0
- package/dist/chunk-RZVF4LHT.js +282 -0
- package/dist/executors.js +3 -3
- package/dist/executors.mjs +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +4 -4
- package/dist/src/executors/npm-publish/executor.js +3 -3
- package/dist/src/executors/npm-publish/executor.mjs +2 -2
- package/dist/src/generators/preset/files/LICENSE +201 -0
- package/dist/src/utils/index.d.mts +1 -1
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/index.js +2 -2
- package/dist/src/utils/index.mjs +3 -3
- package/dist/src/utils/pnpm-deps-update.d.mts +3 -3
- package/dist/src/utils/pnpm-deps-update.d.ts +3 -3
- package/dist/src/utils/pnpm-deps-update.js +2 -2
- package/dist/src/utils/pnpm-deps-update.mjs +3 -3
- package/docs/api/base/base-executor.schema.md +16 -0
- package/docs/api/base/base-generator.schema.md +15 -0
- package/docs/api/base/cargo-base-executor.schema.md +90 -0
- package/docs/api/base/typescript-build-executor.schema.md +126 -0
- package/docs/api/base/typescript-library-generator.schema.md +129 -0
- package/docs/api/executors/cargo-build/schema.md +89 -0
- package/docs/api/executors/cargo-check/schema.md +90 -0
- package/docs/api/executors/cargo-clippy/schema.md +99 -0
- package/docs/api/executors/cargo-doc/schema.md +130 -0
- package/docs/api/executors/cargo-format/schema.md +90 -0
- package/docs/api/executors/cargo-publish/schema.md +117 -0
- package/docs/api/executors/clean-package/schema.md +65 -0
- package/docs/api/executors/esbuild/schema.md +126 -0
- package/docs/api/executors/npm-publish/schema.md +64 -0
- package/docs/api/executors/size-limit/schema.md +25 -0
- package/docs/api/executors/typia/schema.md +46 -0
- package/docs/api/executors/unbuild/schema.md +222 -0
- package/docs/api/generators/browser-library/files/README.md +58 -0
- package/docs/api/generators/browser-library/schema.md +129 -0
- package/docs/api/generators/config-schema/schema.md +25 -0
- package/docs/api/generators/init/schema.md +15 -0
- package/docs/api/generators/neutral-library/files/README.md +58 -0
- package/docs/api/generators/neutral-library/schema.md +129 -0
- package/docs/api/generators/node-library/files/README.md +63 -0
- package/docs/api/generators/node-library/schema.md +129 -0
- package/docs/api/generators/preset/schema.md +110 -0
- package/docs/api/generators/release-version/schema.md +160 -0
- package/package.json +13 -35
- package/dist/chunk-CWBVTZAO.mjs +0 -467
- package/dist/chunk-HMJTTE4A.mjs +0 -96
- package/dist/chunk-PGUGHXXT.js +0 -467
- package/docs/executors/rollup.md +0 -88
- package/executors.ts +0 -23
- package/generators.ts +0 -14
- package/index.ts +0 -5
- package/project.json +0 -58
- package/src/base/base-executor.ts +0 -200
- package/src/base/base-executor.untyped.ts +0 -18
- package/src/base/base-generator.ts +0 -130
- package/src/base/base-generator.untyped.ts +0 -16
- package/src/base/cargo-base-executor.untyped.ts +0 -73
- package/src/base/index.ts +0 -8
- package/src/base/typescript-build-executor.untyped.ts +0 -153
- package/src/base/typescript-library-generator.ts +0 -415
- package/src/base/typescript-library-generator.untyped.ts +0 -106
- package/src/executors/cargo-build/executor.spec.ts +0 -18
- package/src/executors/cargo-build/executor.ts +0 -28
- package/src/executors/cargo-build/untyped.ts +0 -18
- package/src/executors/cargo-check/executor.spec.ts +0 -18
- package/src/executors/cargo-check/executor.ts +0 -27
- package/src/executors/cargo-check/untyped.ts +0 -11
- package/src/executors/cargo-clippy/executor.spec.ts +0 -18
- package/src/executors/cargo-clippy/executor.ts +0 -28
- package/src/executors/cargo-clippy/untyped.ts +0 -18
- package/src/executors/cargo-doc/executor.spec.ts +0 -18
- package/src/executors/cargo-doc/executor.ts +0 -39
- package/src/executors/cargo-doc/untyped.ts +0 -44
- package/src/executors/cargo-format/executor.spec.ts +0 -18
- package/src/executors/cargo-format/executor.ts +0 -28
- package/src/executors/cargo-format/untyped.ts +0 -11
- package/src/executors/cargo-publish/executor.spec.ts +0 -11
- package/src/executors/cargo-publish/executor.ts +0 -139
- package/src/executors/cargo-publish/untyped.ts +0 -33
- package/src/executors/clean-package/constants.ts +0 -99
- package/src/executors/clean-package/executor.spec.ts +0 -18
- package/src/executors/clean-package/executor.ts +0 -214
- package/src/executors/clean-package/types.ts +0 -6
- package/src/executors/clean-package/untyped.ts +0 -60
- package/src/executors/clean-package/utils.ts +0 -85
- package/src/executors/esbuild/executor.spec.ts +0 -11
- package/src/executors/esbuild/executor.ts +0 -67
- package/src/executors/esbuild/untyped.ts +0 -20
- package/src/executors/npm-publish/executor.spec.ts +0 -11
- package/src/executors/npm-publish/executor.ts +0 -680
- package/src/executors/npm-publish/untyped.ts +0 -56
- package/src/executors/size-limit/executor.spec.ts +0 -18
- package/src/executors/size-limit/executor.ts +0 -88
- package/src/executors/size-limit/untyped.ts +0 -22
- package/src/executors/typia/executor.ts +0 -54
- package/src/executors/typia/untyped.ts +0 -48
- package/src/executors/unbuild/executor.spec.ts +0 -11
- package/src/executors/unbuild/executor.ts +0 -136
- package/src/executors/unbuild/untyped.ts +0 -152
- package/src/generators/browser-library/generator.spec.ts +0 -20
- package/src/generators/browser-library/generator.ts +0 -109
- package/src/generators/browser-library/untyped.ts +0 -29
- package/src/generators/config-schema/generator.spec.ts +0 -20
- package/src/generators/config-schema/generator.ts +0 -90
- package/src/generators/config-schema/untyped.ts +0 -19
- package/src/generators/init/init.ts +0 -32
- package/src/generators/init/untyped.ts +0 -16
- package/src/generators/neutral-library/generator.spec.ts +0 -20
- package/src/generators/neutral-library/generator.ts +0 -81
- package/src/generators/neutral-library/untyped.ts +0 -29
- package/src/generators/node-library/generator.spec.ts +0 -20
- package/src/generators/node-library/generator.ts +0 -84
- package/src/generators/node-library/untyped.ts +0 -29
- package/src/generators/preset/files/.all-contributorsrc.template +0 -48
- package/src/generators/preset/files/.editorconfig +0 -454
- package/src/generators/preset/files/.env.template +0 -38
- package/src/generators/preset/files/.gitattributes +0 -52
- package/src/generators/preset/files/.github/.nvmrc +0 -1
- package/src/generators/preset/files/.github/CODEOWNERS +0 -3
- package/src/generators/preset/files/.github/CODE_OF_CONDUCT.md +0 -125
- package/src/generators/preset/files/.github/CONTRIBUTING.md.template +0 -15
- package/src/generators/preset/files/.github/FUNDING.yml +0 -3
- package/src/generators/preset/files/.github/ISSUE_TEMPLATE/bug-report.yml.template +0 -102
- package/src/generators/preset/files/.github/ISSUE_TEMPLATE/documentation.yml.template +0 -56
- package/src/generators/preset/files/.github/ISSUE_TEMPLATE/feature-request.yml.template +0 -60
- package/src/generators/preset/files/.github/PULL_REQUEST_TEMPLATE.md.template +0 -39
- package/src/generators/preset/files/.github/SECURITY.md +0 -9
- package/src/generators/preset/files/.github/codecov.yml +0 -29
- package/src/generators/preset/files/.github/dependabot.yml +0 -64
- package/src/generators/preset/files/.github/labels.yml +0 -84
- package/src/generators/preset/files/.github/renovate.json +0 -4
- package/src/generators/preset/files/.github/renovate.json.template +0 -63
- package/src/generators/preset/files/.github/stale.yml +0 -55
- package/src/generators/preset/files/.github/workflows/build-release.yml.template +0 -25
- package/src/generators/preset/files/.github/workflows/code-review.yml +0 -18
- package/src/generators/preset/files/.github/workflows/codeql.yml +0 -84
- package/src/generators/preset/files/.github/workflows/dependabot-update.yml +0 -32
- package/src/generators/preset/files/.github/workflows/git-guardian.yml +0 -23
- package/src/generators/preset/files/.github/workflows/greetings.yml +0 -31
- package/src/generators/preset/files/.github/workflows/labels.yml +0 -31
- package/src/generators/preset/files/.github/workflows/lock.yml +0 -26
- package/src/generators/preset/files/.log4brains.yml.template +0 -5
- package/src/generators/preset/files/.markdownlint.json +0 -155
- package/src/generators/preset/files/.verdaccio/config.yml.template +0 -40
- package/src/generators/preset/files/.vscode/README.md +0 -32
- package/src/generators/preset/files/.vscode/cspell.json +0 -3
- package/src/generators/preset/files/.vscode/extensions.json +0 -14
- package/src/generators/preset/files/.vscode/launch.json +0 -37
- package/src/generators/preset/files/.vscode/settings.json +0 -401
- package/src/generators/preset/files/.vscode/tasks.json +0 -4
- package/src/generators/preset/files/.whitesource +0 -14
- package/src/generators/preset/files/assets/diagrams/.gitkeep +0 -0
- package/src/generators/preset/files/assets/icons/dark/.gitkeep +0 -0
- package/src/generators/preset/files/assets/icons/light/.gitkeep +0 -0
- package/src/generators/preset/files/assets/logos/.gitkeep +0 -0
- package/src/generators/preset/files/docs/api-reference/.gitkeep +0 -0
- package/src/generators/preset/generator.spec.ts +0 -20
- package/src/generators/preset/generator.ts +0 -315
- package/src/generators/preset/untyped.ts +0 -88
- package/src/generators/release-version/generator.spec.ts +0 -20
- package/src/generators/release-version/generator.ts +0 -920
- package/src/generators/release-version/untyped.ts +0 -156
- package/src/plugins/rust/cargo-toml.ts +0 -434
- package/src/plugins/rust/index.ts +0 -1
- package/src/plugins/typescript/index.ts +0 -1
- package/src/plugins/typescript/project-config.ts +0 -564
- package/src/plugins/typescript/tsup.ts +0 -198
- package/src/types.ts +0 -130
- package/src/utils/apply-workspace-tokens.ts +0 -73
- package/src/utils/cargo.ts +0 -219
- package/src/utils/create-cli-options.ts +0 -23
- package/src/utils/get-project-configurations.ts +0 -27
- package/src/utils/index.ts +0 -12
- package/src/utils/lock-file.ts +0 -159
- package/src/utils/package-helpers.ts +0 -54
- package/src/utils/plugin-helpers.ts +0 -112
- package/src/utils/pnpm-deps-update.ts +0 -111
- package/src/utils/project-tags.ts +0 -162
- package/src/utils/toml.ts +0 -204
- package/src/utils/typia-transform.ts +0 -8
- package/src/utils/versions.ts +0 -19
- package/tsconfig.json +0 -30
- package/tsup.config.ts +0 -36
- /package/{src/generators/preset/files/LICENSE → LICENSE} +0 -0
- /package/{src → dist/src}/base/base-executor.schema.d.ts +0 -0
- /package/{src → dist/src}/base/base-executor.schema.json +0 -0
- /package/{src → dist/src}/base/base-executor.schema.md +0 -0
- /package/{src → dist/src}/base/base-generator.schema.d.ts +0 -0
- /package/{src → dist/src}/base/base-generator.schema.json +0 -0
- /package/{src → dist/src}/base/base-generator.schema.md +0 -0
- /package/{src → dist/src}/base/cargo-base-executor.schema.d.ts +0 -0
- /package/{src → dist/src}/base/cargo-base-executor.schema.json +0 -0
- /package/{src → dist/src}/base/cargo-base-executor.schema.md +0 -0
- /package/{src → dist/src}/base/typescript-build-executor.schema.d.ts +0 -0
- /package/{src → dist/src}/base/typescript-build-executor.schema.json +0 -0
- /package/{src → dist/src}/base/typescript-build-executor.schema.md +0 -0
- /package/{src → dist/src}/base/typescript-library-generator.schema.d.ts +0 -0
- /package/{src → dist/src}/base/typescript-library-generator.schema.json +0 -0
- /package/{src → dist/src}/base/typescript-library-generator.schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-build/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-build/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-build/schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-check/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-check/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-check/schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-clippy/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-clippy/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-clippy/schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-doc/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-doc/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-doc/schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-format/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-format/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-format/schema.md +0 -0
- /package/{src → dist/src}/executors/cargo-publish/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/cargo-publish/schema.json +0 -0
- /package/{src → dist/src}/executors/cargo-publish/schema.md +0 -0
- /package/{src → dist/src}/executors/clean-package/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/clean-package/schema.json +0 -0
- /package/{src → dist/src}/executors/clean-package/schema.md +0 -0
- /package/{src → dist/src}/executors/esbuild/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/esbuild/schema.json +0 -0
- /package/{src → dist/src}/executors/esbuild/schema.md +0 -0
- /package/{src → dist/src}/executors/npm-publish/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/npm-publish/schema.json +0 -0
- /package/{src → dist/src}/executors/npm-publish/schema.md +0 -0
- /package/{src → dist/src}/executors/size-limit/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/size-limit/schema.json +0 -0
- /package/{src → dist/src}/executors/size-limit/schema.md +0 -0
- /package/{src → dist/src}/executors/typia/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/typia/schema.json +0 -0
- /package/{src → dist/src}/executors/typia/schema.md +0 -0
- /package/{src → dist/src}/executors/unbuild/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/unbuild/schema.json +0 -0
- /package/{src → dist/src}/executors/unbuild/schema.md +0 -0
- /package/{src → dist/src}/generators/browser-library/files/README.md +0 -0
- /package/{src → dist/src}/generators/browser-library/files/jest.config.ts +0 -0
- /package/{src → dist/src}/generators/browser-library/files/src/index.ts.template +0 -0
- /package/{src → dist/src}/generators/browser-library/files/tsconfig.spec.json +0 -0
- /package/{src → dist/src}/generators/browser-library/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/browser-library/schema.json +0 -0
- /package/{src → dist/src}/generators/browser-library/schema.md +0 -0
- /package/{src → dist/src}/generators/config-schema/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/config-schema/schema.json +0 -0
- /package/{src → dist/src}/generators/config-schema/schema.md +0 -0
- /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/init/schema.json +0 -0
- /package/{src → dist/src}/generators/init/schema.md +0 -0
- /package/{src → dist/src}/generators/neutral-library/files/README.md +0 -0
- /package/{src → dist/src}/generators/neutral-library/files/jest.config.ts +0 -0
- /package/{src → dist/src}/generators/neutral-library/files/src/index.ts.template +0 -0
- /package/{src → dist/src}/generators/neutral-library/files/tsconfig.spec.json +0 -0
- /package/{src → dist/src}/generators/neutral-library/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/neutral-library/schema.json +0 -0
- /package/{src → dist/src}/generators/neutral-library/schema.md +0 -0
- /package/{src → dist/src}/generators/node-library/files/README.md +0 -0
- /package/{src → dist/src}/generators/node-library/files/jest.config.ts +0 -0
- /package/{src → dist/src}/generators/node-library/files/src/index.ts.template +0 -0
- /package/{src → dist/src}/generators/node-library/files/tsconfig.spec.json +0 -0
- /package/{src → dist/src}/generators/node-library/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/node-library/schema.json +0 -0
- /package/{src → dist/src}/generators/node-library/schema.md +0 -0
- /package/{src → dist/src}/generators/preset/files/README.md.template +0 -0
- /package/{src → dist/src}/generators/preset/files/docs/readme-templates/README.footer.md.template +0 -0
- /package/{src → dist/src}/generators/preset/files/docs/readme-templates/README.header.md.template +0 -0
- /package/{src → dist/src}/generators/preset/files/eslint.config.js.template +0 -0
- /package/{src → dist/src}/generators/preset/files/knip.json +0 -0
- /package/{src → dist/src}/generators/preset/files/lefthook.json +0 -0
- /package/{src → dist/src}/generators/preset/files/nx.json +0 -0
- /package/{src → dist/src}/generators/preset/files/pnpm-workspace.yaml +0 -0
- /package/{src → dist/src}/generators/preset/files/socket.yaml +0 -0
- /package/{src → dist/src}/generators/preset/files/storm.json.template +0 -0
- /package/{src → dist/src}/generators/preset/files/tsconfig.base.json.template +0 -0
- /package/{src → dist/src}/generators/preset/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/preset/schema.json +0 -0
- /package/{src → dist/src}/generators/preset/schema.md +0 -0
- /package/{src → dist/src}/generators/release-version/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/release-version/schema.json +0 -0
- /package/{src → dist/src}/generators/release-version/schema.md +0 -0
- /package/{src → dist/src}/plugins/typescript/untyped-schema.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Storm Ops - Workspace Tools
|
|
4
4
|
|
|
5
|
+
## [1.271.0](https://github.com/storm-software/storm-ops/releases/tag/workspace-tools%401.271.0) (2025-05-06)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- **workspace-tools:** Update the release executor to replace workspace
|
|
10
|
+
configurations
|
|
11
|
+
([7d2aa456c](https://github.com/storm-software/storm-ops/commit/7d2aa456c))
|
|
12
|
+
|
|
13
|
+
### Miscellaneous
|
|
14
|
+
|
|
15
|
+
- **monorepo:** Regenerate README markdown files
|
|
16
|
+
([96f241a4d](https://github.com/storm-software/storm-ops/commit/96f241a4d))
|
|
17
|
+
- **monorepo:** Regenerate README markdown files
|
|
18
|
+
([17bbe7e16](https://github.com/storm-software/storm-ops/commit/17bbe7e16))
|
|
19
|
+
|
|
20
|
+
### Updated Dependencies
|
|
21
|
+
|
|
22
|
+
- Updated prettier to 0.49.0
|
|
23
|
+
- Updated esbuild to 0.39.0
|
|
24
|
+
- Updated esbuild to 0.39.0
|
|
25
|
+
- Updated unbuild to 0.45.0
|
|
26
|
+
- Updated unbuild to 0.45.0
|
|
27
|
+
|
|
28
|
+
## [1.270.2](https://github.com/storm-software/storm-ops/releases/tag/workspace-tools%401.270.2) (2025-05-06)
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
- **workspace-tools:** Resolve issue with import path in executor
|
|
33
|
+
([ddad2fdc8](https://github.com/storm-software/storm-ops/commit/ddad2fdc8))
|
|
34
|
+
|
|
35
|
+
### Miscellaneous
|
|
36
|
+
|
|
37
|
+
- **monorepo:** Regenerate README markdown files
|
|
38
|
+
([7e0751c3d](https://github.com/storm-software/storm-ops/commit/7e0751c3d))
|
|
39
|
+
|
|
40
|
+
### Updated Dependencies
|
|
41
|
+
|
|
42
|
+
- Updated prettier to 0.48.2
|
|
43
|
+
- Updated esbuild to 0.38.2
|
|
44
|
+
- Updated esbuild to 0.38.2
|
|
45
|
+
- Updated unbuild to 0.44.2
|
|
46
|
+
- Updated unbuild to 0.44.2
|
|
47
|
+
|
|
5
48
|
## [1.270.1](https://github.com/storm-software/storm-ops/releases/tag/workspace-tools%401.270.1) (2025-05-06)
|
|
6
49
|
|
|
7
50
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
23
23
|
|
|
24
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pnpmUpdate
|
|
3
|
+
} from "./chunk-MJMN2T4N.mjs";
|
|
4
|
+
import {
|
|
5
|
+
joinPaths
|
|
6
|
+
} from "./chunk-U7JFVMCK.mjs";
|
|
7
|
+
|
|
8
|
+
// src/executors/npm-publish/executor.ts
|
|
9
|
+
import { execSync } from "node:child_process";
|
|
10
|
+
import { readFile } from "node:fs/promises";
|
|
11
|
+
var LARGE_BUFFER = 1024 * 1e6;
|
|
12
|
+
async function npmPublishExecutorFn(options, context) {
|
|
13
|
+
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
14
|
+
if (!context.projectName) {
|
|
15
|
+
throw new Error("The `npm-publish` executor requires a `projectName`.");
|
|
16
|
+
}
|
|
17
|
+
const projectConfig = context.projectsConfigurations?.projects?.[context.projectName];
|
|
18
|
+
if (!projectConfig) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Could not find project configuration for \`${context.projectName}\``
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
const packageRoot = joinPaths(
|
|
24
|
+
context.root,
|
|
25
|
+
options.packageRoot || joinPaths("dist", projectConfig.root)
|
|
26
|
+
);
|
|
27
|
+
const packageJsonPath = joinPaths(packageRoot, "package.json");
|
|
28
|
+
const packageJsonFile = await readFile(packageJsonPath, "utf8");
|
|
29
|
+
if (!packageJsonFile) {
|
|
30
|
+
throw new Error(`Could not find \`package.json\` at ${packageJsonPath}`);
|
|
31
|
+
}
|
|
32
|
+
const packageJson = JSON.parse(packageJsonFile);
|
|
33
|
+
const packageName = packageJson.name;
|
|
34
|
+
console.info(
|
|
35
|
+
`\u{1F680} Running Storm NPM Publish executor on the ${packageName} package`
|
|
36
|
+
);
|
|
37
|
+
const packageTxt = packageName === context.projectName ? `package "${packageName}"` : `package "${packageName}" from project "${context.projectName}"`;
|
|
38
|
+
if (packageJson.private === true) {
|
|
39
|
+
console.warn(
|
|
40
|
+
`Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`
|
|
41
|
+
);
|
|
42
|
+
return { success: true };
|
|
43
|
+
}
|
|
44
|
+
await pnpmUpdate(packageRoot, context.root);
|
|
45
|
+
const npmPublishCommandSegments = [`npm publish --json`];
|
|
46
|
+
const npmViewCommandSegments = [
|
|
47
|
+
`npm view ${packageName} versions dist-tags --json`
|
|
48
|
+
];
|
|
49
|
+
const registry = options.registry ? options.registry : execSync("npm config get registry", {
|
|
50
|
+
cwd: packageRoot,
|
|
51
|
+
env: {
|
|
52
|
+
...process.env,
|
|
53
|
+
FORCE_COLOR: "true"
|
|
54
|
+
},
|
|
55
|
+
maxBuffer: LARGE_BUFFER,
|
|
56
|
+
killSignal: "SIGTERM"
|
|
57
|
+
}).toString().trim();
|
|
58
|
+
if (registry) {
|
|
59
|
+
npmPublishCommandSegments.push(`--registry="${registry}" `);
|
|
60
|
+
npmViewCommandSegments.push(`--registry="${registry}" `);
|
|
61
|
+
}
|
|
62
|
+
if (options.otp) {
|
|
63
|
+
npmPublishCommandSegments.push(`--otp="${options.otp}" `);
|
|
64
|
+
}
|
|
65
|
+
if (isDryRun) {
|
|
66
|
+
npmPublishCommandSegments.push("--dry-run");
|
|
67
|
+
}
|
|
68
|
+
npmPublishCommandSegments.push("--provenance --access=public ");
|
|
69
|
+
const tag = options.tag || execSync("npm config get tag", {
|
|
70
|
+
cwd: packageRoot,
|
|
71
|
+
env: {
|
|
72
|
+
...process.env,
|
|
73
|
+
FORCE_COLOR: "true"
|
|
74
|
+
},
|
|
75
|
+
maxBuffer: LARGE_BUFFER,
|
|
76
|
+
killSignal: "SIGTERM"
|
|
77
|
+
}).toString().trim();
|
|
78
|
+
if (tag) {
|
|
79
|
+
npmPublishCommandSegments.push(`--tag="${tag}" `);
|
|
80
|
+
}
|
|
81
|
+
if (!isDryRun) {
|
|
82
|
+
const currentVersion = packageJson.version;
|
|
83
|
+
try {
|
|
84
|
+
try {
|
|
85
|
+
const result = execSync(npmViewCommandSegments.join(" "), {
|
|
86
|
+
cwd: packageRoot,
|
|
87
|
+
env: {
|
|
88
|
+
...process.env,
|
|
89
|
+
FORCE_COLOR: "true"
|
|
90
|
+
},
|
|
91
|
+
maxBuffer: LARGE_BUFFER,
|
|
92
|
+
killSignal: "SIGTERM"
|
|
93
|
+
});
|
|
94
|
+
const resultJson = JSON.parse(result.toString());
|
|
95
|
+
const distTags = resultJson["dist-tags"] || {};
|
|
96
|
+
if (distTags[tag] === currentVersion) {
|
|
97
|
+
console.warn(
|
|
98
|
+
`Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`
|
|
99
|
+
);
|
|
100
|
+
return { success: true };
|
|
101
|
+
}
|
|
102
|
+
} catch (err) {
|
|
103
|
+
console.warn("\n ********************** \n");
|
|
104
|
+
console.warn(
|
|
105
|
+
`An error occurred while checking for existing dist-tags
|
|
106
|
+
${JSON.stringify(err)}
|
|
107
|
+
|
|
108
|
+
Note: If this is the first time this package has been published to NPM, this can be ignored.
|
|
109
|
+
|
|
110
|
+
`
|
|
111
|
+
);
|
|
112
|
+
console.info("");
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
if (!isDryRun) {
|
|
116
|
+
const command = `npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry="${registry}" `;
|
|
117
|
+
console.info(
|
|
118
|
+
`Adding the dist-tag ${tag} - preparing to run the following:
|
|
119
|
+
${command}
|
|
120
|
+
`
|
|
121
|
+
);
|
|
122
|
+
const result = execSync(command, {
|
|
123
|
+
cwd: packageRoot,
|
|
124
|
+
env: {
|
|
125
|
+
...process.env,
|
|
126
|
+
FORCE_COLOR: "true"
|
|
127
|
+
},
|
|
128
|
+
maxBuffer: LARGE_BUFFER,
|
|
129
|
+
killSignal: "SIGTERM"
|
|
130
|
+
});
|
|
131
|
+
console.info(
|
|
132
|
+
`Added the dist-tag ${tag} to v${currentVersion} for registry "${registry}"
|
|
133
|
+
|
|
134
|
+
Execution response: ${result.toString()}
|
|
135
|
+
`
|
|
136
|
+
);
|
|
137
|
+
} else {
|
|
138
|
+
console.info(
|
|
139
|
+
`Would add the dist-tag ${tag} to v${currentVersion} for registry "${registry}", but [dry-run] was set.
|
|
140
|
+
`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return { success: true };
|
|
144
|
+
} catch (err) {
|
|
145
|
+
try {
|
|
146
|
+
console.warn("\n ********************** \n");
|
|
147
|
+
let error = err;
|
|
148
|
+
if (Buffer.isBuffer(error)) {
|
|
149
|
+
error = error.toString();
|
|
150
|
+
}
|
|
151
|
+
console.warn(
|
|
152
|
+
`An error occurred while adding dist-tags:
|
|
153
|
+
${error}
|
|
154
|
+
|
|
155
|
+
Note: If this is the first time this package has been published to NPM, this can be ignored.
|
|
156
|
+
|
|
157
|
+
`
|
|
158
|
+
);
|
|
159
|
+
console.info("");
|
|
160
|
+
const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
|
|
161
|
+
if (stdoutData?.error && !(stdoutData.error?.code?.includes("E404") && stdoutData.error?.summary?.includes("no such package available")) && !(err.stderr?.toString().includes("E404") && err.stderr?.toString().includes("no such package available"))) {
|
|
162
|
+
console.error(
|
|
163
|
+
"npm dist-tag add error please see below for more information:"
|
|
164
|
+
);
|
|
165
|
+
if (stdoutData.error.summary) {
|
|
166
|
+
console.error(stdoutData.error?.summary);
|
|
167
|
+
}
|
|
168
|
+
if (stdoutData.error.detail) {
|
|
169
|
+
console.error(stdoutData.error?.detail);
|
|
170
|
+
}
|
|
171
|
+
if (context.isVerbose) {
|
|
172
|
+
console.error(
|
|
173
|
+
`npm dist-tag add stdout: ${JSON.stringify(stdoutData, null, 2)}`
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
return { success: false };
|
|
177
|
+
}
|
|
178
|
+
} catch (err2) {
|
|
179
|
+
console.error(
|
|
180
|
+
`Something unexpected went wrong when processing the npm dist-tag add output
|
|
181
|
+
${JSON.stringify(err2)}`
|
|
182
|
+
);
|
|
183
|
+
return { success: false };
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} catch (err) {
|
|
187
|
+
let error = err;
|
|
188
|
+
if (Buffer.isBuffer(error)) {
|
|
189
|
+
error = error.toString();
|
|
190
|
+
}
|
|
191
|
+
console.error("\n ********************** \n");
|
|
192
|
+
console.info("");
|
|
193
|
+
console.error(
|
|
194
|
+
"An error occured trying to run the npm dist-tag add command."
|
|
195
|
+
);
|
|
196
|
+
console.error(error);
|
|
197
|
+
console.info("");
|
|
198
|
+
const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
|
|
199
|
+
if (!(stdoutData.error?.code?.includes("E404") && stdoutData.error?.summary?.toLowerCase().includes("not found")) && !(err.stderr?.toString().includes("E404") && err.stderr?.toString().toLowerCase().includes("not found"))) {
|
|
200
|
+
console.error(
|
|
201
|
+
`Something unexpected went wrong when checking for existing dist-tags.
|
|
202
|
+
|
|
203
|
+
Error: ${JSON.stringify(err)}
|
|
204
|
+
`
|
|
205
|
+
);
|
|
206
|
+
return { success: false };
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
const cwd = packageRoot;
|
|
212
|
+
const command = npmPublishCommandSegments.join(" ");
|
|
213
|
+
console.info(
|
|
214
|
+
`Running publish command "${command}" in current working directory: "${cwd}" `
|
|
215
|
+
);
|
|
216
|
+
const result = execSync(command, {
|
|
217
|
+
cwd,
|
|
218
|
+
env: {
|
|
219
|
+
...process.env,
|
|
220
|
+
FORCE_COLOR: "true"
|
|
221
|
+
},
|
|
222
|
+
maxBuffer: LARGE_BUFFER,
|
|
223
|
+
killSignal: "SIGTERM"
|
|
224
|
+
});
|
|
225
|
+
if (isDryRun) {
|
|
226
|
+
console.info(
|
|
227
|
+
`Would publish to ${registry} with tag "${tag}", but [dry-run] was set ${result ? `
|
|
228
|
+
|
|
229
|
+
Execution response: ${result.toString()}` : ""}
|
|
230
|
+
`
|
|
231
|
+
);
|
|
232
|
+
} else {
|
|
233
|
+
console.info(`Published to ${registry} with tag "${tag}" ${result ? `
|
|
234
|
+
|
|
235
|
+
Execution response: ${result.toString()}` : ""}
|
|
236
|
+
`);
|
|
237
|
+
}
|
|
238
|
+
return { success: true };
|
|
239
|
+
} catch (err) {
|
|
240
|
+
try {
|
|
241
|
+
console.error("\n ********************** \n");
|
|
242
|
+
console.info("");
|
|
243
|
+
console.error("An error occured running npm publish.");
|
|
244
|
+
console.error("Please see below for more information:");
|
|
245
|
+
console.info("");
|
|
246
|
+
const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
|
|
247
|
+
if (stdoutData.error.summary) {
|
|
248
|
+
console.error(stdoutData.error.summary);
|
|
249
|
+
console.error(stdoutData.error.summary);
|
|
250
|
+
}
|
|
251
|
+
if (stdoutData.error.detail) {
|
|
252
|
+
console.error(stdoutData.error.detail);
|
|
253
|
+
}
|
|
254
|
+
if (context.isVerbose) {
|
|
255
|
+
console.error(
|
|
256
|
+
`npm publish stdout:
|
|
257
|
+
${JSON.stringify(stdoutData, null, 2)}`
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
console.error("\n ********************** \n");
|
|
261
|
+
return { success: false };
|
|
262
|
+
} catch (err2) {
|
|
263
|
+
let error = err2;
|
|
264
|
+
if (Buffer.isBuffer(error)) {
|
|
265
|
+
error = error.toString();
|
|
266
|
+
}
|
|
267
|
+
console.error(
|
|
268
|
+
`Something unexpected went wrong when processing the npm publish output
|
|
269
|
+
|
|
270
|
+
Error: ${JSON.stringify(error)}
|
|
271
|
+
`
|
|
272
|
+
);
|
|
273
|
+
console.error("\n ********************** \n");
|
|
274
|
+
return { success: false };
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export {
|
|
280
|
+
LARGE_BUFFER,
|
|
281
|
+
npmPublishExecutorFn
|
|
282
|
+
};
|
|
@@ -3,19 +3,23 @@
|
|
|
3
3
|
var _chunk53DNHF7Bjs = require('./chunk-53DNHF7B.js');
|
|
4
4
|
|
|
5
5
|
// src/utils/pnpm-deps-update.ts
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _devkit = require('@nx/devkit');
|
|
6
10
|
var _fs = require('fs');
|
|
7
11
|
var _promises = require('fs/promises');
|
|
8
12
|
var _prettier = require('prettier');
|
|
9
13
|
var _readyamlfile = require('read-yaml-file'); var _readyamlfile2 = _interopRequireDefault(_readyamlfile);
|
|
10
14
|
var pnpmCatalog;
|
|
11
|
-
async function pnpmCatalogUpdate(
|
|
15
|
+
async function pnpmCatalogUpdate(packageJson, workspaceRoot = process.cwd()) {
|
|
12
16
|
if (!pnpmCatalog) {
|
|
13
17
|
const pnpmWorkspacePath = _chunk53DNHF7Bjs.joinPaths.call(void 0, workspaceRoot, "pnpm-workspace.yaml");
|
|
14
18
|
if (!_fs.existsSync.call(void 0, pnpmWorkspacePath)) {
|
|
15
19
|
console.warn(
|
|
16
20
|
`No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${pnpmWorkspacePath}). Skipping pnpm catalog read for now.`
|
|
17
21
|
);
|
|
18
|
-
return;
|
|
22
|
+
return packageJson;
|
|
19
23
|
}
|
|
20
24
|
const pnpmWorkspaceYaml = await _readyamlfile2.default.call(void 0, pnpmWorkspacePath);
|
|
21
25
|
console.info(
|
|
@@ -36,14 +40,6 @@ File contents: ${pnpmWorkspaceYaml ? JSON.stringify(pnpmWorkspaceYaml) : "EMPTY
|
|
|
36
40
|
`No pnpm catalog found. Attempting to read from workspace root's \`pnpm-workspace.yaml\` file.`
|
|
37
41
|
);
|
|
38
42
|
}
|
|
39
|
-
const packageJsonPath = _chunk53DNHF7Bjs.joinPaths.call(void 0, packageRoot, "package.json");
|
|
40
|
-
const packageJsonFile = await _promises.readFile.call(void 0, packageJsonPath, "utf8");
|
|
41
|
-
if (!packageJsonFile) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
"No package.json file found in package root: " + packageRoot
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
const packageJson = JSON.parse(packageJsonFile);
|
|
47
43
|
for (const dependencyType of [
|
|
48
44
|
"dependencies",
|
|
49
45
|
"devDependencies",
|
|
@@ -70,27 +66,101 @@ File contents: ${pnpmWorkspaceYaml ? JSON.stringify(pnpmWorkspaceYaml) : "EMPTY
|
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
68
|
}
|
|
69
|
+
return packageJson;
|
|
70
|
+
}
|
|
71
|
+
async function pnpmWorkspaceUpdate(packageJson, workspaceRoot = process.cwd()) {
|
|
72
|
+
let projectGraph;
|
|
73
|
+
try {
|
|
74
|
+
projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
75
|
+
} catch (e) {
|
|
76
|
+
await _devkit.createProjectGraphAsync.call(void 0, );
|
|
77
|
+
projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
78
|
+
}
|
|
79
|
+
const workspacePackages = {};
|
|
80
|
+
if (projectGraph) {
|
|
81
|
+
await Promise.all(
|
|
82
|
+
Object.keys(projectGraph.nodes).map(async (node) => {
|
|
83
|
+
const projectNode = projectGraph.nodes[node];
|
|
84
|
+
if (_optionalChain([projectNode, 'optionalAccess', _2 => _2.data, 'access', _3 => _3.root])) {
|
|
85
|
+
const projectPackageJsonPath = _chunk53DNHF7Bjs.joinPaths.call(void 0,
|
|
86
|
+
workspaceRoot,
|
|
87
|
+
projectNode.data.root,
|
|
88
|
+
"package.json"
|
|
89
|
+
);
|
|
90
|
+
if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
|
|
91
|
+
const projectPackageJsonContent = await _promises.readFile.call(void 0,
|
|
92
|
+
projectPackageJsonPath,
|
|
93
|
+
"utf8"
|
|
94
|
+
);
|
|
95
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
96
|
+
if (projectPackageJson.private !== true) {
|
|
97
|
+
workspacePackages[projectPackageJson.name] = projectPackageJson.version;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
for (const dependencyType of [
|
|
105
|
+
"dependencies",
|
|
106
|
+
"devDependencies",
|
|
107
|
+
"peerDependencies"
|
|
108
|
+
]) {
|
|
109
|
+
const dependencies = packageJson[dependencyType];
|
|
110
|
+
if (!dependencies) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
for (const dependencyName of Object.keys(dependencies)) {
|
|
114
|
+
if (dependencies[dependencyName].startsWith("workspace:")) {
|
|
115
|
+
if (workspacePackages[dependencyName]) {
|
|
116
|
+
dependencies[dependencyName] = `^${workspacePackages[dependencyName]}`;
|
|
117
|
+
} else {
|
|
118
|
+
throw new Error(
|
|
119
|
+
`Workspace dependency ${dependencyName} not found in workspace packages.`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return packageJson;
|
|
126
|
+
}
|
|
127
|
+
async function pnpmUpdate(packageRoot, workspaceRoot = process.cwd()) {
|
|
128
|
+
const packageJsonPath = _chunk53DNHF7Bjs.joinPaths.call(void 0, packageRoot, "package.json");
|
|
129
|
+
const packageJsonFile = await _promises.readFile.call(void 0, packageJsonPath, "utf8");
|
|
130
|
+
if (!packageJsonFile) {
|
|
131
|
+
throw new Error(
|
|
132
|
+
"No package.json file found in package root: " + packageRoot
|
|
133
|
+
);
|
|
134
|
+
}
|
|
73
135
|
return _promises.writeFile.call(void 0,
|
|
74
136
|
packageJsonPath,
|
|
75
|
-
await _prettier.format.call(void 0,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
137
|
+
await _prettier.format.call(void 0,
|
|
138
|
+
JSON.stringify(
|
|
139
|
+
await pnpmWorkspaceUpdate(
|
|
140
|
+
await pnpmCatalogUpdate(JSON.parse(packageJsonFile), workspaceRoot),
|
|
141
|
+
workspaceRoot
|
|
142
|
+
)
|
|
143
|
+
),
|
|
144
|
+
{
|
|
145
|
+
parser: "json",
|
|
146
|
+
proseWrap: "always",
|
|
147
|
+
trailingComma: "none",
|
|
148
|
+
tabWidth: 2,
|
|
149
|
+
semi: true,
|
|
150
|
+
singleQuote: false,
|
|
151
|
+
quoteProps: "as-needed",
|
|
152
|
+
insertPragma: false,
|
|
153
|
+
bracketSameLine: true,
|
|
154
|
+
printWidth: 80,
|
|
155
|
+
bracketSpacing: true,
|
|
156
|
+
arrowParens: "avoid",
|
|
157
|
+
endOfLine: "lf",
|
|
158
|
+
plugins: ["prettier-plugin-pkg"]
|
|
159
|
+
}
|
|
160
|
+
)
|
|
91
161
|
);
|
|
92
162
|
}
|
|
93
163
|
|
|
94
164
|
|
|
95
165
|
|
|
96
|
-
exports.
|
|
166
|
+
exports.pnpmUpdate = pnpmUpdate;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import {
|
|
2
|
+
joinPaths
|
|
3
|
+
} from "./chunk-U7JFVMCK.mjs";
|
|
4
|
+
|
|
5
|
+
// src/utils/pnpm-deps-update.ts
|
|
6
|
+
import {
|
|
7
|
+
createProjectGraphAsync,
|
|
8
|
+
readCachedProjectGraph
|
|
9
|
+
} from "@nx/devkit";
|
|
10
|
+
import { existsSync } from "node:fs";
|
|
11
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
12
|
+
import { format } from "prettier";
|
|
13
|
+
import readYamlFile from "read-yaml-file";
|
|
14
|
+
var pnpmCatalog;
|
|
15
|
+
async function pnpmCatalogUpdate(packageJson, workspaceRoot = process.cwd()) {
|
|
16
|
+
if (!pnpmCatalog) {
|
|
17
|
+
const pnpmWorkspacePath = joinPaths(workspaceRoot, "pnpm-workspace.yaml");
|
|
18
|
+
if (!existsSync(pnpmWorkspacePath)) {
|
|
19
|
+
console.warn(
|
|
20
|
+
`No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${pnpmWorkspacePath}). Skipping pnpm catalog read for now.`
|
|
21
|
+
);
|
|
22
|
+
return packageJson;
|
|
23
|
+
}
|
|
24
|
+
const pnpmWorkspaceYaml = await readYamlFile(pnpmWorkspacePath);
|
|
25
|
+
console.info(
|
|
26
|
+
`pnpmWorkspaceYaml: ${JSON.stringify(pnpmWorkspaceYaml ?? {})}`
|
|
27
|
+
);
|
|
28
|
+
if (pnpmWorkspaceYaml?.catalog) {
|
|
29
|
+
pnpmCatalog = pnpmWorkspaceYaml.catalog;
|
|
30
|
+
} else {
|
|
31
|
+
console.warn(
|
|
32
|
+
`Found a \`pnpm-workspace.yaml\` file in the workspace root directory, but no pnpm catalog existed:
|
|
33
|
+
File name: ${pnpmWorkspacePath}
|
|
34
|
+
File contents: ${pnpmWorkspaceYaml ? JSON.stringify(pnpmWorkspaceYaml) : "EMPTY FILE"}`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (!pnpmCatalog) {
|
|
39
|
+
console.warn(
|
|
40
|
+
`No pnpm catalog found. Attempting to read from workspace root's \`pnpm-workspace.yaml\` file.`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
for (const dependencyType of [
|
|
44
|
+
"dependencies",
|
|
45
|
+
"devDependencies",
|
|
46
|
+
"peerDependencies"
|
|
47
|
+
]) {
|
|
48
|
+
const dependencies = packageJson[dependencyType];
|
|
49
|
+
if (!dependencies) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
for (const dependencyName of Object.keys(dependencies)) {
|
|
53
|
+
if (dependencies[dependencyName] === "catalog:") {
|
|
54
|
+
if (!pnpmCatalog) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`Dependency ${dependencyName} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`pnpm-workspace.yaml\` file.`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const catalogVersion = pnpmCatalog[dependencyName];
|
|
60
|
+
if (!catalogVersion) {
|
|
61
|
+
throw new Error("Missing pnpm catalog version for " + dependencyName);
|
|
62
|
+
}
|
|
63
|
+
dependencies[dependencyName] = catalogVersion;
|
|
64
|
+
} else if (dependencies[dependencyName].startsWith("catalog:")) {
|
|
65
|
+
throw new Error("multiple named catalogs not supported");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return packageJson;
|
|
70
|
+
}
|
|
71
|
+
async function pnpmWorkspaceUpdate(packageJson, workspaceRoot = process.cwd()) {
|
|
72
|
+
let projectGraph;
|
|
73
|
+
try {
|
|
74
|
+
projectGraph = readCachedProjectGraph();
|
|
75
|
+
} catch {
|
|
76
|
+
await createProjectGraphAsync();
|
|
77
|
+
projectGraph = readCachedProjectGraph();
|
|
78
|
+
}
|
|
79
|
+
const workspacePackages = {};
|
|
80
|
+
if (projectGraph) {
|
|
81
|
+
await Promise.all(
|
|
82
|
+
Object.keys(projectGraph.nodes).map(async (node) => {
|
|
83
|
+
const projectNode = projectGraph.nodes[node];
|
|
84
|
+
if (projectNode?.data.root) {
|
|
85
|
+
const projectPackageJsonPath = joinPaths(
|
|
86
|
+
workspaceRoot,
|
|
87
|
+
projectNode.data.root,
|
|
88
|
+
"package.json"
|
|
89
|
+
);
|
|
90
|
+
if (existsSync(projectPackageJsonPath)) {
|
|
91
|
+
const projectPackageJsonContent = await readFile(
|
|
92
|
+
projectPackageJsonPath,
|
|
93
|
+
"utf8"
|
|
94
|
+
);
|
|
95
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
96
|
+
if (projectPackageJson.private !== true) {
|
|
97
|
+
workspacePackages[projectPackageJson.name] = projectPackageJson.version;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
for (const dependencyType of [
|
|
105
|
+
"dependencies",
|
|
106
|
+
"devDependencies",
|
|
107
|
+
"peerDependencies"
|
|
108
|
+
]) {
|
|
109
|
+
const dependencies = packageJson[dependencyType];
|
|
110
|
+
if (!dependencies) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
for (const dependencyName of Object.keys(dependencies)) {
|
|
114
|
+
if (dependencies[dependencyName].startsWith("workspace:")) {
|
|
115
|
+
if (workspacePackages[dependencyName]) {
|
|
116
|
+
dependencies[dependencyName] = `^${workspacePackages[dependencyName]}`;
|
|
117
|
+
} else {
|
|
118
|
+
throw new Error(
|
|
119
|
+
`Workspace dependency ${dependencyName} not found in workspace packages.`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return packageJson;
|
|
126
|
+
}
|
|
127
|
+
async function pnpmUpdate(packageRoot, workspaceRoot = process.cwd()) {
|
|
128
|
+
const packageJsonPath = joinPaths(packageRoot, "package.json");
|
|
129
|
+
const packageJsonFile = await readFile(packageJsonPath, "utf8");
|
|
130
|
+
if (!packageJsonFile) {
|
|
131
|
+
throw new Error(
|
|
132
|
+
"No package.json file found in package root: " + packageRoot
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
return writeFile(
|
|
136
|
+
packageJsonPath,
|
|
137
|
+
await format(
|
|
138
|
+
JSON.stringify(
|
|
139
|
+
await pnpmWorkspaceUpdate(
|
|
140
|
+
await pnpmCatalogUpdate(JSON.parse(packageJsonFile), workspaceRoot),
|
|
141
|
+
workspaceRoot
|
|
142
|
+
)
|
|
143
|
+
),
|
|
144
|
+
{
|
|
145
|
+
parser: "json",
|
|
146
|
+
proseWrap: "always",
|
|
147
|
+
trailingComma: "none",
|
|
148
|
+
tabWidth: 2,
|
|
149
|
+
semi: true,
|
|
150
|
+
singleQuote: false,
|
|
151
|
+
quoteProps: "as-needed",
|
|
152
|
+
insertPragma: false,
|
|
153
|
+
bracketSameLine: true,
|
|
154
|
+
printWidth: 80,
|
|
155
|
+
bracketSpacing: true,
|
|
156
|
+
arrowParens: "avoid",
|
|
157
|
+
endOfLine: "lf",
|
|
158
|
+
plugins: ["prettier-plugin-pkg"]
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export {
|
|
165
|
+
pnpmUpdate
|
|
166
|
+
};
|