@storm-software/workspace-tools 1.202.1 → 1.204.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/declarations.d.ts +18 -2
  3. package/index.js +115 -101
  4. package/meta.json +221 -176
  5. package/package.json +1 -1
  6. package/src/base/base-executor.js +10 -12
  7. package/src/base/base-generator.js +10 -12
  8. package/src/base/index.js +79 -19
  9. package/src/base/typescript-library-generator.d.ts +2 -1
  10. package/src/base/typescript-library-generator.js +69 -7
  11. package/src/executors/cargo-build/executor.js +10 -12
  12. package/src/executors/cargo-check/executor.js +10 -12
  13. package/src/executors/cargo-clippy/executor.js +10 -12
  14. package/src/executors/cargo-doc/executor.js +10 -12
  15. package/src/executors/cargo-format/executor.js +10 -12
  16. package/src/executors/clean-package/executor.js +10 -12
  17. package/src/executors/rolldown/executor.js +10 -12
  18. package/src/executors/rollup/executor.js +10 -12
  19. package/src/executors/size-limit/executor.js +10 -12
  20. package/src/executors/tsup/executor.js +10 -12
  21. package/src/executors/tsup-browser/executor.js +10 -12
  22. package/src/executors/tsup-neutral/executor.js +10 -12
  23. package/src/executors/tsup-node/executor.js +10 -12
  24. package/src/executors/typia/executor.js +10 -12
  25. package/src/executors/unbuild/executor.js +10 -12
  26. package/src/executors/unbuild/schema.json +7 -1
  27. package/src/generators/browser-library/generator.d.ts +2 -1
  28. package/src/generators/browser-library/generator.js +81 -21
  29. package/src/generators/config-schema/generator.js +10 -12
  30. package/src/generators/neutral-library/generator.d.ts +2 -1
  31. package/src/generators/neutral-library/generator.js +81 -21
  32. package/src/generators/node-library/generator.d.ts +2 -1
  33. package/src/generators/node-library/generator.js +81 -21
  34. package/src/generators/preset/generator.js +10 -12
  35. package/src/generators/release-version/generator.js +10 -12
  36. package/src/plugins/rust/index.js +13 -0
  37. package/src/plugins/typescript/index.js +13 -0
  38. package/src/utils/index.js +23 -12
  39. package/src/utils/project-tags.d.ts +8 -1
  40. package/src/utils/project-tags.js +13 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## 1.204.0 (2024-12-19)
2
+
3
+ ### Features
4
+
5
+ - **workspace-tools:** Added `platform` to unbuild schema and project tags
6
+ ([bfbe9dee](https://github.com/storm-software/storm-ops/commit/bfbe9dee))
7
+
8
+ ## 1.203.0 (2024-12-19)
9
+
10
+ ### Features
11
+
12
+ - **workspace-tools:** Update TypeScript library generators to use `unbuild`
13
+ executor
14
+ ([29468243](https://github.com/storm-software/storm-ops/commit/29468243))
15
+
1
16
  ## 1.202.1 (2024-12-19)
2
17
 
3
18
  ### Bug Fixes
package/declarations.d.ts CHANGED
@@ -194,12 +194,20 @@ declare function typeScriptLibraryGeneratorFn(
194
194
  ): Promise<any>;
195
195
  export { typeScriptLibraryGeneratorFn };
196
196
 
197
- export type ProjectTagVariant = "language" | "type" | "dist-style" | "provider";
197
+ export type ProjectTagVariant =
198
+ | "language"
199
+ | "type"
200
+ | "dist-style"
201
+ | "provider"
202
+ | "platform"
203
+ | "registry";
198
204
  export const ProjectTagVariant = {
199
205
  LANGUAGE: "language" as ProjectTagVariant,
200
206
  TYPE: "type" as ProjectTagVariant,
201
207
  DIST_STYLE: "dist-style" as ProjectTagVariant,
202
- PROVIDER: "provider" as ProjectTagVariant
208
+ PROVIDER: "provider" as ProjectTagVariant,
209
+ PLATFORM: "platform" as ProjectTagVariant,
210
+ REGISTRY: "registry" as ProjectTagVariant
203
211
  };
204
212
 
205
213
  export type ProjectTagLanguageValue = "typescript" | "rust";
@@ -220,6 +228,14 @@ export const ProjectTagDistStyleValue = {
220
228
  CLEAN: "clean" as ProjectTagDistStyleValue
221
229
  };
222
230
 
231
+ export type ProjectTagPlatformValue = "node" | "browser" | "neutral" | "worker";
232
+ export const ProjectTagPlatformValue = {
233
+ NODE: "node" as ProjectTagPlatformValue,
234
+ BROWSER: "browser" as ProjectTagPlatformValue,
235
+ NEUTRAL: "neutral" as ProjectTagPlatformValue,
236
+ WORKER: "worker" as ProjectTagPlatformValue
237
+ };
238
+
223
239
  export type ProjectTagRegistryValue = "cargo" | "npm" | "container" | "cyclone";
224
240
  export const ProjectTagRegistryValue = {
225
241
  CARGO: "cargo" as ProjectTagRegistryValue,
package/index.js CHANGED
@@ -66405,7 +66405,7 @@ var init_schema = __esm({
66405
66405
  worker: z3.string().trim().default("Stormie-Bot").describe(
66406
66406
  "The worker of the package (this is the bot that will be used to perform various tasks)"
66407
66407
  ),
66408
- env: z3.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment of the package"),
66408
+ envName: z3.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment name for the package"),
66409
66409
  workspaceRoot: z3.string().trim().default("").describe("The root directory of the workspace"),
66410
66410
  packageDirectory: z3.string().trim().optional().describe("The root directory of the package"),
66411
66411
  externalPackagePatterns: z3.array(z3.string()).default([]).describe(
@@ -66527,19 +66527,17 @@ var init_get_default_config = __esm({
66527
66527
  }
66528
66528
  };
66529
66529
  DEFAULT_STORM_CONFIG = {
66530
- name: "storm",
66531
66530
  namespace: "storm-software",
66532
- license: "Apache 2.0",
66531
+ license: "Apache-2.0",
66533
66532
  homepage: "https://stormsoftware.com",
66534
- owner: "@storm-software/development",
66533
+ owner: "@storm-software/admin",
66535
66534
  worker: "stormie-bot",
66536
66535
  runtimeDirectory: "node_modules/.storm",
66537
- cacheDirectory: "node_modules/.cache/storm",
66538
66536
  skipCache: false,
66539
- packageManager: "npm",
66537
+ packageManager: "pnpm",
66540
66538
  timezone: "America/New_York",
66541
66539
  locale: "en-US",
66542
- env: "production",
66540
+ envName: "production",
66543
66541
  branch: "main",
66544
66542
  organization: "storm-software",
66545
66543
  configFile: null,
@@ -67039,7 +67037,7 @@ var init_get_env = __esm({
67039
67037
  cacheDirectory: correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]),
67040
67038
  runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
67041
67039
  outputDirectory: correctPaths(process.env[`${prefix}OUTPUT_DIRECTORY`]),
67042
- env: process.env[`${prefix}ENV`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
67040
+ envName: process.env[`${prefix}ENV_NAME`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
67043
67041
  // ci:
67044
67042
  // process.env[`${prefix}CI`] !== undefined
67045
67043
  // ? Boolean(
@@ -67268,10 +67266,10 @@ var init_set_env = __esm({
67268
67266
  config.outputDirectory
67269
67267
  );
67270
67268
  }
67271
- if (config.env) {
67272
- process.env[`${prefix}ENV`] = config.env;
67273
- process.env.NODE_ENV = config.env;
67274
- process.env.ENVIRONMENT = config.env;
67269
+ if (config.envName) {
67270
+ process.env[`${prefix}ENV_NAME`] = config.envName;
67271
+ process.env.NODE_ENV = config.envName;
67272
+ process.env.ENVIRONMENT = config.envName;
67275
67273
  }
67276
67274
  if (config.colors?.base?.light || config.colors?.base?.dark) {
67277
67275
  for (const key of Object.keys(config.colors)) {
@@ -221087,6 +221085,97 @@ var import_js = require("@nx/js");
221087
221085
  var import_init = __toESM(require("@nx/js/src/generators/init/init"));
221088
221086
  var import_generator = __toESM(require("@nx/js/src/generators/setup-verdaccio/generator"));
221089
221087
 
221088
+ // packages/workspace-tools/src/utils/project-tags.ts
221089
+ var ProjectTagConstants = {
221090
+ Language: {
221091
+ TAG_ID: "language",
221092
+ TYPESCRIPT: "typescript",
221093
+ RUST: "rust"
221094
+ },
221095
+ ProjectType: {
221096
+ TAG_ID: "type",
221097
+ LIBRARY: "library",
221098
+ APPLICATION: "application"
221099
+ },
221100
+ DistStyle: {
221101
+ TAG_ID: "dist-style",
221102
+ NORMAL: "normal",
221103
+ CLEAN: "clean"
221104
+ },
221105
+ Provider: {
221106
+ TAG_ID: "provider"
221107
+ },
221108
+ Platform: {
221109
+ TAG_ID: "platform",
221110
+ NODE: "node",
221111
+ BROWSER: "browser",
221112
+ NEUTRAL: "neutral",
221113
+ WORKER: "worker"
221114
+ },
221115
+ Registry: {
221116
+ TAG_ID: "registry",
221117
+ CARGO: "cargo",
221118
+ NPM: "npm",
221119
+ CONTAINER: "container",
221120
+ CYCLONE: "cyclone"
221121
+ }
221122
+ };
221123
+ var formatProjectTag = (variant, value2) => {
221124
+ return `${variant}:${value2}`;
221125
+ };
221126
+ var hasProjectTag = (project, variant) => {
221127
+ project.tags = project.tags ?? [];
221128
+ const prefix = formatProjectTag(variant, "");
221129
+ return project.tags.some(
221130
+ (tag) => tag.startsWith(prefix) && tag.length > prefix.length
221131
+ );
221132
+ };
221133
+ var getProjectTag = (project, variant) => {
221134
+ if (!hasProjectTag(project, variant)) {
221135
+ return void 0;
221136
+ }
221137
+ project.tags = project.tags ?? [];
221138
+ const prefix = formatProjectTag(variant, "");
221139
+ const tag = project.tags.find((tag2) => tag2.startsWith(prefix));
221140
+ return tag?.replace(prefix, "");
221141
+ };
221142
+ var isEqualProjectTag = (project, variant, value2) => {
221143
+ const tag = getProjectTag(project, variant);
221144
+ return !!(tag && tag?.toUpperCase() === value2.toUpperCase());
221145
+ };
221146
+ var addProjectTag = (project, variant, value2, options = {
221147
+ overwrite: false
221148
+ }) => {
221149
+ project.tags = project.tags ?? [];
221150
+ if (options.overwrite || !hasProjectTag(project, variant)) {
221151
+ project.tags = project.tags.filter(
221152
+ (tag) => !tag.startsWith(formatProjectTag(variant, ""))
221153
+ );
221154
+ project.tags.push(formatProjectTag(variant, value2));
221155
+ }
221156
+ };
221157
+ var setDefaultProjectTags = (project) => {
221158
+ project.tags = project.tags ?? [];
221159
+ addProjectTag(
221160
+ project,
221161
+ ProjectTagConstants.ProjectType.TAG_ID,
221162
+ project.projectType === "application" ? ProjectTagConstants.ProjectType.APPLICATION : ProjectTagConstants.ProjectType.LIBRARY,
221163
+ { overwrite: true }
221164
+ );
221165
+ addProjectTag(
221166
+ project,
221167
+ ProjectTagConstants.DistStyle.TAG_ID,
221168
+ project.targets && Object.keys(project.targets).includes("clean-package") ? ProjectTagConstants.DistStyle.CLEAN : ProjectTagConstants.DistStyle.NORMAL,
221169
+ { overwrite: true }
221170
+ );
221171
+ addProjectTag(
221172
+ project,
221173
+ ProjectTagConstants.Platform.TAG_ID,
221174
+ project.targets?.build?.options.platform === "node" ? ProjectTagConstants.Platform.NODE : project.targets?.build?.options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : project.targets?.build?.options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
221175
+ { overwrite: false }
221176
+ );
221177
+ };
221178
+
221090
221179
  // packages/workspace-tools/src/utils/versions.ts
221091
221180
  var tsupVersion = "^7.2.0";
221092
221181
  var prettierPackageJsonVersion = "2.4.6";
@@ -221108,7 +221197,7 @@ var nodeVersion = "20.11.0";
221108
221197
  var pnpmVersion = "8.10.2";
221109
221198
 
221110
221199
  // packages/workspace-tools/src/base/typescript-library-generator.ts
221111
- async function typeScriptLibraryGeneratorFn(tree, schema) {
221200
+ async function typeScriptLibraryGeneratorFn(tree, schema, config) {
221112
221201
  const options = await normalizeOptions(tree, { ...schema });
221113
221202
  const tasks = [];
221114
221203
  tasks.push(
@@ -221145,6 +221234,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
221145
221234
  tsConfig: (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"),
221146
221235
  project: (0, import_devkit.joinPathFragments)(options.projectRoot, "package.json"),
221147
221236
  defaultConfiguration: "production",
221237
+ platform: "neutral",
221148
221238
  assets: [
221149
221239
  {
221150
221240
  input: options.projectRoot,
@@ -221168,21 +221258,25 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
221168
221258
  verbose: true
221169
221259
  }
221170
221260
  }
221171
- },
221172
- lint: {},
221173
- test: {}
221261
+ }
221174
221262
  }
221175
221263
  };
221176
- if (schema.platform && projectConfig?.targets?.build) {
221264
+ if (schema.platform) {
221177
221265
  projectConfig.targets.build.options.platform = schema.platform;
221178
221266
  }
221267
+ addProjectTag(
221268
+ projectConfig,
221269
+ ProjectTagConstants.Platform.TAG_ID,
221270
+ projectConfig.targets.build.options.platform === "node" ? ProjectTagConstants.Platform.NODE : projectConfig.targets.build.options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : projectConfig.targets.build.options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
221271
+ { overwrite: false }
221272
+ );
221179
221273
  createProjectTsConfigJson(tree, options);
221180
221274
  (0, import_devkit.addProjectConfiguration)(tree, options.name, projectConfig);
221181
221275
  let repository = {
221182
221276
  type: "github",
221183
- url: "https://github.com/storm-software/storm-stack.git"
221277
+ url: config?.repository || `https://github.com/${config?.organization || "storm-software"}/${config?.namespace || config?.name || "repository"}.git`
221184
221278
  };
221185
- let description = schema.description ?? "A package developed by Storm Software used to create modern, scalable web applications.";
221279
+ let description = schema.description || "A package developed by Storm Software used to create modern, scalable web applications.";
221186
221280
  if (tree.exists("package.json")) {
221187
221281
  const packageJson = (0, import_devkit.readJson)(tree, "package.json");
221188
221282
  if (packageJson?.repository) {
@@ -235546,7 +235640,7 @@ async function initGenerator(tree, schema) {
235546
235640
 
235547
235641
  // packages/workspace-tools/src/generators/node-library/generator.ts
235548
235642
  var import_devkit11 = require("@nx/devkit");
235549
- async function nodeLibraryGeneratorFn(tree, schema) {
235643
+ async function nodeLibraryGeneratorFn(tree, schema, config) {
235550
235644
  const filesDir = (0, import_devkit11.joinPathFragments)(__dirname, "./files");
235551
235645
  const tsLibraryGeneratorOptions = {
235552
235646
  ...schema,
@@ -235576,7 +235670,7 @@ async function nodeLibraryGeneratorFn(tree, schema) {
235576
235670
  buildable: options.bundler && options.bundler !== "none",
235577
235671
  hasUnitTestRunner: options.unitTestRunner !== "none"
235578
235672
  });
235579
- await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions);
235673
+ await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config);
235580
235674
  await (0, import_devkit11.formatFiles)(tree);
235581
235675
  return null;
235582
235676
  }
@@ -236872,86 +236966,6 @@ function isPostInstallProcess() {
236872
236966
  // packages/workspace-tools/src/utils/package-helpers.ts
236873
236967
  var import_devkit16 = require("@nx/devkit");
236874
236968
  var import_node_fs20 = require("node:fs");
236875
-
236876
- // packages/workspace-tools/src/utils/project-tags.ts
236877
- var ProjectTagConstants = {
236878
- Language: {
236879
- TAG_ID: "language",
236880
- TYPESCRIPT: "typescript",
236881
- RUST: "rust"
236882
- },
236883
- ProjectType: {
236884
- TAG_ID: "type",
236885
- LIBRARY: "library",
236886
- APPLICATION: "application"
236887
- },
236888
- DistStyle: {
236889
- TAG_ID: "dist-style",
236890
- NORMAL: "normal",
236891
- CLEAN: "clean"
236892
- },
236893
- Provider: {
236894
- TAG_ID: "provider"
236895
- },
236896
- Registry: {
236897
- TAG_ID: "registry",
236898
- CARGO: "cargo",
236899
- NPM: "npm",
236900
- CONTAINER: "container",
236901
- CYCLONE: "cyclone"
236902
- }
236903
- };
236904
- var formatProjectTag = (variant, value2) => {
236905
- return `${variant}:${value2}`;
236906
- };
236907
- var hasProjectTag = (project, variant) => {
236908
- project.tags = project.tags ?? [];
236909
- const prefix = formatProjectTag(variant, "");
236910
- return project.tags.some(
236911
- (tag) => tag.startsWith(prefix) && tag.length > prefix.length
236912
- );
236913
- };
236914
- var getProjectTag = (project, variant) => {
236915
- if (!hasProjectTag(project, variant)) {
236916
- return void 0;
236917
- }
236918
- project.tags = project.tags ?? [];
236919
- const prefix = formatProjectTag(variant, "");
236920
- const tag = project.tags.find((tag2) => tag2.startsWith(prefix));
236921
- return tag?.replace(prefix, "");
236922
- };
236923
- var isEqualProjectTag = (project, variant, value2) => {
236924
- const tag = getProjectTag(project, variant);
236925
- return !!(tag && tag?.toUpperCase() === value2.toUpperCase());
236926
- };
236927
- var addProjectTag = (project, variant, value2, options = {
236928
- overwrite: false
236929
- }) => {
236930
- project.tags = project.tags ?? [];
236931
- if (options.overwrite || !hasProjectTag(project, variant)) {
236932
- project.tags = project.tags.filter(
236933
- (tag) => !tag.startsWith(formatProjectTag(variant, ""))
236934
- );
236935
- project.tags.push(formatProjectTag(variant, value2));
236936
- }
236937
- };
236938
- var setDefaultProjectTags = (project) => {
236939
- project.tags = project.tags ?? [];
236940
- addProjectTag(
236941
- project,
236942
- ProjectTagConstants.ProjectType.TAG_ID,
236943
- project.projectType === "application" ? ProjectTagConstants.ProjectType.APPLICATION : ProjectTagConstants.ProjectType.LIBRARY,
236944
- { overwrite: true }
236945
- );
236946
- addProjectTag(
236947
- project,
236948
- ProjectTagConstants.DistStyle.TAG_ID,
236949
- project.targets && Object.keys(project.targets).includes("clean-package") ? ProjectTagConstants.DistStyle.CLEAN : ProjectTagConstants.DistStyle.NORMAL,
236950
- { overwrite: true }
236951
- );
236952
- };
236953
-
236954
- // packages/workspace-tools/src/utils/package-helpers.ts
236955
236969
  var PackageManagerTypes = {
236956
236970
  PackageJson: "package.json",
236957
236971
  CargoToml: "Cargo.toml"