@storm-software/workspace-tools 1.296.18 → 1.296.19
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/README.md +1 -1
- package/dist/chunk-27VV54AU.mjs +31 -0
- package/dist/chunk-2FWYS4LO.mjs +524 -0
- package/dist/{chunk-VZW75NWX.mjs → chunk-374AWLUE.mjs} +1 -1
- package/dist/chunk-3VN2GWX7.js +250 -0
- package/dist/chunk-4QZG36UZ.js +524 -0
- package/dist/{chunk-XIJ6Y5PY.mjs → chunk-4XFDXLL5.mjs} +1 -1
- package/dist/{chunk-TSQI7Z3D.mjs → chunk-5SX7BBOU.mjs} +0 -1
- package/dist/chunk-AD2DJUS6.js +93 -0
- package/dist/chunk-AZIYZ7G2.mjs +41 -0
- package/dist/chunk-B6CXZA7K.mjs +32 -0
- package/dist/chunk-D6XEM3XX.mjs +93 -0
- package/dist/chunk-DSUFN6ZC.mjs +253 -0
- package/dist/chunk-E5RTBBOT.mjs +32 -0
- package/dist/chunk-EC34LBD2.mjs +128 -0
- package/dist/chunk-FE7ZULOD.js +32 -0
- package/dist/{chunk-B2AJRGYN.mjs → chunk-HEEYGPP2.mjs} +1 -1
- package/dist/chunk-I2LXWNCS.js +41 -0
- package/dist/chunk-JEPLNTO7.js +79 -0
- package/dist/chunk-K6ADTQ4I.js +32 -0
- package/dist/chunk-KILRQ3CE.js +32 -0
- package/dist/chunk-O5EFCUR2.js +31 -0
- package/dist/chunk-OZRIT35E.mjs +82 -0
- package/dist/{chunk-II7J52FS.js → chunk-PEO7Z6CZ.js} +0 -1
- package/dist/{chunk-ZS6ZECJY.mjs → chunk-PIKWPSLP.mjs} +1 -1
- package/dist/{chunk-Y56KCTJM.mjs → chunk-QEWWRSPX.mjs} +1 -1
- package/dist/chunk-WIKTNOO2.js +128 -0
- package/dist/chunk-WNGTBFG5.mjs +32 -0
- package/dist/executors.js +2 -2
- package/dist/executors.mjs +2 -2
- package/dist/{generator-BKKfRfw5.d.mts → generator-9L9b-msK.d.mts} +1 -1
- package/dist/{generator-DX2foast.d.ts → generator-BT5Kf5x0.d.ts} +1 -1
- package/dist/{generator-DVJjzR9Q.d.mts → generator-BvhmWt7B.d.mts} +1 -1
- package/dist/{generator-DN9Th4ZG.d.ts → generator-C9QMvagl.d.ts} +1 -1
- package/dist/{generator-rIlu4Sq2.d.mts → generator-CkT060vy.d.mts} +1 -1
- package/dist/{generator-CPAEsIX9.d.ts → generator-Czm2JkrK.d.ts} +1 -1
- package/dist/{generator-Ce5Jjv19.d.mts → generator-DIEJD40Q.d.mts} +1 -1
- package/dist/{generator-B9nl4zZh.d.mts → generator-DdPUFIRV.d.mts} +1 -1
- package/dist/{generator-CKzlyVl8.d.ts → generator-DwHI-Bxg.d.ts} +1 -1
- package/dist/{generator-DMnwA7AM.d.ts → generator-GND3rM-I.d.ts} +1 -1
- package/dist/generators.d.mts +6 -6
- package/dist/generators.d.ts +6 -6
- package/dist/generators.mjs +5 -5
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +2 -2
- package/dist/index.mjs +6 -6
- package/dist/src/base/base-executor.d.mts +1 -1
- package/dist/src/base/base-executor.d.ts +1 -1
- package/dist/src/base/base-executor.mjs +1 -1
- package/dist/src/base/base-executor.untyped.mjs +1 -1
- package/dist/src/base/base-generator.d.mts +1 -1
- package/dist/src/base/base-generator.d.ts +1 -1
- package/dist/src/base/base-generator.mjs +1 -1
- package/dist/src/base/base-generator.untyped.mjs +1 -1
- package/dist/src/base/cargo-base-executor.untyped.mjs +1 -1
- package/dist/src/base/index.d.mts +1 -1
- package/dist/src/base/index.d.ts +1 -1
- package/dist/src/base/index.mjs +1 -1
- package/dist/src/base/typescript-build-executor.untyped.mjs +1 -1
- package/dist/src/base/typescript-library-generator.untyped.mjs +1 -1
- package/dist/src/executors/cargo-build/executor.mjs +1 -1
- package/dist/src/executors/cargo-build/untyped.mjs +1 -1
- package/dist/src/executors/cargo-check/executor.mjs +1 -1
- package/dist/src/executors/cargo-check/untyped.mjs +1 -1
- package/dist/src/executors/cargo-clippy/executor.mjs +1 -1
- package/dist/src/executors/cargo-clippy/untyped.mjs +1 -1
- package/dist/src/executors/cargo-doc/executor.mjs +1 -1
- package/dist/src/executors/cargo-doc/untyped.mjs +1 -1
- package/dist/src/executors/cargo-format/executor.mjs +1 -1
- package/dist/src/executors/cargo-format/untyped.mjs +1 -1
- package/dist/src/executors/cargo-publish/executor.mjs +1 -1
- package/dist/src/executors/cargo-publish/untyped.mjs +1 -1
- package/dist/src/executors/clean-package/executor.mjs +1 -1
- package/dist/src/executors/clean-package/untyped.mjs +1 -1
- package/dist/src/executors/esbuild/executor.mjs +1 -1
- package/dist/src/executors/esbuild/untyped.mjs +1 -1
- package/dist/src/executors/napi/executor.mjs +1 -1
- package/dist/src/executors/napi/untyped.mjs +1 -1
- package/dist/src/executors/npm-publish/executor.mjs +1 -1
- package/dist/src/executors/npm-publish/untyped.mjs +1 -1
- package/dist/src/executors/size-limit/executor.mjs +1 -1
- package/dist/src/executors/size-limit/untyped.mjs +1 -1
- package/dist/src/executors/tsdown/executor.js +2 -2
- package/dist/src/executors/tsdown/executor.mjs +2 -2
- package/dist/src/executors/tsdown/untyped.mjs +1 -1
- package/dist/src/executors/typia/executor.mjs +1 -1
- package/dist/src/executors/typia/untyped.mjs +1 -1
- package/dist/src/executors/unbuild/executor.mjs +1 -1
- package/dist/src/executors/unbuild/untyped.mjs +1 -1
- package/dist/src/generators/browser-library/generator.d.mts +2 -2
- package/dist/src/generators/browser-library/generator.d.ts +2 -2
- package/dist/src/generators/browser-library/generator.mjs +2 -2
- package/dist/src/generators/browser-library/untyped.mjs +1 -1
- package/dist/src/generators/config-schema/generator.d.mts +2 -2
- package/dist/src/generators/config-schema/generator.d.ts +2 -2
- package/dist/src/generators/config-schema/generator.mjs +1 -1
- package/dist/src/generators/config-schema/untyped.mjs +1 -1
- package/dist/src/generators/init/init.mjs +1 -1
- package/dist/src/generators/init/untyped.mjs +1 -1
- package/dist/src/generators/neutral-library/generator.d.mts +2 -2
- package/dist/src/generators/neutral-library/generator.d.ts +2 -2
- package/dist/src/generators/neutral-library/generator.mjs +2 -2
- package/dist/src/generators/neutral-library/untyped.mjs +1 -1
- package/dist/src/generators/node-library/generator.d.mts +2 -2
- package/dist/src/generators/node-library/generator.d.ts +2 -2
- package/dist/src/generators/node-library/generator.mjs +2 -2
- package/dist/src/generators/node-library/untyped.mjs +1 -1
- package/dist/src/generators/preset/generator.d.mts +2 -2
- package/dist/src/generators/preset/generator.d.ts +2 -2
- package/dist/src/generators/preset/generator.mjs +2 -2
- package/dist/src/generators/preset/untyped.mjs +1 -1
- package/dist/src/plugins/rust/cargo-toml.mjs +1 -1
- package/dist/src/plugins/rust/index.mjs +1 -1
- package/dist/src/plugins/typescript/index.d.mts +1 -1
- package/dist/src/plugins/typescript/index.d.ts +1 -1
- package/dist/src/plugins/typescript/index.mjs +1 -1
- package/dist/src/plugins/typescript/tsdown.d.mts +1 -1
- package/dist/src/plugins/typescript/tsdown.d.ts +1 -1
- package/dist/src/plugins/typescript/tsdown.mjs +1 -1
- package/dist/src/plugins/typescript/tsup.d.mts +1 -1
- package/dist/src/plugins/typescript/tsup.d.ts +1 -1
- package/dist/src/plugins/typescript/tsup.mjs +1 -1
- package/dist/src/plugins/typescript/untyped-schema.mjs +1 -1
- package/dist/src/release/index.mjs +1 -1
- package/dist/src/release/js-version-actions.mjs +1 -1
- package/dist/src/release/rust-version-actions.mjs +1 -1
- package/dist/src/types.d.mts +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.mjs +1 -1
- package/dist/src/utils/apply-workspace-tokens.mjs +1 -1
- package/dist/src/utils/cargo.mjs +1 -1
- package/dist/src/utils/create-cli-options.mjs +1 -1
- package/dist/src/utils/get-project-configurations.mjs +1 -1
- package/dist/src/utils/github.mjs +1 -1
- package/dist/src/utils/index.mjs +1 -1
- package/dist/src/utils/lock-file.mjs +1 -1
- package/dist/src/utils/nx-json.mjs +1 -1
- package/dist/src/utils/package-helpers.mjs +1 -1
- package/dist/src/utils/plugin-helpers.mjs +1 -1
- package/dist/src/utils/project-tags.mjs +1 -1
- package/dist/src/utils/registry-helpers.mjs +1 -1
- package/dist/src/utils/typia-transform.mjs +1 -1
- package/dist/src/utils/versions.mjs +1 -1
- package/dist/{types-DLXcfy35.d.mts → types-BlCH22NF.d.mts} +1 -1
- package/dist/{types-Bvfw-xMk.d.ts → types-DIIZf_cX.d.ts} +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkMKJITWLNjs = require('./chunk-MKJITWLN.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkAD2DJUS6js = require('./chunk-AD2DJUS6.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkA5RNIDQZjs = require('./chunk-A5RNIDQZ.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkLMYTVXGXjs = require('./chunk-LMYTVXGX.js');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkCQDBLKPFjs = require('./chunk-CQDBLKPF.js');
|
|
16
|
+
|
|
17
|
+
// ../npm-tools/src/helpers/get-registry.ts
|
|
18
|
+
var _child_process = require('child_process');
|
|
19
|
+
|
|
20
|
+
// ../npm-tools/src/constants.ts
|
|
21
|
+
var DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
22
|
+
|
|
23
|
+
// ../npm-tools/src/helpers/get-registry.ts
|
|
24
|
+
async function getRegistry(executable = "npm") {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
_child_process.exec.call(void 0, `${executable} config get registry`, (error, stdout, stderr) => {
|
|
27
|
+
if (error && !error.message.toLowerCase().trim().startsWith("npm warn")) {
|
|
28
|
+
return reject(error);
|
|
29
|
+
}
|
|
30
|
+
if (stderr && !stderr.toLowerCase().trim().startsWith("npm warn")) {
|
|
31
|
+
return reject(stderr);
|
|
32
|
+
}
|
|
33
|
+
return resolve(stdout.trim());
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async function getNpmRegistry() {
|
|
38
|
+
if (process.env.STORM_REGISTRY_NPM) {
|
|
39
|
+
return process.env.STORM_REGISTRY_NPM;
|
|
40
|
+
}
|
|
41
|
+
const workspaceConfig = await _chunkA5RNIDQZjs.getConfig.call(void 0, );
|
|
42
|
+
if (_optionalChain([workspaceConfig, 'optionalAccess', _ => _.registry, 'optionalAccess', _2 => _2.npm])) {
|
|
43
|
+
return _optionalChain([workspaceConfig, 'optionalAccess', _3 => _3.registry, 'optionalAccess', _4 => _4.npm]);
|
|
44
|
+
}
|
|
45
|
+
return DEFAULT_NPM_REGISTRY;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ../pnpm-tools/src/helpers/replace-deps-aliases.ts
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var _devkit = require('@nx/devkit');
|
|
53
|
+
var _fs = require('fs');
|
|
54
|
+
var _promises = require('fs/promises');
|
|
55
|
+
var _prettier = require('prettier');
|
|
56
|
+
|
|
57
|
+
// ../npm-tools/src/helpers/get-version.ts
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
// ../pnpm-tools/src/helpers/catalog.ts
|
|
61
|
+
var _semver = require('semver');
|
|
62
|
+
|
|
63
|
+
// ../pnpm-tools/src/helpers/pnpm-workspace.ts
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
var _yaml = require('yaml');
|
|
67
|
+
function getPnpmWorkspaceFilePath(workspaceRoot = _chunkLMYTVXGXjs.findWorkspaceRoot.call(void 0, process.cwd())) {
|
|
68
|
+
const pnpmWorkspacePath = _chunkCQDBLKPFjs.joinPaths.call(void 0, workspaceRoot, "pnpm-workspace.yaml");
|
|
69
|
+
if (!_fs.existsSync.call(void 0, pnpmWorkspacePath)) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${pnpmWorkspacePath}).`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
return pnpmWorkspacePath;
|
|
75
|
+
}
|
|
76
|
+
async function readPnpmWorkspaceFile(workspaceRoot = _chunkLMYTVXGXjs.findWorkspaceRoot.call(void 0, process.cwd())) {
|
|
77
|
+
const result = await _promises.readFile.call(void 0,
|
|
78
|
+
getPnpmWorkspaceFilePath(workspaceRoot),
|
|
79
|
+
"utf8"
|
|
80
|
+
);
|
|
81
|
+
if (!result) {
|
|
82
|
+
return void 0;
|
|
83
|
+
}
|
|
84
|
+
return _yaml.parse.call(void 0, result);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ../pnpm-tools/src/helpers/catalog.ts
|
|
88
|
+
async function getCatalogSafe(workspaceRoot = _chunkLMYTVXGXjs.findWorkspaceRoot.call(void 0, process.cwd())) {
|
|
89
|
+
const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
|
|
90
|
+
if (!pnpmWorkspaceFile) {
|
|
91
|
+
throw new Error("No pnpm-workspace.yaml file found");
|
|
92
|
+
}
|
|
93
|
+
if (_optionalChain([pnpmWorkspaceFile, 'optionalAccess', _5 => _5.catalog])) {
|
|
94
|
+
return Object.fromEntries(
|
|
95
|
+
Object.entries(pnpmWorkspaceFile.catalog).map(([key, value]) => {
|
|
96
|
+
return [key, value.replaceAll('"', "").replaceAll("'", "")];
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
} else {
|
|
100
|
+
console.warn(
|
|
101
|
+
`No catalog found in pnpm-workspace.yaml file located in workspace root: ${workspaceRoot}
|
|
102
|
+
File content: ${JSON.stringify(
|
|
103
|
+
pnpmWorkspaceFile,
|
|
104
|
+
null,
|
|
105
|
+
2
|
|
106
|
+
)}`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return void 0;
|
|
110
|
+
}
|
|
111
|
+
async function getCatalog(workspaceRoot = _chunkLMYTVXGXjs.findWorkspaceRoot.call(void 0, process.cwd())) {
|
|
112
|
+
const catalog = await getCatalogSafe(workspaceRoot);
|
|
113
|
+
if (!catalog) {
|
|
114
|
+
throw new Error("No catalog entries found in pnpm-workspace.yaml file");
|
|
115
|
+
}
|
|
116
|
+
return catalog;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ../pnpm-tools/src/helpers/replace-deps-aliases.ts
|
|
120
|
+
async function replaceDepsAliases(packageRoot = process.cwd(), workspaceRoot = _chunkLMYTVXGXjs.findWorkspaceRoot.call(void 0, packageRoot)) {
|
|
121
|
+
const packageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, packageRoot, "package.json");
|
|
122
|
+
const packageJsonFile = await _promises.readFile.call(void 0, packageJsonPath, "utf8");
|
|
123
|
+
if (!packageJsonFile) {
|
|
124
|
+
throw new Error(
|
|
125
|
+
"No package.json file found in package root: " + packageRoot
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
const catalog = await getCatalog(workspaceRoot);
|
|
129
|
+
const packageJson = JSON.parse(packageJsonFile);
|
|
130
|
+
const pnpmWorkspacePath = _chunkCQDBLKPFjs.joinPaths.call(void 0, workspaceRoot, "pnpm-workspace.yaml");
|
|
131
|
+
if (!_fs.existsSync.call(void 0, pnpmWorkspacePath)) {
|
|
132
|
+
console.warn(
|
|
133
|
+
`No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${pnpmWorkspacePath}). Skipping pnpm catalog read for now.`
|
|
134
|
+
);
|
|
135
|
+
return packageJson;
|
|
136
|
+
}
|
|
137
|
+
if (!catalog) {
|
|
138
|
+
console.warn(
|
|
139
|
+
`No pnpm catalog found. Skipping dependencies replacement for now.`
|
|
140
|
+
);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
for (const dependencyType of [
|
|
144
|
+
"dependencies",
|
|
145
|
+
"devDependencies",
|
|
146
|
+
"peerDependencies"
|
|
147
|
+
]) {
|
|
148
|
+
const dependencies = packageJson[dependencyType];
|
|
149
|
+
if (!dependencies) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
for (const dependencyName of Object.keys(dependencies)) {
|
|
153
|
+
if (dependencies[dependencyName] === "catalog:") {
|
|
154
|
+
if (!catalog) {
|
|
155
|
+
throw new Error(
|
|
156
|
+
`Dependency ${dependencyName} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`pnpm-workspace.yaml\` file.`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
const catalogVersion = catalog[dependencyName];
|
|
160
|
+
if (!catalogVersion) {
|
|
161
|
+
throw new Error("Missing pnpm catalog version for " + dependencyName);
|
|
162
|
+
}
|
|
163
|
+
dependencies[dependencyName] = catalogVersion;
|
|
164
|
+
} else if (dependencies[dependencyName].startsWith("catalog:")) {
|
|
165
|
+
throw new Error("multiple named catalogs not supported");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
let projectGraph;
|
|
170
|
+
try {
|
|
171
|
+
projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
172
|
+
} catch (e) {
|
|
173
|
+
await _devkit.createProjectGraphAsync.call(void 0, );
|
|
174
|
+
projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
175
|
+
}
|
|
176
|
+
const workspacePackages = {};
|
|
177
|
+
if (projectGraph) {
|
|
178
|
+
await Promise.all(
|
|
179
|
+
Object.keys(projectGraph.nodes).map(async (node) => {
|
|
180
|
+
const projectNode = projectGraph.nodes[node];
|
|
181
|
+
if (_optionalChain([projectNode, 'optionalAccess', _6 => _6.data, 'access', _7 => _7.root])) {
|
|
182
|
+
const projectPackageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0,
|
|
183
|
+
workspaceRoot,
|
|
184
|
+
projectNode.data.root,
|
|
185
|
+
"package.json"
|
|
186
|
+
);
|
|
187
|
+
if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
|
|
188
|
+
const projectPackageJsonContent = await _promises.readFile.call(void 0,
|
|
189
|
+
projectPackageJsonPath,
|
|
190
|
+
"utf8"
|
|
191
|
+
);
|
|
192
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
193
|
+
if (projectPackageJson.private !== true) {
|
|
194
|
+
workspacePackages[projectPackageJson.name] = projectPackageJson.version;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
for (const dependencyType of [
|
|
202
|
+
"dependencies",
|
|
203
|
+
"devDependencies",
|
|
204
|
+
"peerDependencies"
|
|
205
|
+
]) {
|
|
206
|
+
const dependencies = packageJson[dependencyType];
|
|
207
|
+
if (!dependencies) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
for (const dependencyName of Object.keys(dependencies)) {
|
|
211
|
+
if (dependencies[dependencyName].startsWith("workspace:")) {
|
|
212
|
+
if (workspacePackages[dependencyName]) {
|
|
213
|
+
dependencies[dependencyName] = `^${workspacePackages[dependencyName]}`;
|
|
214
|
+
} else {
|
|
215
|
+
throw new Error(
|
|
216
|
+
`Workspace dependency ${dependencyName} not found in workspace packages.`
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return _promises.writeFile.call(void 0,
|
|
223
|
+
packageJsonPath,
|
|
224
|
+
await _prettier.format.call(void 0, JSON.stringify(packageJson), {
|
|
225
|
+
parser: "json",
|
|
226
|
+
proseWrap: "preserve",
|
|
227
|
+
trailingComma: "none",
|
|
228
|
+
tabWidth: 2,
|
|
229
|
+
semi: true,
|
|
230
|
+
singleQuote: false,
|
|
231
|
+
quoteProps: "as-needed",
|
|
232
|
+
insertPragma: false,
|
|
233
|
+
bracketSameLine: true,
|
|
234
|
+
printWidth: 80,
|
|
235
|
+
bracketSpacing: true,
|
|
236
|
+
arrowParens: "avoid",
|
|
237
|
+
endOfLine: "lf",
|
|
238
|
+
plugins: ["prettier-plugin-packagejson"]
|
|
239
|
+
})
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// src/executors/npm-publish/executor.ts
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
var LARGE_BUFFER = 1024 * 1e6;
|
|
248
|
+
async function npmPublishExecutorFn(options, context) {
|
|
249
|
+
const workspaceConfig = await _chunkA5RNIDQZjs.getConfig.call(void 0, context.root);
|
|
250
|
+
const github = await _chunkMKJITWLNjs.getGitHubTools.call(void 0, workspaceConfig);
|
|
251
|
+
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
252
|
+
if (!context.projectName) {
|
|
253
|
+
github.error("The `npm-publish` executor requires a `projectName`.");
|
|
254
|
+
return { success: false };
|
|
255
|
+
}
|
|
256
|
+
const projectConfig = _optionalChain([context, 'access', _8 => _8.projectsConfigurations, 'optionalAccess', _9 => _9.projects, 'optionalAccess', _10 => _10[context.projectName]]);
|
|
257
|
+
if (!projectConfig) {
|
|
258
|
+
github.error(
|
|
259
|
+
`Could not find project configuration for \`${context.projectName}\``
|
|
260
|
+
);
|
|
261
|
+
return { success: false };
|
|
262
|
+
}
|
|
263
|
+
const packageRoot = _chunkCQDBLKPFjs.joinPaths.call(void 0,
|
|
264
|
+
context.root,
|
|
265
|
+
options.packageRoot || _chunkCQDBLKPFjs.joinPaths.call(void 0, "dist", projectConfig.root)
|
|
266
|
+
);
|
|
267
|
+
const projectRoot = _optionalChain([context, 'access', _11 => _11.projectsConfigurations, 'access', _12 => _12.projects, 'access', _13 => _13[context.projectName], 'optionalAccess', _14 => _14.root]) ? _chunkCQDBLKPFjs.joinPaths.call(void 0,
|
|
268
|
+
context.root,
|
|
269
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
270
|
+
context.projectsConfigurations.projects[context.projectName].root
|
|
271
|
+
) : packageRoot;
|
|
272
|
+
const packageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, packageRoot, "package.json");
|
|
273
|
+
const packageJsonFile = await _promises.readFile.call(void 0, packageJsonPath, "utf8");
|
|
274
|
+
if (!packageJsonFile) {
|
|
275
|
+
github.error(`Could not find \`package.json\` at ${packageJsonPath}`);
|
|
276
|
+
return { success: false };
|
|
277
|
+
}
|
|
278
|
+
const packageJson = JSON.parse(packageJsonFile);
|
|
279
|
+
const projectPackageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, projectRoot, "package.json");
|
|
280
|
+
const projectPackageJsonFile = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
|
|
281
|
+
if (!projectPackageJsonFile) {
|
|
282
|
+
github.error(
|
|
283
|
+
`Could not find \`package.json\` at ${projectPackageJsonPath}`
|
|
284
|
+
);
|
|
285
|
+
return { success: false };
|
|
286
|
+
}
|
|
287
|
+
const projectPackageJson = JSON.parse(projectPackageJsonFile);
|
|
288
|
+
if (packageJson.version !== projectPackageJson.version) {
|
|
289
|
+
console.warn(
|
|
290
|
+
`The version in the package.json file at ${packageJsonPath} (current: ${packageJson.version}) does not match the version in the package.json file at ${projectPackageJsonPath} (current: ${projectPackageJson.version}). This file will be updated to match the version in the project package.json file.`
|
|
291
|
+
);
|
|
292
|
+
if (projectPackageJson.version) {
|
|
293
|
+
packageJson.version = projectPackageJson.version;
|
|
294
|
+
await _promises.writeFile.call(void 0,
|
|
295
|
+
packageJsonPath,
|
|
296
|
+
await _prettier.format.call(void 0, JSON.stringify(packageJson), {
|
|
297
|
+
parser: "json",
|
|
298
|
+
proseWrap: "preserve",
|
|
299
|
+
trailingComma: "none",
|
|
300
|
+
tabWidth: 2,
|
|
301
|
+
semi: true,
|
|
302
|
+
singleQuote: false,
|
|
303
|
+
quoteProps: "as-needed",
|
|
304
|
+
insertPragma: false,
|
|
305
|
+
bracketSameLine: true,
|
|
306
|
+
printWidth: 80,
|
|
307
|
+
bracketSpacing: true,
|
|
308
|
+
arrowParens: "avoid",
|
|
309
|
+
endOfLine: "lf",
|
|
310
|
+
plugins: ["prettier-plugin-packagejson"]
|
|
311
|
+
})
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
const packageName = packageJson.name;
|
|
316
|
+
console.info(
|
|
317
|
+
`\u{1F680} Running Storm NPM Publish executor on the ${packageName} package`
|
|
318
|
+
);
|
|
319
|
+
const packageTxt = packageName === context.projectName ? `package "${packageName}"` : `package "${packageName}" from project "${context.projectName}"`;
|
|
320
|
+
if (packageJson.private === true) {
|
|
321
|
+
console.warn(
|
|
322
|
+
`Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`
|
|
323
|
+
);
|
|
324
|
+
return { success: true };
|
|
325
|
+
}
|
|
326
|
+
await replaceDepsAliases(packageRoot, context.root);
|
|
327
|
+
await _chunkAD2DJUS6js.addPackageJsonGitHead.call(void 0, packageRoot);
|
|
328
|
+
const npmPublishCommandSegments = [`npm publish --json`];
|
|
329
|
+
const npmViewCommandSegments = [
|
|
330
|
+
`npm view ${packageName} versions dist-tags --json`
|
|
331
|
+
];
|
|
332
|
+
const registry = await Promise.resolve(
|
|
333
|
+
await _asyncNullishCoalesce(options.registry, async () => ( (await getRegistry() || getNpmRegistry())))
|
|
334
|
+
);
|
|
335
|
+
if (registry) {
|
|
336
|
+
npmPublishCommandSegments.push(`--registry="${registry}" `);
|
|
337
|
+
npmViewCommandSegments.push(`--registry="${registry}" `);
|
|
338
|
+
}
|
|
339
|
+
if (options.otp) {
|
|
340
|
+
npmPublishCommandSegments.push(`--otp="${options.otp}" `);
|
|
341
|
+
}
|
|
342
|
+
let token;
|
|
343
|
+
if (!options.otp) {
|
|
344
|
+
token = await github.getIDToken(
|
|
345
|
+
`npm:${registry.replace(/^https?:\/\//, "")}`
|
|
346
|
+
);
|
|
347
|
+
if (!token) {
|
|
348
|
+
github.warning(
|
|
349
|
+
`Either a One time password (OTP) or an OpenID Connect (OIDC) token is generally required to publish ${packageTxt} to NPM. Usually the OIDC token should be provided automatically via GitHub Actions (see: https://github.com/actions/toolkit/tree/main/packages/core#oidc-token); however, the release process was unable to retrieve it. Please provide a \`otp\` executor option, or investigate why the OIDC token could not be retrieved.`
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
npmPublishCommandSegments.push("--provenance --access=public ");
|
|
354
|
+
if (isDryRun) {
|
|
355
|
+
npmPublishCommandSegments.push("--dry-run");
|
|
356
|
+
}
|
|
357
|
+
const tag = options.tag || _child_process.execSync.call(void 0, "npm config get tag", {
|
|
358
|
+
cwd: packageRoot,
|
|
359
|
+
env: {
|
|
360
|
+
NPM_ID_TOKEN: token,
|
|
361
|
+
...process.env,
|
|
362
|
+
FORCE_COLOR: "true"
|
|
363
|
+
},
|
|
364
|
+
maxBuffer: LARGE_BUFFER,
|
|
365
|
+
killSignal: "SIGTERM"
|
|
366
|
+
}).toString().trim();
|
|
367
|
+
if (tag) {
|
|
368
|
+
npmPublishCommandSegments.push(`--tag="${tag}" `);
|
|
369
|
+
}
|
|
370
|
+
if (!isDryRun) {
|
|
371
|
+
const currentVersion = options.version || packageJson.version;
|
|
372
|
+
try {
|
|
373
|
+
try {
|
|
374
|
+
const result = _child_process.execSync.call(void 0, npmViewCommandSegments.join(" "), {
|
|
375
|
+
cwd: packageRoot,
|
|
376
|
+
env: {
|
|
377
|
+
NPM_ID_TOKEN: token,
|
|
378
|
+
...process.env,
|
|
379
|
+
FORCE_COLOR: "true"
|
|
380
|
+
},
|
|
381
|
+
maxBuffer: LARGE_BUFFER,
|
|
382
|
+
killSignal: "SIGTERM"
|
|
383
|
+
});
|
|
384
|
+
const resultJson = JSON.parse(result.toString());
|
|
385
|
+
const distTags = resultJson["dist-tags"] || {};
|
|
386
|
+
if (distTags[tag] === currentVersion) {
|
|
387
|
+
console.warn(
|
|
388
|
+
`Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`
|
|
389
|
+
);
|
|
390
|
+
return { success: true };
|
|
391
|
+
}
|
|
392
|
+
} catch (err) {
|
|
393
|
+
console.debug(
|
|
394
|
+
`An error occurred while checking for existing dist-tags. Please note: if this is the first time this package has been published to npm, this can be ignored.
|
|
395
|
+
|
|
396
|
+
Error: ${JSON.stringify(
|
|
397
|
+
err,
|
|
398
|
+
null,
|
|
399
|
+
2
|
|
400
|
+
)}`
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
try {
|
|
404
|
+
if (!isDryRun) {
|
|
405
|
+
const command = `npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry="${registry}" `;
|
|
406
|
+
console.debug(
|
|
407
|
+
`Adding the dist-tag ${tag} - preparing to run the following: ${command}`
|
|
408
|
+
);
|
|
409
|
+
const result = _child_process.execSync.call(void 0, command, {
|
|
410
|
+
cwd: packageRoot,
|
|
411
|
+
env: {
|
|
412
|
+
NPM_ID_TOKEN: token,
|
|
413
|
+
...process.env,
|
|
414
|
+
FORCE_COLOR: "true"
|
|
415
|
+
},
|
|
416
|
+
maxBuffer: LARGE_BUFFER,
|
|
417
|
+
killSignal: "SIGTERM"
|
|
418
|
+
});
|
|
419
|
+
console.info(
|
|
420
|
+
`Added the dist-tag ${tag} to v${currentVersion} for registry "${registry}".
|
|
421
|
+
|
|
422
|
+
Execution response: ${result.toString()}`
|
|
423
|
+
);
|
|
424
|
+
} else {
|
|
425
|
+
console.info(
|
|
426
|
+
`Would have added the dist-tag ${tag} to v${currentVersion} for registry "${registry}", but [dry-run] was set.
|
|
427
|
+
`
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
return { success: true };
|
|
431
|
+
} catch (err) {
|
|
432
|
+
try {
|
|
433
|
+
const stdoutData = JSON.parse(_optionalChain([err, 'access', _15 => _15.stdout, 'optionalAccess', _16 => _16.toString, 'call', _17 => _17()]) || "{}");
|
|
434
|
+
if (_optionalChain([stdoutData, 'optionalAccess', _18 => _18.error]) && !(_optionalChain([stdoutData, 'access', _19 => _19.error, 'optionalAccess', _20 => _20.code, 'optionalAccess', _21 => _21.includes, 'call', _22 => _22("E404")]) && _optionalChain([stdoutData, 'access', _23 => _23.error, 'optionalAccess', _24 => _24.summary, 'optionalAccess', _25 => _25.includes, 'call', _26 => _26("no such package available")])) && !(_optionalChain([err, 'access', _27 => _27.stderr, 'optionalAccess', _28 => _28.toString, 'call', _29 => _29(), 'access', _30 => _30.includes, 'call', _31 => _31("E404")]) && _optionalChain([err, 'access', _32 => _32.stderr, 'optionalAccess', _33 => _33.toString, 'call', _34 => _34(), 'access', _35 => _35.includes, 'call', _36 => _36("no such package available")]))) {
|
|
435
|
+
const errorMessage = `An unexpected error occured while running the npm dist-tag add command:
|
|
436
|
+
|
|
437
|
+
${_optionalChain([stdoutData, 'optionalAccess', _37 => _37.error, 'optionalAccess', _38 => _38.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _39 => _39.error, 'optionalAccess', _40 => _40.summary])}${_optionalChain([stdoutData, 'optionalAccess', _41 => _41.error, 'optionalAccess', _42 => _42.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _43 => _43.error, 'optionalAccess', _44 => _44.code])})` : ""}
|
|
438
|
+
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _45 => _45.error, 'optionalAccess', _46 => _46.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _47 => _47.error, 'optionalAccess', _48 => _48.detail])}
|
|
439
|
+
` : ""}`;
|
|
440
|
+
github.error(errorMessage);
|
|
441
|
+
return { success: false };
|
|
442
|
+
}
|
|
443
|
+
} catch (err2) {
|
|
444
|
+
const stdoutData = JSON.parse(_optionalChain([err2, 'access', _49 => _49.stdout, 'optionalAccess', _50 => _50.toString, 'call', _51 => _51()]) || "{}");
|
|
445
|
+
const errorMessage = `An unexpected error occured while processing the npm dist-tag add output:
|
|
446
|
+
|
|
447
|
+
${_optionalChain([stdoutData, 'optionalAccess', _52 => _52.error, 'optionalAccess', _53 => _53.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _54 => _54.error, 'optionalAccess', _55 => _55.summary])}${_optionalChain([stdoutData, 'optionalAccess', _56 => _56.error, 'optionalAccess', _57 => _57.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _58 => _58.error, 'optionalAccess', _59 => _59.code])})` : ""}
|
|
448
|
+
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _60 => _60.error, 'optionalAccess', _61 => _61.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _62 => _62.error, 'optionalAccess', _63 => _63.detail])}
|
|
449
|
+
` : ""}`;
|
|
450
|
+
github.error(errorMessage);
|
|
451
|
+
return { success: false };
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
} catch (err) {
|
|
455
|
+
const stdoutData = JSON.parse(_optionalChain([err, 'access', _64 => _64.stdout, 'optionalAccess', _65 => _65.toString, 'call', _66 => _66()]) || "{}");
|
|
456
|
+
if (!(_optionalChain([stdoutData, 'access', _67 => _67.error, 'optionalAccess', _68 => _68.code, 'optionalAccess', _69 => _69.includes, 'call', _70 => _70("E404")]) && _optionalChain([stdoutData, 'access', _71 => _71.error, 'optionalAccess', _72 => _72.summary, 'optionalAccess', _73 => _73.toLowerCase, 'call', _74 => _74(), 'access', _75 => _75.includes, 'call', _76 => _76("not found")])) && !(_optionalChain([err, 'access', _77 => _77.stderr, 'optionalAccess', _78 => _78.toString, 'call', _79 => _79(), 'access', _80 => _80.includes, 'call', _81 => _81("E404")]) && _optionalChain([err, 'access', _82 => _82.stderr, 'optionalAccess', _83 => _83.toString, 'call', _84 => _84(), 'access', _85 => _85.toLowerCase, 'call', _86 => _86(), 'access', _87 => _87.includes, 'call', _88 => _88("not found")]))) {
|
|
457
|
+
const errorMessage = `An unexpected error occured while checking for existing dist-tags:
|
|
458
|
+
|
|
459
|
+
${_optionalChain([stdoutData, 'optionalAccess', _89 => _89.error, 'optionalAccess', _90 => _90.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _91 => _91.error, 'optionalAccess', _92 => _92.summary])}${_optionalChain([stdoutData, 'optionalAccess', _93 => _93.error, 'optionalAccess', _94 => _94.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _95 => _95.error, 'optionalAccess', _96 => _96.code])})` : ""}
|
|
460
|
+
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _97 => _97.error, 'optionalAccess', _98 => _98.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _99 => _99.error, 'optionalAccess', _100 => _100.detail])}
|
|
461
|
+
` : ""}`;
|
|
462
|
+
github.error(errorMessage);
|
|
463
|
+
return { success: false };
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
try {
|
|
468
|
+
const cwd = packageRoot;
|
|
469
|
+
const command = npmPublishCommandSegments.join(" ");
|
|
470
|
+
console.info(
|
|
471
|
+
`Running publish command "${command}" in current working directory: "${cwd}" `
|
|
472
|
+
);
|
|
473
|
+
const result = _child_process.execSync.call(void 0, command, {
|
|
474
|
+
cwd,
|
|
475
|
+
env: {
|
|
476
|
+
NPM_ID_TOKEN: token,
|
|
477
|
+
...process.env,
|
|
478
|
+
FORCE_COLOR: "true"
|
|
479
|
+
},
|
|
480
|
+
maxBuffer: LARGE_BUFFER,
|
|
481
|
+
killSignal: "SIGTERM"
|
|
482
|
+
});
|
|
483
|
+
if (isDryRun) {
|
|
484
|
+
console.info(
|
|
485
|
+
`Would publish tag "${tag}" to ${registry}, but [dry-run] was set. ${result ? `
|
|
486
|
+
|
|
487
|
+
Execution response: ${result.toString()}` : ""}`
|
|
488
|
+
);
|
|
489
|
+
} else {
|
|
490
|
+
console.info(
|
|
491
|
+
`Published tag "${tag}" to ${registry}. ${result ? `
|
|
492
|
+
|
|
493
|
+
Execution response: ${result.toString()}` : ""}`
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
return { success: true };
|
|
497
|
+
} catch (err) {
|
|
498
|
+
try {
|
|
499
|
+
const stdoutData = JSON.parse(_optionalChain([err, 'access', _101 => _101.stdout, 'optionalAccess', _102 => _102.toString, 'call', _103 => _103()]) || "{}");
|
|
500
|
+
const errorMessage = `An error occurred while publishing the npm package:
|
|
501
|
+
|
|
502
|
+
${_optionalChain([stdoutData, 'optionalAccess', _104 => _104.error, 'optionalAccess', _105 => _105.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _106 => _106.error, 'optionalAccess', _107 => _107.summary])}${_optionalChain([stdoutData, 'optionalAccess', _108 => _108.error, 'optionalAccess', _109 => _109.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _110 => _110.error, 'optionalAccess', _111 => _111.code])})` : ""}
|
|
503
|
+
` : ""}${_optionalChain([stdoutData, 'optionalAccess', _112 => _112.error, 'optionalAccess', _113 => _113.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _114 => _114.error, 'optionalAccess', _115 => _115.detail])}
|
|
504
|
+
` : ""}`;
|
|
505
|
+
github.error(errorMessage);
|
|
506
|
+
return { success: false };
|
|
507
|
+
} catch (err2) {
|
|
508
|
+
const errorMessage = `Something unexpected went wrong when processing the npm publish output.
|
|
509
|
+
|
|
510
|
+
Error: ${JSON.stringify(
|
|
511
|
+
Buffer.isBuffer(err2) ? err2.toString() : err2,
|
|
512
|
+
null,
|
|
513
|
+
2
|
|
514
|
+
)}`;
|
|
515
|
+
github.error(errorMessage);
|
|
516
|
+
return { success: false };
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
exports.LARGE_BUFFER = LARGE_BUFFER; exports.npmPublishExecutorFn = npmPublishExecutorFn;
|
|
@@ -126,7 +126,6 @@ var resolveOptions = async (userOptions) => {
|
|
|
126
126
|
assets: [],
|
|
127
127
|
dts: true,
|
|
128
128
|
shims: true,
|
|
129
|
-
silent: !debug,
|
|
130
129
|
logLevel: workspaceConfig.logLevel === "success" || workspaceConfig.logLevel === "performance" || workspaceConfig.logLevel === "debug" || workspaceConfig.logLevel === "trace" || workspaceConfig.logLevel === "all" ? "info" : workspaceConfig.logLevel === "fatal" ? "error" : workspaceConfig.logLevel,
|
|
131
130
|
sourcemap: debug ? "inline" : false,
|
|
132
131
|
clean: false,
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkTAP26ZJQjs = require('./chunk-TAP26ZJQ.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkVII3QX3Tjs = require('./chunk-VII3QX3T.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkCQDBLKPFjs = require('./chunk-CQDBLKPF.js');
|
|
11
|
+
|
|
12
|
+
// src/utils/package-helpers.ts
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _devkit = require('@nx/devkit');
|
|
17
|
+
var _child_process = require('child_process');
|
|
18
|
+
var _fs = require('fs');
|
|
19
|
+
var _promises = require('fs/promises');
|
|
20
|
+
var _path = require('path');
|
|
21
|
+
var _prettier = require('prettier');
|
|
22
|
+
var PackageManagerTypes = {
|
|
23
|
+
PackageJson: "package.json",
|
|
24
|
+
CargoToml: "Cargo.toml"
|
|
25
|
+
};
|
|
26
|
+
var getPackageInfo = (project) => {
|
|
27
|
+
if (_chunkTAP26ZJQjs.isEqualProjectTag.call(void 0,
|
|
28
|
+
project,
|
|
29
|
+
_chunkTAP26ZJQjs.ProjectTagConstants.Language.TAG_ID,
|
|
30
|
+
_chunkTAP26ZJQjs.ProjectTagConstants.Language.RUST
|
|
31
|
+
) && _fs.existsSync.call(void 0, _devkit.joinPathFragments.call(void 0, project.root, "Cargo.toml"))) {
|
|
32
|
+
return {
|
|
33
|
+
type: "Cargo.toml",
|
|
34
|
+
content: _chunkVII3QX3Tjs.parseCargoToml.call(void 0, _devkit.joinPathFragments.call(void 0, project.root, "Cargo.toml"))
|
|
35
|
+
};
|
|
36
|
+
} else if (_chunkTAP26ZJQjs.isEqualProjectTag.call(void 0,
|
|
37
|
+
project,
|
|
38
|
+
_chunkTAP26ZJQjs.ProjectTagConstants.Language.TAG_ID,
|
|
39
|
+
_chunkTAP26ZJQjs.ProjectTagConstants.Language.TYPESCRIPT
|
|
40
|
+
) && _fs.existsSync.call(void 0, _devkit.joinPathFragments.call(void 0, project.root, "package.json"))) {
|
|
41
|
+
return {
|
|
42
|
+
type: "package.json",
|
|
43
|
+
content: _devkit.readJsonFile.call(void 0,
|
|
44
|
+
_devkit.joinPathFragments.call(void 0, project.root, "package.json")
|
|
45
|
+
)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
};
|
|
50
|
+
async function addPackageJsonGitHead(packageRoot) {
|
|
51
|
+
const packageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, packageRoot, "package.json");
|
|
52
|
+
if (!packageJsonPath) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
"No file path provided. Please provide a valid path to the package.json file."
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
const packageJsonValue = JSON.parse(await _promises.readFile.call(void 0, packageJsonPath, "utf8"));
|
|
58
|
+
if (!packageJsonValue || typeof packageJsonValue !== "object") {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`Invalid package.json file at ${packageJsonPath}. Please ensure it is a valid JSON file.`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const gitHead = _child_process.execFileSync.call(void 0, "git", ["rev-parse", "HEAD"], {
|
|
64
|
+
cwd: _path.dirname.call(void 0, _path.resolve.call(void 0, packageJsonPath)),
|
|
65
|
+
encoding: "utf8"
|
|
66
|
+
}).trim();
|
|
67
|
+
packageJsonValue.gitHead = gitHead;
|
|
68
|
+
return _promises.writeFile.call(void 0,
|
|
69
|
+
packageJsonPath,
|
|
70
|
+
await _prettier.format.call(void 0, JSON.stringify(packageJsonValue), {
|
|
71
|
+
parser: "json",
|
|
72
|
+
proseWrap: "preserve",
|
|
73
|
+
trailingComma: "none",
|
|
74
|
+
tabWidth: 2,
|
|
75
|
+
semi: true,
|
|
76
|
+
singleQuote: false,
|
|
77
|
+
quoteProps: "as-needed",
|
|
78
|
+
insertPragma: false,
|
|
79
|
+
bracketSameLine: true,
|
|
80
|
+
printWidth: 80,
|
|
81
|
+
bracketSpacing: true,
|
|
82
|
+
arrowParens: "avoid",
|
|
83
|
+
endOfLine: "lf",
|
|
84
|
+
plugins: ["prettier-plugin-packagejson"]
|
|
85
|
+
})
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
exports.PackageManagerTypes = PackageManagerTypes; exports.getPackageInfo = getPackageInfo; exports.addPackageJsonGitHead = addPackageJsonGitHead;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
withRunExecutor
|
|
3
|
+
} from "./chunk-QJ74HYMK.mjs";
|
|
4
|
+
import {
|
|
5
|
+
buildCargoCommand,
|
|
6
|
+
cargoCommand
|
|
7
|
+
} from "./chunk-GKLFEOKK.mjs";
|
|
8
|
+
|
|
9
|
+
// src/executors/cargo-doc/executor.ts
|
|
10
|
+
async function cargoDocExecutor(options, context) {
|
|
11
|
+
const opts = { ...options };
|
|
12
|
+
opts["no-deps"] = opts.noDeps;
|
|
13
|
+
delete opts.noDeps;
|
|
14
|
+
const command = buildCargoCommand("doc", options, context);
|
|
15
|
+
return await cargoCommand(context.root, ...command);
|
|
16
|
+
}
|
|
17
|
+
var executor_default = withRunExecutor(
|
|
18
|
+
"Cargo - Doc",
|
|
19
|
+
cargoDocExecutor,
|
|
20
|
+
{
|
|
21
|
+
skipReadingConfig: false,
|
|
22
|
+
hooks: {
|
|
23
|
+
applyDefaultOptions: (options) => {
|
|
24
|
+
options.outputPath ??= "dist/{projectRoot}/docs";
|
|
25
|
+
options.toolchain ??= "stable";
|
|
26
|
+
options.release ??= options.profile ? false : true;
|
|
27
|
+
options.allFeatures ??= true;
|
|
28
|
+
options.lib ??= true;
|
|
29
|
+
options.bins ??= true;
|
|
30
|
+
options.examples ??= true;
|
|
31
|
+
options.noDeps ??= false;
|
|
32
|
+
return options;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
cargoDocExecutor,
|
|
40
|
+
executor_default
|
|
41
|
+
};
|