@storm-software/workspace-tools 1.41.1 → 1.42.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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.41.1](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.41.0...workspace-tools-v1.41.1) (2024-01-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **workspace-tools:** Cleaned up dependanies and option defaulting in tsup ([0ae0dd3](https://github.com/storm-software/storm-ops/commit/0ae0dd327ed646e6dbcd1c33b44aef820403cd77))
7
+
1
8
  # [1.41.0](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.40.1...workspace-tools-v1.41.0) (2024-01-14)
2
9
 
3
10
 
package/README.md CHANGED
@@ -16,7 +16,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
16
16
 
17
17
  <h3 align="center">💻 Visit <a href="https://stormsoftware.org" target="_blank">stormsoftware.org</a> to stay up to date with this developer</h3><br />
18
18
 
19
- [![Version](https://img.shields.io/badge/version-1.39.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
19
+ [![Version](https://img.shields.io/badge/version-1.41.1-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
20
20
  [![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with docusaurus](https://img.shields.io/badge/documented_with-docusaurus-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://docusaurus.io/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
21
21
 
22
22
  <h3 align="center" bold="true">⚠️ <b>Attention</b> ⚠️ This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be availible through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.</h3><br />
package/config/nx.json CHANGED
@@ -4,9 +4,6 @@
4
4
  "affected": {
5
5
  "defaultBase": "main"
6
6
  },
7
- "workspaceLayout": {
8
- "projectNameAndRootFormat": "as-provided"
9
- },
10
7
  "tasksRunnerOptions": {
11
8
  "default": {
12
9
  "runner": "nx/tasks-runners/default",
@@ -26,9 +23,12 @@
26
23
  "namedInputs": {
27
24
  "globalBuildAffectingConfig": [
28
25
  "{workspaceRoot}/tsconfig.base.json",
29
- "{workspaceRoot}/package.json"
26
+ "{workspaceRoot}/package.json",
27
+ "{workspaceRoot}/storm.json"
30
28
  ],
31
29
  "globalNonBuildAffectingConfig": [
30
+ "{workspaceRoot}/**/biome.json",
31
+ "{workspaceRoot}/**/lefthook.json",
32
32
  "{workspaceRoot}/.log4brains.yml",
33
33
  "{workspaceRoot}/.eslintrc.json",
34
34
  "{workspaceRoot}/.all-contributorsrc",
@@ -81,20 +81,15 @@
81
81
  },
82
82
  "lint": {
83
83
  "cache": true,
84
- "executor": "@nx/eslint:lint",
84
+ "executor": "nx:run-commands",
85
85
  "outputs": ["{options.outputFile}"],
86
86
  "options": {
87
- "lintFilePatterns": [
88
- "{projectRoot}/**/*.ts",
89
- "{projectRoot}/package.json"
90
- ]
87
+ "commands": [
88
+ "npx biome lint --apply --no-errors-on-unmatched --files-ignore-unknown=true {projectRoot}"
89
+ ],
90
+ "color": true
91
91
  },
92
- "inputs": [
93
- "default",
94
- "{workspaceRoot}/.eslintrc.json",
95
- "{workspaceRoot}/.eslintignore",
96
- "{workspaceRoot}/eslint.config.js"
97
- ]
92
+ "inputs": ["default", "{workspaceRoot}/**/biome.json"]
98
93
  },
99
94
  "test": {
100
95
  "cache": true,
package/index.js CHANGED
@@ -127893,7 +127893,9 @@ var getConfigFile = async (filePath) => {
127893
127893
  return void 0;
127894
127894
  }
127895
127895
  const config = cosmiconfigResult.config ?? {};
127896
- cosmiconfigResult.filepath && (config.configFile = cosmiconfigResult.filepath);
127896
+ if (cosmiconfigResult.filepath) {
127897
+ config.configFile = cosmiconfigResult.filepath;
127898
+ }
127897
127899
  config.runtimeVersion = "0.0.1";
127898
127900
  _static_cache = config;
127899
127901
  return config;
@@ -132674,6 +132676,8 @@ ${commentStart} ----------------------------------------------------------------
132674
132676
  };
132675
132677
 
132676
132678
  // packages/workspace-tools/src/executors/tsup/executor.ts
132679
+ var import_fs4 = require("fs");
132680
+ var import_path4 = require("path");
132677
132681
  var import_esbuild_decorators = __toESM(require_src2());
132678
132682
  var import_devkit3 = __toESM(require_devkit());
132679
132683
  var import_js2 = __toESM(require_src());
@@ -132722,7 +132726,6 @@ var environmentPlugin = (data) => ({
132722
132726
  });
132723
132727
 
132724
132728
  // packages/workspace-tools/src/executors/tsup/executor.ts
132725
- var import_fs4 = require("fs");
132726
132729
  var import_fs_extra = __toESM(require_lib6());
132727
132730
  var import_promises2 = require("fs/promises");
132728
132731
 
@@ -138902,7 +138905,6 @@ glob.glob = glob;
138902
138905
 
138903
138906
  // packages/workspace-tools/src/executors/tsup/executor.ts
138904
138907
  var import_fileutils = require("nx/src/utils/fileutils");
138905
- var import_path4 = require("path");
138906
138908
  var import_prettier = require("prettier");
138907
138909
  var import_tsup = __toESM(require_dist6());
138908
138910
  var ts = __toESM(require("typescript"));
@@ -138984,10 +138986,10 @@ var import_transform = __toESM(require_transform());
138984
138986
  var getTypiaTransform = (program, diagnostics) => (0, import_transform.default)(program, {}, { addDiagnostic: (input) => diagnostics.push(input) });
138985
138987
 
138986
138988
  // packages/workspace-tools/src/executors/tsup/executor.ts
138987
- async function tsupExecutorFn(options, context) {
138989
+ async function tsupExecutorFn(options, context, config) {
138988
138990
  try {
138989
138991
  console.log("\u{1F4E6} Running Storm build executor on the workspace");
138990
- options.verbose && console.log(
138992
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.log(
138991
138993
  `\u2699\uFE0F Executor options:
138992
138994
  ${Object.keys(options).map(
138993
138995
  (key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
@@ -139003,7 +139005,9 @@ ${Object.keys(options).map(
139003
139005
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
139004
139006
  const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
139005
139007
  if (options.clean !== false) {
139006
- console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
139008
+ if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
139009
+ console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
139010
+ }
139007
139011
  (0, import_fs_extra.removeSync)(options.outputPath);
139008
139012
  }
139009
139013
  const assets = Array.from(options.assets);
@@ -139072,11 +139076,15 @@ ${Object.keys(options).map(
139072
139076
  const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
139073
139077
  const internalDependencies = [];
139074
139078
  const projectConfigs = await Promise.resolve(getProjectConfigurations());
139075
- console.log("Project Configs:");
139076
- console.log(projectConfigs);
139079
+ if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
139080
+ console.log("Project Configs:");
139081
+ console.log(projectConfigs);
139082
+ }
139077
139083
  if (implicitDependencies && implicitDependencies.length > 0) {
139078
139084
  options.external = implicitDependencies.reduce((ret, key) => {
139079
- console.log(`\u26A1 Adding implicit dependency: ${key}`);
139085
+ if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
139086
+ console.log(`\u26A1 Adding implicit dependency: ${key}`);
139087
+ }
139080
139088
  const projectConfig = projectConfigs[key];
139081
139089
  if (projectConfig?.targets?.build) {
139082
139090
  const projectPackageJson = (0, import_devkit3.readJsonFile)(projectConfig.targets?.build.options.project);
@@ -139102,10 +139110,12 @@ ${Object.keys(options).map(
139102
139110
  }
139103
139111
  }
139104
139112
  }
139105
- console.log(`Building with the following dependencies marked as external:
139113
+ if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
139114
+ console.log(`Building with the following dependencies marked as external:
139106
139115
  ${externalDependencies.map((dep) => {
139107
- return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
139108
- }).join("\n")}`);
139116
+ return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
139117
+ }).join("\n")}`);
139118
+ }
139109
139119
  const prettierOptions = {
139110
139120
  plugins: ["prettier-plugin-packagejson"],
139111
139121
  trailingComma: "none",
@@ -139142,12 +139152,14 @@ ${externalDependencies.map((dep) => {
139142
139152
  while (propertyKey.startsWith("/")) {
139143
139153
  propertyKey = propertyKey.substring(1);
139144
139154
  }
139145
- console.debug(
139146
- `Trying to add entry point ${propertyKey} at "${(0, import_devkit3.joinPathFragments)(
139147
- filePath.path,
139148
- filePath.name
139149
- )}"`
139150
- );
139155
+ if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
139156
+ console.debug(
139157
+ `Trying to add entry point ${propertyKey} at "${(0, import_devkit3.joinPathFragments)(
139158
+ filePath.path,
139159
+ filePath.name
139160
+ )}"`
139161
+ );
139162
+ }
139151
139163
  if (!(propertyKey in ret)) {
139152
139164
  ret[propertyKey] = (0, import_devkit3.joinPathFragments)(filePath.path, filePath.name);
139153
139165
  }
@@ -139263,7 +139275,9 @@ ${externalDependencies.map((dep) => {
139263
139275
  packageJson.repository ??= workspacePackageJson.repository;
139264
139276
  packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
139265
139277
  const packageJsonPath = (0, import_path4.join)(context.root, options.outputPath, "package.json");
139266
- console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
139278
+ if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
139279
+ console.debug(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
139280
+ }
139267
139281
  (0, import_fs4.writeFileSync)(
139268
139282
  packageJsonPath,
139269
139283
  await (0, import_prettier.format)(JSON.stringify(packageJson), {
@@ -139350,21 +139364,26 @@ ${options.banner}
139350
139364
  getTransform: options.skipTypia ? void 0 : getTypiaTransform
139351
139365
  };
139352
139366
  if (options.getConfig) {
139367
+ if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
139368
+ console.log("\u26A1 Running the Build process");
139369
+ }
139353
139370
  const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
139354
- const config = (0, import_tsup.defineConfig)(
139371
+ const tsupConfig = (0, import_tsup.defineConfig)(
139355
139372
  getConfigFns.map(
139356
139373
  (getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
139357
139374
  )
139358
139375
  );
139359
- if (_isFunction(config)) {
139360
- await build(await Promise.resolve(config({})));
139376
+ if (_isFunction(tsupConfig)) {
139377
+ await build(await Promise.resolve(tsupConfig({})), config);
139361
139378
  } else {
139362
- await build(config);
139379
+ await build(tsupConfig, config);
139363
139380
  }
139364
- } else {
139365
- console.log("The Build process did not run because no `getConfig` parameter was provided");
139381
+ } else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
139382
+ console.warn("The Build process did not run because no `getConfig` parameter was provided");
139383
+ }
139384
+ if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
139385
+ console.log("\u26A1 The Build process has completed successfully");
139366
139386
  }
139367
- console.log("\u26A1 The Build process has completed successfully");
139368
139387
  return {
139369
139388
  success: true
139370
139389
  };
@@ -139405,12 +139424,14 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
139405
139424
  }
139406
139425
  return tsConfig;
139407
139426
  }
139408
- var build = async (options) => {
139427
+ var build = async (options, config) => {
139409
139428
  try {
139410
- Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
139411
139429
  if (Array.isArray(options)) {
139412
- await Promise.all(options.map((buildOptions) => (0, import_tsup.build)(buildOptions)));
139430
+ await Promise.all(options.map((buildOptions) => build(buildOptions, config)));
139413
139431
  } else {
139432
+ if (getLogLevel(config?.logLevel) >= LogLevel.TRACE && !options.silent) {
139433
+ console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
139434
+ }
139414
139435
  await (0, import_tsup.build)(options);
139415
139436
  }
139416
139437
  } catch (e) {
@@ -139559,13 +139580,11 @@ var tsupNeutralBuildExecutorFn = (options, context, config) => {
139559
139580
  {
139560
139581
  ...options,
139561
139582
  getConfig: {
139562
- "dist": neutralConfig
139583
+ dist: neutralConfig
139563
139584
  },
139564
139585
  platform: "neutral",
139565
139586
  banner: getFileBanner(
139566
- context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map(
139567
- (s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : ""
139568
- ).join(" ") : "TypeScript (Neutral Platform)"
139587
+ context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map((s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : "").join(" ") : "TypeScript (Neutral Platform)"
139569
139588
  ),
139570
139589
  define: {
139571
139590
  ...options.define
@@ -139687,12 +139706,10 @@ var tsupNodeBuildExecutorFn = (options, context, config) => {
139687
139706
  return tsupExecutorFn(
139688
139707
  {
139689
139708
  ...options,
139690
- getConfig: { "dist": nodeConfig },
139709
+ getConfig: { dist: nodeConfig },
139691
139710
  platform: "node",
139692
139711
  banner: getFileBanner(
139693
- context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map(
139694
- (s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : ""
139695
- ).join(" ") : "TypeScript (NodeJs Platform)"
139712
+ context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map((s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : "").join(" ") : "TypeScript (NodeJs Platform)"
139696
139713
  ),
139697
139714
  define: {
139698
139715
  ...options.define
@@ -139701,7 +139718,8 @@ var tsupNodeBuildExecutorFn = (options, context, config) => {
139701
139718
  ...process.env
139702
139719
  }
139703
139720
  },
139704
- context
139721
+ context,
139722
+ config
139705
139723
  );
139706
139724
  };
139707
139725
  var applyDefaultOptions3 = (options) => {