@storm-software/workspace-tools 1.202.0 → 1.203.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.
@@ -67720,6 +67720,63 @@ var import_js = require("@nx/js");
67720
67720
  var import_init = __toESM(require("@nx/js/src/generators/init/init"));
67721
67721
  var import_generator = __toESM(require("@nx/js/src/generators/setup-verdaccio/generator"));
67722
67722
 
67723
+ // packages/workspace-tools/src/utils/project-tags.ts
67724
+ var ProjectTagConstants = {
67725
+ Language: {
67726
+ TAG_ID: "language",
67727
+ TYPESCRIPT: "typescript",
67728
+ RUST: "rust"
67729
+ },
67730
+ ProjectType: {
67731
+ TAG_ID: "type",
67732
+ LIBRARY: "library",
67733
+ APPLICATION: "application"
67734
+ },
67735
+ DistStyle: {
67736
+ TAG_ID: "dist-style",
67737
+ NORMAL: "normal",
67738
+ CLEAN: "clean"
67739
+ },
67740
+ Provider: {
67741
+ TAG_ID: "provider"
67742
+ },
67743
+ Platform: {
67744
+ TAG_ID: "platform",
67745
+ NODE: "node",
67746
+ BROWSER: "browser",
67747
+ NEUTRAL: "neutral",
67748
+ WORKER: "worker"
67749
+ },
67750
+ Registry: {
67751
+ TAG_ID: "registry",
67752
+ CARGO: "cargo",
67753
+ NPM: "npm",
67754
+ CONTAINER: "container",
67755
+ CYCLONE: "cyclone"
67756
+ }
67757
+ };
67758
+ var formatProjectTag = (variant, value2) => {
67759
+ return `${variant}:${value2}`;
67760
+ };
67761
+ var hasProjectTag = (project, variant) => {
67762
+ project.tags = project.tags ?? [];
67763
+ const prefix = formatProjectTag(variant, "");
67764
+ return project.tags.some(
67765
+ (tag) => tag.startsWith(prefix) && tag.length > prefix.length
67766
+ );
67767
+ };
67768
+ var addProjectTag = (project, variant, value2, options = {
67769
+ overwrite: false
67770
+ }) => {
67771
+ project.tags = project.tags ?? [];
67772
+ if (options.overwrite || !hasProjectTag(project, variant)) {
67773
+ project.tags = project.tags.filter(
67774
+ (tag) => !tag.startsWith(formatProjectTag(variant, ""))
67775
+ );
67776
+ project.tags.push(formatProjectTag(variant, value2));
67777
+ }
67778
+ };
67779
+
67723
67780
  // packages/workspace-tools/src/utils/versions.ts
67724
67781
  var typesNodeVersion = "20.9.0";
67725
67782
  var nxVersion = "^18.0.4";
@@ -67762,6 +67819,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
67762
67819
  tsConfig: (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"),
67763
67820
  project: (0, import_devkit.joinPathFragments)(options.projectRoot, "package.json"),
67764
67821
  defaultConfiguration: "production",
67822
+ platform: "neutral",
67765
67823
  assets: [
67766
67824
  {
67767
67825
  input: options.projectRoot,
@@ -67785,21 +67843,25 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
67785
67843
  verbose: true
67786
67844
  }
67787
67845
  }
67788
- },
67789
- lint: {},
67790
- test: {}
67846
+ }
67791
67847
  }
67792
67848
  };
67793
- if (schema.platform && projectConfig?.targets?.build) {
67849
+ if (schema.platform) {
67794
67850
  projectConfig.targets.build.options.platform = schema.platform;
67795
67851
  }
67852
+ addProjectTag(
67853
+ projectConfig,
67854
+ ProjectTagConstants.Platform.TAG_ID,
67855
+ 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,
67856
+ { overwrite: true }
67857
+ );
67796
67858
  createProjectTsConfigJson(tree, options);
67797
67859
  (0, import_devkit.addProjectConfiguration)(tree, options.name, projectConfig);
67798
67860
  let repository = {
67799
67861
  type: "github",
67800
67862
  url: "https://github.com/storm-software/storm-stack.git"
67801
67863
  };
67802
- let description = schema.description ?? "\u26A1 A Storm package used to create modern, scalable web applications.";
67864
+ let description = schema.description ?? "A package developed by Storm Software used to create modern, scalable web applications.";
67803
67865
  if (tree.exists("package.json")) {
67804
67866
  const packageJson = (0, import_devkit.readJson)(tree, "package.json");
67805
67867
  if (packageJson?.repository) {
@@ -67908,96 +67970,9 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
67908
67970
  exclude: ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
67909
67971
  });
67910
67972
  }
67911
- const lintCallback = await addLint(tree, options);
67912
- tasks.push(lintCallback);
67913
67973
  await (0, import_devkit.formatFiles)(tree);
67914
67974
  return null;
67915
67975
  }
67916
- async function addLint(tree, options) {
67917
- const { lintProjectGenerator } = (0, import_devkit.ensurePackage)("@nx/eslint", nxVersion);
67918
- const { mapLintPattern } = (
67919
- // eslint-disable-next-line @typescript-eslint/no-var-requires
67920
- require("@nx/eslint/src/generators/lint-project/lint-project")
67921
- );
67922
- const projectConfiguration = (0, import_devkit.readProjectConfiguration)(tree, options.name);
67923
- const task = lintProjectGenerator(tree, {
67924
- project: options.name,
67925
- linter: options.linter,
67926
- skipFormat: true,
67927
- tsConfigPaths: [(0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json")],
67928
- unitTestRunner: options.unitTestRunner,
67929
- eslintFilePatterns: [
67930
- mapLintPattern(
67931
- options.projectRoot,
67932
- options.js ? "js" : "ts",
67933
- options.rootProject
67934
- )
67935
- ],
67936
- setParserOptionsProject: options.setParserOptionsProject,
67937
- rootProject: options.rootProject
67938
- });
67939
- const {
67940
- addOverrideToLintConfig,
67941
- lintConfigHasOverride,
67942
- isEslintConfigSupported,
67943
- updateOverrideInLintConfig
67944
- // eslint-disable-next-line @typescript-eslint/no-var-requires
67945
- } = require("@nx/eslint/src/generators/utils/eslint-file");
67946
- if (!isEslintConfigSupported(tree)) {
67947
- return task;
67948
- }
67949
- addOverrideToLintConfig(tree, "", {
67950
- files: ["*.json"],
67951
- parser: "jsonc-eslint-parser",
67952
- rules: {
67953
- "@nx/dependency-checks": [
67954
- "error",
67955
- {
67956
- "buildTargets": ["build"],
67957
- "ignoredFiles": [
67958
- "{projectRoot}/esbuild.config.{js,ts,mjs,mts}",
67959
- "{projectRoot}/jest.config.ts"
67960
- ],
67961
- "checkMissingDependencies": true,
67962
- "checkObsoleteDependencies": true,
67963
- "checkVersionMismatches": false
67964
- }
67965
- ]
67966
- }
67967
- });
67968
- if (lintConfigHasOverride(
67969
- tree,
67970
- projectConfiguration.root,
67971
- (o) => Array.isArray(o.files) ? o.files.some((f2) => f2.match(/\.json$/)) : !!o.files?.match(/\.json$/),
67972
- true
67973
- )) {
67974
- updateOverrideInLintConfig(
67975
- tree,
67976
- projectConfiguration.root,
67977
- (o) => o.rules?.["@nx/dependency-checks"],
67978
- (o) => {
67979
- const value2 = o.rules["@nx/dependency-checks"];
67980
- let ruleSeverity;
67981
- let ruleOptions;
67982
- if (Array.isArray(value2)) {
67983
- ruleSeverity = value2[0];
67984
- ruleOptions = value2[1];
67985
- } else {
67986
- ruleSeverity = value2 ?? "error";
67987
- ruleOptions = {};
67988
- }
67989
- if (options.bundler === "esbuild") {
67990
- ruleOptions.ignoredFiles = [
67991
- "{projectRoot}/esbuild.config.{js,ts,mjs,mts}"
67992
- ];
67993
- o.rules["@nx/dependency-checks"] = [ruleSeverity, ruleOptions];
67994
- }
67995
- return o;
67996
- }
67997
- );
67998
- }
67999
- return task;
68000
- }
68001
67976
  function getOutputPath(options) {
68002
67977
  const parts = ["dist"];
68003
67978
  if (options.projectRoot === ".") {
@@ -68101,7 +68076,7 @@ async function nodeLibraryGeneratorFn(tree, schema) {
68101
68076
  devDependencies: {
68102
68077
  "@types/node": typesNodeVersion
68103
68078
  },
68104
- buildExecutor: "@storm-software/workspace-tools:tsup-node"
68079
+ buildExecutor: "@storm-software/workspace-tools:unbuild"
68105
68080
  };
68106
68081
  const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
68107
68082
  const { className, name, propertyName } = (0, import_devkit2.names)(
@@ -101,6 +101,13 @@ var ProjectTagConstants = {
101
101
  Provider: {
102
102
  TAG_ID: "provider"
103
103
  },
104
+ Platform: {
105
+ TAG_ID: "platform",
106
+ NODE: "node",
107
+ BROWSER: "browser",
108
+ NEUTRAL: "neutral",
109
+ WORKER: "worker"
110
+ },
104
111
  Registry: {
105
112
  TAG_ID: "registry",
106
113
  CARGO: "cargo",
@@ -51,6 +51,13 @@ var ProjectTagConstants = {
51
51
  Provider: {
52
52
  TAG_ID: "provider"
53
53
  },
54
+ Platform: {
55
+ TAG_ID: "platform",
56
+ NODE: "node",
57
+ BROWSER: "browser",
58
+ NEUTRAL: "neutral",
59
+ WORKER: "worker"
60
+ },
54
61
  Registry: {
55
62
  TAG_ID: "registry",
56
63
  CARGO: "cargo",
@@ -91244,6 +91244,13 @@ var ProjectTagConstants = {
91244
91244
  Provider: {
91245
91245
  TAG_ID: "provider"
91246
91246
  },
91247
+ Platform: {
91248
+ TAG_ID: "platform",
91249
+ NODE: "node",
91250
+ BROWSER: "browser",
91251
+ NEUTRAL: "neutral",
91252
+ WORKER: "worker"
91253
+ },
91247
91254
  Registry: {
91248
91255
  TAG_ID: "registry",
91249
91256
  CARGO: "cargo",
@@ -1,5 +1,5 @@
1
1
  import { ProjectConfiguration } from "@nx/devkit";
2
- import { ProjectTagDistStyleValue, ProjectTagLanguageValue, ProjectTagRegistryValue, ProjectTagTypeValue, ProjectTagVariant } from "../../declarations.d";
2
+ import { ProjectTagDistStyleValue, ProjectTagLanguageValue, ProjectTagPlatformValue, ProjectTagRegistryValue, ProjectTagTypeValue, ProjectTagVariant } from "../../declarations.d";
3
3
  export declare const ProjectTagConstants: {
4
4
  readonly Language: {
5
5
  readonly TAG_ID: ProjectTagVariant;
@@ -19,6 +19,13 @@ export declare const ProjectTagConstants: {
19
19
  readonly Provider: {
20
20
  readonly TAG_ID: ProjectTagVariant;
21
21
  };
22
+ readonly Platform: {
23
+ readonly TAG_ID: ProjectTagVariant;
24
+ readonly NODE: ProjectTagPlatformValue;
25
+ readonly BROWSER: ProjectTagPlatformValue;
26
+ readonly NEUTRAL: ProjectTagPlatformValue;
27
+ readonly WORKER: ProjectTagPlatformValue;
28
+ };
22
29
  readonly Registry: {
23
30
  readonly TAG_ID: ProjectTagVariant;
24
31
  readonly CARGO: ProjectTagRegistryValue;
@@ -47,6 +47,13 @@ var ProjectTagConstants = {
47
47
  Provider: {
48
48
  TAG_ID: "provider"
49
49
  },
50
+ Platform: {
51
+ TAG_ID: "platform",
52
+ NODE: "node",
53
+ BROWSER: "browser",
54
+ NEUTRAL: "neutral",
55
+ WORKER: "worker"
56
+ },
50
57
  Registry: {
51
58
  TAG_ID: "registry",
52
59
  CARGO: "cargo",