@storm-software/workspace-tools 1.60.23 → 1.61.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.
@@ -385842,7 +385842,7 @@ var init_get_log_level = __esm({
385842
385842
  return LogLevel.INFO;
385843
385843
  }
385844
385844
  };
385845
- getLogLevelLabel = (logLevel) => {
385845
+ getLogLevelLabel = (logLevel = LogLevel.INFO) => {
385846
385846
  if (logLevel >= LogLevel.ALL) {
385847
385847
  return LogLevelLabel.ALL;
385848
385848
  }
@@ -386168,14 +386168,14 @@ var init_set_env = __esm({
386168
386168
  if (extension[key2]) {
386169
386169
  const result = key2?.replace(
386170
386170
  /([A-Z])+/g,
386171
- (input) => input ? input[0].toUpperCase() + input.slice(1) : ""
386171
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
386172
386172
  ).split(/(?=[A-Z])|[\.\-\s_]/).map((x5) => x5.toLowerCase()) ?? [];
386173
386173
  let extensionKey;
386174
386174
  if (result.length === 0) {
386175
386175
  return;
386176
386176
  }
386177
386177
  if (result.length === 1) {
386178
- extensionKey = result[0].toUpperCase();
386178
+ extensionKey = result[0]?.toUpperCase() ?? "";
386179
386179
  } else {
386180
386180
  extensionKey = result.reduce((ret, part) => {
386181
386181
  return `${ret}_${part.toLowerCase()}`;
@@ -400841,7 +400841,7 @@ var applyWorkspaceGeneratorTokens = (option, tokenizerOptions) => {
400841
400841
  if (result.includes("{workspaceRoot}")) {
400842
400842
  result = result.replaceAll(
400843
400843
  "{workspaceRoot}",
400844
- tokenizerOptions.workspaceRoot ?? tokenizerOptions.config.workspaceRoot ?? findWorkspaceRootSafe()
400844
+ tokenizerOptions.workspaceRoot ?? tokenizerOptions.config?.workspaceRoot ?? findWorkspaceRoot()
400845
400845
  );
400846
400846
  }
400847
400847
  return result;
@@ -400902,7 +400902,7 @@ ${Object.keys(process.env).map((key2) => ` - ${key2}=${JSON.stringify(process.en
400902
400902
  writeTrace(
400903
400903
  config,
400904
400904
  `Generator schema options \u2699\uFE0F
400905
- ${Object.keys(options8).map((key2) => ` - ${key2}=${JSON.stringify(options8[key2])}`).join("\n")}`
400905
+ ${Object.keys(options8 ?? {}).map((key2) => ` - ${key2}=${JSON.stringify(options8[key2])}`).join("\n")}`
400906
400906
  );
400907
400907
  const tokenized = applyWorkspaceTokens(
400908
400908
  options8,
@@ -400988,7 +400988,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema2) {
400988
400988
  const projectConfig = {
400989
400989
  root: options8.directory,
400990
400990
  projectType: "library",
400991
- sourceRoot: (0, import_devkit.joinPathFragments)(options8.directory, "src"),
400991
+ sourceRoot: (0, import_devkit.joinPathFragments)(options8.directory ?? "", "src"),
400992
400992
  targets: {
400993
400993
  build: {
400994
400994
  executor: schema2.buildExecutor,
@@ -401027,7 +401027,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema2) {
401027
401027
  test: {}
401028
401028
  }
401029
401029
  };
401030
- if (schema2.platform) {
401030
+ if (schema2.platform && projectConfig?.targets?.build) {
401031
401031
  projectConfig.targets.build.options.platform = schema2.platform;
401032
401032
  }
401033
401033
  createProjectTsConfigJson(tree, options8);
@@ -401046,9 +401046,15 @@ async function typeScriptLibraryGeneratorFn(tree, schema2) {
401046
401046
  description = packageJson.description;
401047
401047
  }
401048
401048
  }
401049
+ if (!options8.importPath) {
401050
+ options8.importPath = options8.name;
401051
+ }
401049
401052
  const packageJsonPath = (0, import_devkit.joinPathFragments)(options8.projectRoot, "package.json");
401050
401053
  if (tree.exists(packageJsonPath)) {
401051
401054
  (0, import_devkit.updateJson)(tree, packageJsonPath, (json2) => {
401055
+ if (!options8.importPath) {
401056
+ options8.importPath = options8.name;
401057
+ }
401052
401058
  json2.name = options8.importPath;
401053
401059
  json2.version = "0.0.1";
401054
401060
  if (json2.private && (options8.publishable || options8.rootProject)) {
@@ -401087,14 +401093,14 @@ async function typeScriptLibraryGeneratorFn(tree, schema2) {
401087
401093
  }
401088
401094
  });
401089
401095
  }
401090
- if (tree.exists("package.json")) {
401096
+ if (tree.exists("package.json") && options8.importPath) {
401091
401097
  (0, import_devkit.updateJson)(tree, "package.json", (json2) => ({
401092
401098
  ...json2,
401093
401099
  pnpm: {
401094
401100
  ...json2?.pnpm,
401095
401101
  overrides: {
401096
401102
  ...json2?.pnpm?.overrides,
401097
- [options8.importPath]: "workspace:*"
401103
+ [options8.importPath ?? ""]: "workspace:*"
401098
401104
  }
401099
401105
  }
401100
401106
  }));
@@ -401193,7 +401199,7 @@ async function addLint(tree, options8) {
401193
401199
  ruleSeverity = value[0];
401194
401200
  ruleOptions = value[1];
401195
401201
  } else {
401196
- ruleSeverity = value;
401202
+ ruleSeverity = value ?? "error";
401197
401203
  ruleOptions = {};
401198
401204
  }
401199
401205
  if (options8.bundler === "esbuild") {
@@ -385842,7 +385842,7 @@ var init_get_log_level = __esm({
385842
385842
  return LogLevel.INFO;
385843
385843
  }
385844
385844
  };
385845
- getLogLevelLabel = (logLevel) => {
385845
+ getLogLevelLabel = (logLevel = LogLevel.INFO) => {
385846
385846
  if (logLevel >= LogLevel.ALL) {
385847
385847
  return LogLevelLabel.ALL;
385848
385848
  }
@@ -386168,14 +386168,14 @@ var init_set_env = __esm({
386168
386168
  if (extension[key2]) {
386169
386169
  const result = key2?.replace(
386170
386170
  /([A-Z])+/g,
386171
- (input) => input ? input[0].toUpperCase() + input.slice(1) : ""
386171
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
386172
386172
  ).split(/(?=[A-Z])|[\.\-\s_]/).map((x5) => x5.toLowerCase()) ?? [];
386173
386173
  let extensionKey;
386174
386174
  if (result.length === 0) {
386175
386175
  return;
386176
386176
  }
386177
386177
  if (result.length === 1) {
386178
- extensionKey = result[0].toUpperCase();
386178
+ extensionKey = result[0]?.toUpperCase() ?? "";
386179
386179
  } else {
386180
386180
  extensionKey = result.reduce((ret, part) => {
386181
386181
  return `${ret}_${part.toLowerCase()}`;
@@ -386485,7 +386485,7 @@ var applyWorkspaceGeneratorTokens = (option, tokenizerOptions) => {
386485
386485
  if (result.includes("{workspaceRoot}")) {
386486
386486
  result = result.replaceAll(
386487
386487
  "{workspaceRoot}",
386488
- tokenizerOptions.workspaceRoot ?? tokenizerOptions.config.workspaceRoot ?? findWorkspaceRootSafe()
386488
+ tokenizerOptions.workspaceRoot ?? tokenizerOptions.config?.workspaceRoot ?? findWorkspaceRoot()
386489
386489
  );
386490
386490
  }
386491
386491
  return result;
@@ -386546,7 +386546,7 @@ ${Object.keys(process.env).map((key2) => ` - ${key2}=${JSON.stringify(process.en
386546
386546
  writeTrace(
386547
386547
  config,
386548
386548
  `Generator schema options \u2699\uFE0F
386549
- ${Object.keys(options8).map((key2) => ` - ${key2}=${JSON.stringify(options8[key2])}`).join("\n")}`
386549
+ ${Object.keys(options8 ?? {}).map((key2) => ` - ${key2}=${JSON.stringify(options8[key2])}`).join("\n")}`
386550
386550
  );
386551
386551
  const tokenized = applyWorkspaceTokens(
386552
386552
  options8,
@@ -385842,7 +385842,7 @@ var init_get_log_level = __esm({
385842
385842
  return LogLevel.INFO;
385843
385843
  }
385844
385844
  };
385845
- getLogLevelLabel = (logLevel) => {
385845
+ getLogLevelLabel = (logLevel = LogLevel.INFO) => {
385846
385846
  if (logLevel >= LogLevel.ALL) {
385847
385847
  return LogLevelLabel.ALL;
385848
385848
  }
@@ -386168,14 +386168,14 @@ var init_set_env = __esm({
386168
386168
  if (extension[key2]) {
386169
386169
  const result = key2?.replace(
386170
386170
  /([A-Z])+/g,
386171
- (input) => input ? input[0].toUpperCase() + input.slice(1) : ""
386171
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
386172
386172
  ).split(/(?=[A-Z])|[\.\-\s_]/).map((x5) => x5.toLowerCase()) ?? [];
386173
386173
  let extensionKey;
386174
386174
  if (result.length === 0) {
386175
386175
  return;
386176
386176
  }
386177
386177
  if (result.length === 1) {
386178
- extensionKey = result[0].toUpperCase();
386178
+ extensionKey = result[0]?.toUpperCase() ?? "";
386179
386179
  } else {
386180
386180
  extensionKey = result.reduce((ret, part) => {
386181
386181
  return `${ret}_${part.toLowerCase()}`;
@@ -388953,7 +388953,7 @@ var applyWorkspaceGeneratorTokens = (option, tokenizerOptions) => {
388953
388953
  if (result.includes("{workspaceRoot}")) {
388954
388954
  result = result.replaceAll(
388955
388955
  "{workspaceRoot}",
388956
- tokenizerOptions.workspaceRoot ?? tokenizerOptions.config.workspaceRoot ?? findWorkspaceRootSafe()
388956
+ tokenizerOptions.workspaceRoot ?? tokenizerOptions.config?.workspaceRoot ?? findWorkspaceRoot()
388957
388957
  );
388958
388958
  }
388959
388959
  return result;
@@ -389014,7 +389014,7 @@ ${Object.keys(process.env).map((key2) => ` - ${key2}=${JSON.stringify(process.en
389014
389014
  writeTrace(
389015
389015
  config,
389016
389016
  `Generator schema options \u2699\uFE0F
389017
- ${Object.keys(options8).map((key2) => ` - ${key2}=${JSON.stringify(options8[key2])}`).join("\n")}`
389017
+ ${Object.keys(options8 ?? {}).map((key2) => ` - ${key2}=${JSON.stringify(options8[key2])}`).join("\n")}`
389018
389018
  );
389019
389019
  const tokenized = applyWorkspaceTokens(
389020
389020
  options8,
@@ -389091,8 +389091,8 @@ Valid values are: ${import_version.validReleaseVersionPrefixes.map((s) => `"${s}
389091
389091
  }
389092
389092
  const projects = options8.projects;
389093
389093
  const createResolvePackageRoot = (customPackageRoot) => (projectNode) => {
389094
- if (projectNode?.data?.root === config.workspaceRoot || projectNode?.data?.root === ".") {
389095
- return config.workspaceRoot;
389094
+ if (projectNode?.data?.root === config?.workspaceRoot || projectNode?.data?.root === ".") {
389095
+ return config?.workspaceRoot ?? findWorkspaceRoot();
389096
389096
  }
389097
389097
  if (!customPackageRoot) {
389098
389098
  return projectNode.data.root;
@@ -389108,15 +389108,18 @@ Valid values are: ${import_version.validReleaseVersionPrefixes.map((s) => `"${s}
389108
389108
  for (const project of projects) {
389109
389109
  projectNameToPackageRootMap.set(project.name, resolvePackageRoot(project));
389110
389110
  }
389111
- let currentVersion;
389111
+ let currentVersion = null;
389112
389112
  let currentVersionResolvedFromFallback = false;
389113
- let latestMatchingGitTag;
389113
+ let latestMatchingGitTag = null;
389114
389114
  let specifier = options8.specifier ? options8.specifier : void 0;
389115
389115
  for (const project of projects) {
389116
389116
  const projectName = project.name;
389117
389117
  const packageRoot = projectNameToPackageRootMap.get(projectName);
389118
- const packageJsonPath = (0, import_devkit.joinPathFragments)(packageRoot, "package.json");
389119
- const workspaceRelativePackageJsonPath = (0, import_node_path4.relative)(config.workspaceRoot, packageJsonPath);
389118
+ const packageJsonPath = (0, import_devkit.joinPathFragments)(packageRoot ?? "./", "package.json");
389119
+ const workspaceRelativePackageJsonPath = (0, import_node_path4.relative)(
389120
+ config?.workspaceRoot ?? findWorkspaceRoot(),
389121
+ packageJsonPath
389122
+ );
389120
389123
  const log = (msg) => {
389121
389124
  writeInfo(config, `${projectName}: ${msg}`);
389122
389125
  };
@@ -389138,7 +389141,7 @@ To fix this you will either need to add a package.json file at that location, or
389138
389141
  const metadata = options8.currentVersionResolverMetadata;
389139
389142
  const registry = metadata?.registry ?? await getNpmRegistry() ?? "https://registry.npmjs.org";
389140
389143
  const tag = metadata?.tag ?? "latest";
389141
- if (!currentVersion || options8.releaseGroup.projectsRelationship === "independent") {
389144
+ if (options8.releaseGroup.projectsRelationship === "independent") {
389142
389145
  try {
389143
389146
  currentVersion = await new Promise((resolve3, reject) => {
389144
389147
  (0, import_node_child_process2.exec)(
@@ -389188,8 +389191,10 @@ To fix this you will either need to add a package.json file at that location, or
389188
389191
  log(`\u{1F4C4} Resolved the current version as ${currentVersion} from ${packageJsonPath}`);
389189
389192
  break;
389190
389193
  case "git-tag": {
389191
- if (!currentVersion || // We always need to independently resolve the current version from git tag per project if the projects are independent
389192
- options8.releaseGroup.projectsRelationship === "independent") {
389194
+ if (
389195
+ // We always need to independently resolve the current version from git tag per project if the projects are independent
389196
+ options8.releaseGroup.projectsRelationship === "independent"
389197
+ ) {
389193
389198
  const releaseTagPattern = options8.releaseGroup.releaseTagPattern;
389194
389199
  latestMatchingGitTag = await (0, import_git.getLatestGitTagForPattern)(releaseTagPattern, {
389195
389200
  projectName: project.name
@@ -389255,7 +389260,7 @@ To fix this you will either need to add a package.json file at that location, or
389255
389260
  previousVersionRef,
389256
389261
  options8.projectGraph,
389257
389262
  affectedProjects
389258
- );
389263
+ ) ?? void 0;
389259
389264
  if (!specifier) {
389260
389265
  log(
389261
389266
  "\u{1F6AB} No changes were detected using git history and the conventional commits standard."
@@ -389310,7 +389315,7 @@ To fix this you will either need to add a package.json file at that location, or
389310
389315
  tree,
389311
389316
  options8.projectGraph,
389312
389317
  projects.filter(
389313
- (project2) => project2?.data?.root && project2?.data?.root !== config.workspaceRoot
389318
+ (project2) => project2?.data?.root && project2?.data?.root !== config?.workspaceRoot
389314
389319
  ),
389315
389320
  projectNameToPackageRootMap,
389316
389321
  resolvePackageRoot,
@@ -389321,7 +389326,7 @@ To fix this you will either need to add a package.json file at that location, or
389321
389326
  return localPackageDependency.target === project.name;
389322
389327
  });
389323
389328
  versionData[projectName] = {
389324
- currentVersion,
389329
+ currentVersion: currentVersion ? currentVersion : "0.0.1",
389325
389330
  dependentProjects,
389326
389331
  newVersion: null
389327
389332
  // will stay as null in the final result in the case that no changes are detected
@@ -389330,8 +389335,13 @@ To fix this you will either need to add a package.json file at that location, or
389330
389335
  log(`\u{1F6AB} Skipping versioning "${projectPackageJson.name}" as no changes were detected.`);
389331
389336
  continue;
389332
389337
  }
389338
+ if (!currentVersion) {
389339
+ throw new Error(`Unable to determine the current version for project "${projectName}"`);
389340
+ }
389333
389341
  const newVersion = (0, import_version.deriveNewSemverVersion)(currentVersion, specifier, options8.preid);
389334
- versionData[projectName].newVersion = newVersion;
389342
+ if (versionData[projectName]) {
389343
+ versionData[projectName].newVersion = newVersion;
389344
+ }
389335
389345
  (0, import_devkit.writeJson)(tree, packageJsonPath, {
389336
389346
  ...projectPackageJson,
389337
389347
  version: newVersion
@@ -389345,7 +389355,10 @@ To fix this you will either need to add a package.json file at that location, or
389345
389355
  for (const dependentProject of dependentProjects) {
389346
389356
  (0, import_devkit.updateJson)(
389347
389357
  tree,
389348
- (0, import_devkit.joinPathFragments)(projectNameToPackageRootMap.get(dependentProject.source), "package.json"),
389358
+ (0, import_devkit.joinPathFragments)(
389359
+ projectNameToPackageRootMap.get(dependentProject.source) ?? "./",
389360
+ "package.json"
389361
+ ),
389349
389362
  (json2) => {
389350
389363
  let versionPrefix = options8.versionPrefix ?? "auto";
389351
389364
  if (versionPrefix === "auto") {