@storm-software/workspace-tools 1.292.21 → 1.292.22

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +2 -1
  3. package/dist/chunk-4JQWIFLV.mjs +41 -0
  4. package/dist/chunk-4UM5CH2U.mjs +253 -0
  5. package/dist/chunk-7Q6C6OPG.js +31 -0
  6. package/dist/chunk-D6J42QOS.mjs +548 -0
  7. package/dist/chunk-DUBR4AU3.js +79 -0
  8. package/dist/chunk-DXDE57AW.mjs +31 -0
  9. package/dist/chunk-EAKNYFXW.mjs +82 -0
  10. package/dist/{chunk-MU6OJDOC.mjs → chunk-H4EFSMAS.mjs} +25 -13
  11. package/dist/{chunk-POXELQII.js → chunk-HD4WVBQR.js} +27 -15
  12. package/dist/chunk-HMJ6QSLF.js +548 -0
  13. package/dist/chunk-ICEFWDU6.mjs +93 -0
  14. package/dist/chunk-LSQJLTZV.js +41 -0
  15. package/dist/chunk-MMK7RH3M.js +93 -0
  16. package/dist/chunk-NCQGUJKW.js +32 -0
  17. package/dist/chunk-NLQFX45G.mjs +32 -0
  18. package/dist/chunk-O72RTEPO.js +32 -0
  19. package/dist/chunk-OYR326KM.mjs +32 -0
  20. package/dist/chunk-RAZM4EEP.js +250 -0
  21. package/dist/chunk-SMA6IGFS.js +32 -0
  22. package/dist/chunk-VCSFYT3X.mjs +32 -0
  23. package/dist/{executor-CpcXNDfG.d.mts → executor-DvLQW7fm.d.mts} +1 -1
  24. package/dist/{executor-CpcXNDfG.d.ts → executor-DvLQW7fm.d.ts} +1 -1
  25. package/dist/executors.d.mts +1 -1
  26. package/dist/executors.d.ts +1 -1
  27. package/dist/executors.js +4 -4
  28. package/dist/executors.mjs +4 -4
  29. package/dist/index.d.mts +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +4 -4
  32. package/dist/index.mjs +4 -4
  33. package/dist/src/executors/cargo-publish/executor.d.mts +1 -1
  34. package/dist/src/executors/cargo-publish/executor.d.ts +1 -1
  35. package/dist/src/executors/cargo-publish/executor.js +2 -2
  36. package/dist/src/executors/cargo-publish/executor.mjs +1 -1
  37. package/package.json +8 -8
@@ -0,0 +1,82 @@
1
+ import {
2
+ normalizeOptions,
3
+ typeScriptLibraryGeneratorFn
4
+ } from "./chunk-HP36FVRU.mjs";
5
+ import {
6
+ withRunGenerator
7
+ } from "./chunk-JGFRV7ZL.mjs";
8
+ import {
9
+ typesNodeVersion
10
+ } from "./chunk-QC5ON3X4.mjs";
11
+ import {
12
+ joinPaths
13
+ } from "./chunk-C26A6BXG.mjs";
14
+ import {
15
+ __dirname
16
+ } from "./chunk-IPWUJVZZ.mjs";
17
+
18
+ // src/generators/node-library/generator.ts
19
+ import {
20
+ formatFiles,
21
+ generateFiles,
22
+ names,
23
+ offsetFromRoot
24
+ } from "@nx/devkit";
25
+ async function nodeLibraryGeneratorFn(tree, schema, config) {
26
+ const filesDir = joinPaths(
27
+ __dirname,
28
+ "src",
29
+ "generators",
30
+ "node-library",
31
+ "files"
32
+ );
33
+ const tsLibraryGeneratorOptions = {
34
+ platform: "node",
35
+ devDependencies: {
36
+ "@types/node": typesNodeVersion
37
+ },
38
+ buildExecutor: "@storm-software/workspace-tools:unbuild",
39
+ ...schema,
40
+ directory: schema.directory,
41
+ description: schema.description
42
+ };
43
+ const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
44
+ const { className, name, propertyName } = names(options.name);
45
+ generateFiles(tree, filesDir, options.projectRoot, {
46
+ ...schema,
47
+ dot: ".",
48
+ className,
49
+ name,
50
+ namespace: process.env.STORM_NAMESPACE ?? "storm-software",
51
+ description: schema.description ?? "",
52
+ propertyName,
53
+ js: !!options.js,
54
+ cliCommand: "nx",
55
+ strict: void 0,
56
+ tmpl: "",
57
+ offsetFromRoot: offsetFromRoot(options.projectRoot),
58
+ buildable: options.bundler && options.bundler !== "none",
59
+ hasUnitTestRunner: options.unitTestRunner !== "none"
60
+ });
61
+ await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
62
+ await formatFiles(tree);
63
+ return null;
64
+ }
65
+ var generator_default = withRunGenerator(
66
+ "TypeScript Library Creator (NodeJs Platform)",
67
+ nodeLibraryGeneratorFn,
68
+ {
69
+ hooks: {
70
+ applyDefaultOptions: (options) => {
71
+ options.description ??= "A library used by Storm Software to support NodeJs applications";
72
+ options.platform ??= "node";
73
+ return options;
74
+ }
75
+ }
76
+ }
77
+ );
78
+
79
+ export {
80
+ nodeLibraryGeneratorFn,
81
+ generator_default
82
+ };
@@ -36,13 +36,13 @@ async function runExecutor(options, context) {
36
36
  );
37
37
  if (result) {
38
38
  console.warn(
39
- `Skipped package "${cargoToml.package.name}" from project "${context.projectName}" because v${cargoToml.package.version} already exists in ${registry} with tag "latest"`
39
+ `Skipped publishing crate ${cargoToml.package.name} v${cargoToml.package.version} - ${result}`
40
40
  );
41
41
  return {
42
42
  success: true
43
43
  };
44
44
  }
45
- } catch (_) {
45
+ } catch {
46
46
  }
47
47
  const cargoPublishCommandSegments = [
48
48
  `cargo publish --allow-dirty -p ${cargoToml.package.name}`
@@ -83,18 +83,30 @@ async function runExecutor(options, context) {
83
83
  }
84
84
  }
85
85
  var getRegistryVersion = (name, version, registry) => {
86
+ const url = `${registry}/api/v1/crates/${encodeURIComponent(name)}/${encodeURIComponent(
87
+ version
88
+ )}`;
89
+ console.log(`Checking for existing version at: ${url}`);
86
90
  return new Promise(
87
- (resolve) => https.get(
88
- `${registry}/api/v1/crates/${encodeURIComponent(name)}/${encodeURIComponent(
89
- version
90
- )}`,
91
- (res) => {
92
- res.on("data", (d) => {
93
- resolve(d);
94
- });
95
- }
96
- ).on("error", (e) => {
97
- throw e;
91
+ (resolve) => https.get(url, (res) => {
92
+ res.on("data", (d) => {
93
+ if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
94
+ const response = JSON.parse(d.toString());
95
+ const updatedAt = response.version?.updated_at;
96
+ const publishedBy = response.version?.published_by?.name;
97
+ resolve(
98
+ `The ${name} v${version} crate was previously published${publishedBy ? ` by ${publishedBy}` : ""}${updatedAt ? ` on ${new Date(updatedAt).toLocaleDateString("en-US", {
99
+ year: "numeric",
100
+ month: "long",
101
+ day: "numeric",
102
+ weekday: "long"
103
+ })}` : ""}.`
104
+ );
105
+ }
106
+ resolve(null);
107
+ });
108
+ }).on("error", () => {
109
+ resolve(null);
98
110
  })
99
111
  );
100
112
  };
@@ -16,11 +16,11 @@ async function runExecutor(options, context) {
16
16
  console.info(
17
17
  `\u{1F680} Running Storm Cargo Publish executor on the ${context.projectName} crate`
18
18
  );
19
- if (!context.projectName || !_optionalChain([context, 'access', _2 => _2.projectsConfigurations, 'optionalAccess', _3 => _3.projects]) || !context.projectsConfigurations.projects[context.projectName] || !_optionalChain([context, 'access', _4 => _4.projectsConfigurations, 'access', _5 => _5.projects, 'access', _6 => _6[context.projectName], 'optionalAccess', _7 => _7.root])) {
19
+ if (!context.projectName || !_optionalChain([context, 'access', _ => _.projectsConfigurations, 'optionalAccess', _2 => _2.projects]) || !context.projectsConfigurations.projects[context.projectName] || !_optionalChain([context, 'access', _3 => _3.projectsConfigurations, 'access', _4 => _4.projects, 'access', _5 => _5[context.projectName], 'optionalAccess', _6 => _6.root])) {
20
20
  throw new Error("The executor requires projectsConfigurations.");
21
21
  }
22
22
  const registry = options.registry ? options.registry : process.env.STORM_REGISTRY_CARGO ? process.env.STORM_REGISTRY_CARGO : "https://crates.io";
23
- const root = _optionalChain([context, 'access', _8 => _8.projectsConfigurations, 'access', _9 => _9.projects, 'access', _10 => _10[context.projectName], 'optionalAccess', _11 => _11.root]);
23
+ const root = _optionalChain([context, 'access', _7 => _7.projectsConfigurations, 'access', _8 => _8.projects, 'access', _9 => _9[context.projectName], 'optionalAccess', _10 => _10.root]);
24
24
  const packageRoot = _devkit.joinPathFragments.call(void 0,
25
25
  context.root,
26
26
  options.packageRoot ? options.packageRoot : root
@@ -36,13 +36,13 @@ async function runExecutor(options, context) {
36
36
  );
37
37
  if (result) {
38
38
  console.warn(
39
- `Skipped package "${cargoToml.package.name}" from project "${context.projectName}" because v${cargoToml.package.version} already exists in ${registry} with tag "latest"`
39
+ `Skipped publishing crate ${cargoToml.package.name} v${cargoToml.package.version} - ${result}`
40
40
  );
41
41
  return {
42
42
  success: true
43
43
  };
44
44
  }
45
- } catch (_) {
45
+ } catch (e) {
46
46
  }
47
47
  const cargoPublishCommandSegments = [
48
48
  `cargo publish --allow-dirty -p ${cargoToml.package.name}`
@@ -83,18 +83,30 @@ async function runExecutor(options, context) {
83
83
  }
84
84
  }
85
85
  var getRegistryVersion = (name, version, registry) => {
86
+ const url = `${registry}/api/v1/crates/${encodeURIComponent(name)}/${encodeURIComponent(
87
+ version
88
+ )}`;
89
+ console.log(`Checking for existing version at: ${url}`);
86
90
  return new Promise(
87
- (resolve) => _https2.default.get(
88
- `${registry}/api/v1/crates/${encodeURIComponent(name)}/${encodeURIComponent(
89
- version
90
- )}`,
91
- (res) => {
92
- res.on("data", (d) => {
93
- resolve(d);
94
- });
95
- }
96
- ).on("error", (e) => {
97
- throw e;
91
+ (resolve) => _https2.default.get(url, (res) => {
92
+ res.on("data", (d) => {
93
+ if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
94
+ const response = JSON.parse(d.toString());
95
+ const updatedAt = _optionalChain([response, 'access', _11 => _11.version, 'optionalAccess', _12 => _12.updated_at]);
96
+ const publishedBy = _optionalChain([response, 'access', _13 => _13.version, 'optionalAccess', _14 => _14.published_by, 'optionalAccess', _15 => _15.name]);
97
+ resolve(
98
+ `The ${name} v${version} crate was previously published${publishedBy ? ` by ${publishedBy}` : ""}${updatedAt ? ` on ${new Date(updatedAt).toLocaleDateString("en-US", {
99
+ year: "numeric",
100
+ month: "long",
101
+ day: "numeric",
102
+ weekday: "long"
103
+ })}` : ""}.`
104
+ );
105
+ }
106
+ resolve(null);
107
+ });
108
+ }).on("error", () => {
109
+ resolve(null);
98
110
  })
99
111
  );
100
112
  };