@storm-software/workspace-tools 1.80.0 → 1.82.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 +21 -0
- package/README.md +1 -1
- package/config/nx.json +1 -1
- package/index.js +3852 -3740
- package/meta.json +1 -1
- package/package.json +6 -6
- package/packages/config/src/define-config.d.ts +6 -0
- package/packages/config/src/schema.d.ts +45 -0
- package/packages/workspace-tools/src/executors/cargo-publish/executor.d.ts +1 -1
- package/src/base/index.js +5004 -4848
- package/src/executors/cargo-publish/executor.js +21 -12
- package/src/executors/cargo-publish/schema.d.ts +1 -0
- package/src/executors/cargo-publish/schema.json +6 -1
- package/src/executors/npm-publish/executor.js +32 -19
- package/src/executors/npm-publish/schema.json +3 -4
- package/src/executors/rolldown/executor.js +3811 -3778
- package/src/executors/tsup/executor.js +3811 -3778
- package/src/executors/tsup-browser/executor.js +3811 -3778
- package/src/executors/tsup-neutral/executor.js +3811 -3778
- package/src/executors/tsup-node/executor.js +3811 -3778
- package/src/executors/typia/executor.js +3811 -3778
- package/src/executors/unbuild/executor.js +3811 -3778
- package/src/generators/browser-library/generator.js +5004 -4848
- package/src/generators/config-schema/generator.js +3753 -3720
- package/src/generators/neutral-library/generator.js +5004 -4848
- package/src/generators/node-library/generator.js +5004 -4848
- package/src/generators/preset/generator.js +3819 -3786
- package/src/generators/release-version/generator.js +3784 -3795
- package/src/plugins/rust/index.js +6 -2
- package/src/plugins/typescript/index.js +1 -3
- package/src/utils/index.js +3811 -3778
|
@@ -2929,10 +2929,13 @@ async function runExecutor(options, context) {
|
|
|
2929
2929
|
if (!context.projectName) {
|
|
2930
2930
|
throw new Error("The executor requires a projectName.");
|
|
2931
2931
|
}
|
|
2932
|
-
console.info(
|
|
2932
|
+
console.info(
|
|
2933
|
+
`\u{1F680} Running Storm Cargo Publish executor on the ${context.projectName} crate`
|
|
2934
|
+
);
|
|
2933
2935
|
if (!context.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
|
|
2934
2936
|
throw new Error("The executor requires projectsConfigurations.");
|
|
2935
2937
|
}
|
|
2938
|
+
const registry = options.registry ? options.registry : process.env.STORM_REGISTRY_CARGO ? process.env.STORM_REGISTRY_CARGO : "https://crates.io";
|
|
2936
2939
|
const root = context.projectsConfigurations.projects[context.projectName]?.root;
|
|
2937
2940
|
const packageRoot = (0, import_devkit2.joinPathFragments)(
|
|
2938
2941
|
context.root,
|
|
@@ -2942,10 +2945,14 @@ async function runExecutor(options, context) {
|
|
|
2942
2945
|
(0, import_node_fs.readFileSync)((0, import_devkit2.joinPathFragments)(packageRoot, "Cargo.toml"), "utf-8")
|
|
2943
2946
|
);
|
|
2944
2947
|
try {
|
|
2945
|
-
const result = await getRegistryVersion(
|
|
2948
|
+
const result = await getRegistryVersion(
|
|
2949
|
+
cargoToml.package.name,
|
|
2950
|
+
cargoToml.package.version,
|
|
2951
|
+
registry
|
|
2952
|
+
);
|
|
2946
2953
|
if (result) {
|
|
2947
2954
|
console.warn(
|
|
2948
|
-
`Skipped package "${cargoToml.package.name}" from project "${context.projectName}" because v${cargoToml.package.version} already exists in
|
|
2955
|
+
`Skipped package "${cargoToml.package.name}" from project "${context.projectName}" because v${cargoToml.package.version} already exists in ${registry} with tag "latest"`
|
|
2949
2956
|
);
|
|
2950
2957
|
return {
|
|
2951
2958
|
success: true
|
|
@@ -2953,16 +2960,18 @@ async function runExecutor(options, context) {
|
|
|
2953
2960
|
}
|
|
2954
2961
|
} catch (_) {
|
|
2955
2962
|
}
|
|
2956
|
-
const cargoPublishCommandSegments = [
|
|
2963
|
+
const cargoPublishCommandSegments = [
|
|
2964
|
+
`cargo publish --allow-dirty -p ${cargoToml.package.name}`
|
|
2965
|
+
];
|
|
2957
2966
|
if (isDryRun) {
|
|
2958
2967
|
cargoPublishCommandSegments.push("--dry-run");
|
|
2959
2968
|
}
|
|
2960
2969
|
try {
|
|
2961
|
-
const
|
|
2970
|
+
const cargoPublishCommand = cargoPublishCommandSegments.join(" ");
|
|
2962
2971
|
console.log("");
|
|
2963
|
-
console.log(`Running "${
|
|
2972
|
+
console.log(`Running "${cargoPublishCommand}"...`);
|
|
2964
2973
|
console.log("");
|
|
2965
|
-
(0, import_node_child_process.execSync)(
|
|
2974
|
+
(0, import_node_child_process.execSync)(cargoPublishCommand, {
|
|
2966
2975
|
maxBuffer: LARGE_BUFFER,
|
|
2967
2976
|
env: {
|
|
2968
2977
|
...process.env,
|
|
@@ -2973,15 +2982,15 @@ async function runExecutor(options, context) {
|
|
|
2973
2982
|
});
|
|
2974
2983
|
console.log("");
|
|
2975
2984
|
if (isDryRun) {
|
|
2976
|
-
console.log(
|
|
2985
|
+
console.log(`Would publish to ${registry}, but [dry-run] was set`);
|
|
2977
2986
|
} else {
|
|
2978
|
-
console.log(
|
|
2987
|
+
console.log(`Published to ${registry}`);
|
|
2979
2988
|
}
|
|
2980
2989
|
return {
|
|
2981
2990
|
success: true
|
|
2982
2991
|
};
|
|
2983
2992
|
} catch (error) {
|
|
2984
|
-
console.error(
|
|
2993
|
+
console.error(`Failed to publish to ${registry}`);
|
|
2985
2994
|
console.error(error);
|
|
2986
2995
|
console.log("");
|
|
2987
2996
|
return {
|
|
@@ -2989,10 +2998,10 @@ async function runExecutor(options, context) {
|
|
|
2989
2998
|
};
|
|
2990
2999
|
}
|
|
2991
3000
|
}
|
|
2992
|
-
var getRegistryVersion = (name, version2) => {
|
|
3001
|
+
var getRegistryVersion = (name, version2, registry) => {
|
|
2993
3002
|
return new Promise(
|
|
2994
3003
|
(resolve) => import_node_https.default.get(
|
|
2995
|
-
|
|
3004
|
+
`${registry}/api/v1/crates/${encodeURIComponent(name)}/${encodeURIComponent(
|
|
2996
3005
|
version2
|
|
2997
3006
|
)}`,
|
|
2998
3007
|
(res) => {
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
"description": "Publish a package to the crates.io registry - DO NOT INVOKE DIRECTLY WITH `nx run`. Use `nx release publish` instead.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
+
"registry": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The Cargo registry URL to publish the package to.",
|
|
11
|
+
"format": "uri"
|
|
12
|
+
},
|
|
8
13
|
"packageRoot": {
|
|
9
14
|
"type": "string",
|
|
10
15
|
"description": "The root directory of the directory (containing a manifest file at its root) to publish. Defaults to the project root."
|
|
@@ -15,4 +20,4 @@
|
|
|
15
20
|
}
|
|
16
21
|
},
|
|
17
22
|
"required": []
|
|
18
|
-
}
|
|
23
|
+
}
|
|
@@ -32,7 +32,9 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
32
32
|
}
|
|
33
33
|
const projectConfig = context.projectsConfigurations?.projects?.[context.projectName];
|
|
34
34
|
if (!projectConfig) {
|
|
35
|
-
throw new Error(
|
|
35
|
+
throw new Error(
|
|
36
|
+
`Could not find project configuration for ${context.projectName}`
|
|
37
|
+
);
|
|
36
38
|
}
|
|
37
39
|
const packageRoot = (0, import_devkit.joinPathFragments)(
|
|
38
40
|
context.root,
|
|
@@ -41,17 +43,24 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
41
43
|
const packageJsonPath = (0, import_devkit.joinPathFragments)(packageRoot, "package.json");
|
|
42
44
|
const projectPackageJson = (0, import_devkit.readJsonFile)(packageJsonPath);
|
|
43
45
|
const packageName = projectPackageJson.name;
|
|
44
|
-
console.info(
|
|
46
|
+
console.info(
|
|
47
|
+
`\u{1F680} Running Storm NPM Publish executor on the ${packageName} package`
|
|
48
|
+
);
|
|
45
49
|
const packageTxt = packageName === context.projectName ? `package "${packageName}"` : `package "${packageName}" from project "${context.projectName}"`;
|
|
46
50
|
if (projectPackageJson.private === true) {
|
|
47
|
-
console.warn(
|
|
51
|
+
console.warn(
|
|
52
|
+
`Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`
|
|
53
|
+
);
|
|
48
54
|
return new Promise((resolve) => resolve({ success: true }));
|
|
49
55
|
}
|
|
50
56
|
const npmPublishCommandSegments = ["npm publish --json"];
|
|
51
|
-
const npmViewCommandSegments = [
|
|
57
|
+
const npmViewCommandSegments = [
|
|
58
|
+
`npm view ${packageName} versions dist-tags --json`
|
|
59
|
+
];
|
|
60
|
+
const registry = options.registry ? options.registry : (0, import_node_child_process.execSync)("npm config get registry").toString().trim();
|
|
52
61
|
if (options.registry) {
|
|
53
|
-
npmPublishCommandSegments.push(`--registry=${
|
|
54
|
-
npmViewCommandSegments.push(`--registry=${
|
|
62
|
+
npmPublishCommandSegments.push(`--registry=${registry}`);
|
|
63
|
+
npmViewCommandSegments.push(`--registry=${registry}`);
|
|
55
64
|
}
|
|
56
65
|
if (options.tag) {
|
|
57
66
|
npmPublishCommandSegments.push(`--tag=${options.tag}`);
|
|
@@ -63,9 +72,8 @@ async function npmPublishExecutorFn(options, context) {
|
|
|
63
72
|
npmPublishCommandSegments.push("--dry-run");
|
|
64
73
|
}
|
|
65
74
|
npmPublishCommandSegments.push("--provenance --access public");
|
|
66
|
-
const registry = options.registry ?? (0, import_node_child_process.execSync)("npm config get registry").toString().trim();
|
|
67
75
|
const tag = options.tag ?? (0, import_node_child_process.execSync)("npm config get tag").toString().trim();
|
|
68
|
-
if (!isDryRun
|
|
76
|
+
if (!isDryRun) {
|
|
69
77
|
const currentVersion = projectPackageJson.version;
|
|
70
78
|
try {
|
|
71
79
|
try {
|
|
@@ -103,16 +111,16 @@ Note: If this is the first time this package has been published to NPM, this can
|
|
|
103
111
|
FORCE_COLOR: "true"
|
|
104
112
|
},
|
|
105
113
|
cwd: packageRoot,
|
|
106
|
-
stdio: "ignore"
|
|
114
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
107
115
|
}
|
|
108
116
|
);
|
|
109
117
|
console.info(
|
|
110
|
-
`Added the dist-tag ${tag} to v${currentVersion} for
|
|
118
|
+
`Added the dist-tag ${tag} to v${currentVersion} for registries "${registry}".
|
|
111
119
|
`
|
|
112
120
|
);
|
|
113
121
|
} else {
|
|
114
122
|
console.info(
|
|
115
|
-
`Would add the dist-tag ${tag} to v${currentVersion} for
|
|
123
|
+
`Would add the dist-tag ${tag} to v${currentVersion} for registries "${registry}", but [dry-run] was set.
|
|
116
124
|
`
|
|
117
125
|
);
|
|
118
126
|
}
|
|
@@ -121,7 +129,9 @@ Note: If this is the first time this package has been published to NPM, this can
|
|
|
121
129
|
try {
|
|
122
130
|
const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
|
|
123
131
|
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"))) {
|
|
124
|
-
console.error(
|
|
132
|
+
console.error(
|
|
133
|
+
"npm dist-tag add error please see below for more information:"
|
|
134
|
+
);
|
|
125
135
|
if (stdoutData.error.summary) {
|
|
126
136
|
console.error(stdoutData.error?.summary);
|
|
127
137
|
}
|
|
@@ -129,7 +139,9 @@ Note: If this is the first time this package has been published to NPM, this can
|
|
|
129
139
|
console.error(stdoutData.error?.detail);
|
|
130
140
|
}
|
|
131
141
|
if (context.isVerbose) {
|
|
132
|
-
console.error(
|
|
142
|
+
console.error(
|
|
143
|
+
`npm dist-tag add stdout: ${JSON.stringify(stdoutData, null, 2)}`
|
|
144
|
+
);
|
|
133
145
|
}
|
|
134
146
|
return new Promise((resolve) => resolve({ success: false }));
|
|
135
147
|
}
|
|
@@ -152,9 +164,6 @@ ${err}`
|
|
|
152
164
|
}
|
|
153
165
|
}
|
|
154
166
|
}
|
|
155
|
-
if (options.firstRelease && context.isVerbose) {
|
|
156
|
-
console.info("Skipped npm view because --first-release was set");
|
|
157
|
-
}
|
|
158
167
|
try {
|
|
159
168
|
const output = (0, import_node_child_process.execSync)(npmPublishCommandSegments.join(" "), {
|
|
160
169
|
maxBuffer: LARGE_BUFFER,
|
|
@@ -167,7 +176,9 @@ ${err}`
|
|
|
167
176
|
});
|
|
168
177
|
console.info(output.toString());
|
|
169
178
|
if (isDryRun) {
|
|
170
|
-
console.info(
|
|
179
|
+
console.info(
|
|
180
|
+
`Would publish to ${registry} with tag "${tag}", but [dry-run] was set`
|
|
181
|
+
);
|
|
171
182
|
} else {
|
|
172
183
|
console.info(`Published to ${registry} with tag "${tag}"`);
|
|
173
184
|
}
|
|
@@ -184,8 +195,10 @@ ${err}`
|
|
|
184
195
|
console.error(stdoutData.error.detail);
|
|
185
196
|
}
|
|
186
197
|
if (context.isVerbose) {
|
|
187
|
-
console.error(
|
|
188
|
-
|
|
198
|
+
console.error(
|
|
199
|
+
`npm publish stdout:
|
|
200
|
+
${JSON.stringify(stdoutData, null, 2)}`
|
|
201
|
+
);
|
|
189
202
|
}
|
|
190
203
|
return new Promise((resolve) => resolve({ success: false }));
|
|
191
204
|
} catch (err2) {
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"registry": {
|
|
13
13
|
"type": "string",
|
|
14
|
-
"description": "The registry to publish the package to.",
|
|
15
|
-
"format": "uri"
|
|
16
|
-
"default": "https://registry.npmjs.org/"
|
|
14
|
+
"description": "The NPM registry URL to publish the package to.",
|
|
15
|
+
"format": "uri"
|
|
17
16
|
},
|
|
18
17
|
"tag": {
|
|
19
18
|
"type": "string",
|
|
@@ -24,5 +23,5 @@
|
|
|
24
23
|
"description": "Whether to run the command without actually publishing the package to the registry."
|
|
25
24
|
}
|
|
26
25
|
},
|
|
27
|
-
"required": [
|
|
26
|
+
"required": []
|
|
28
27
|
}
|