@mnci/cli 4.0.2 → 4.0.4

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/dist/cli.js CHANGED
@@ -52,6 +52,16 @@ var logger = {
52
52
  step(message) {
53
53
  console.log(`\u2192 ${message}`);
54
54
  },
55
+ /**
56
+ * A sub-step under the most recent {@link logger.step}, indented to read as detail.
57
+ *
58
+ * `this: void` because this one is handed to `applyOverlay` as a progress callback,
59
+ * detached from the object. It reads no instance state, and the annotation is what
60
+ * says so — without it every such call is an unbound-method error.
61
+ */
62
+ detail(message) {
63
+ console.log(` \xB7 ${message}`);
64
+ },
55
65
  success(message) {
56
66
  console.log(`\u2713 ${message}`);
57
67
  },
@@ -208,7 +218,7 @@ function markPublic(manifestPath) {
208
218
  writeFileEnsured(manifestPath, toJson({ ...manifest, publishConfig: { access: "public" } }));
209
219
  }
210
220
  var WRONG_TYPES_PATH = "./dist/index.esm.d.ts";
211
- var ACTUAL_TYPES_PATH = "./dist/index.d.ts";
221
+ var ACTUAL_TYPES_PATH = "./dist/src/index.d.ts";
212
222
  var DECLARATION_MAP_EXCLUSION = "!**/*.d.ts.map";
213
223
  function repairPublishableManifest(manifestPath) {
214
224
  const manifest = readJson(manifestPath);
@@ -2234,7 +2244,8 @@ function removeProjectEslintConfigs(workspaceRoot) {
2234
2244
  (0, import_node_fs6.rmSync)((0, import_node_path11.join)(workspaceRoot, match), { force: true });
2235
2245
  }
2236
2246
  }
2237
- function applyOverlay(workspaceRoot, options) {
2247
+ function applyOverlay(workspaceRoot, options, onProgress = () => {
2248
+ }) {
2238
2249
  const nxJsonPath = (0, import_node_path11.join)(workspaceRoot, "nx.json");
2239
2250
  const nxJson = readJson(nxJsonPath);
2240
2251
  const generators = {
@@ -2244,7 +2255,9 @@ function applyOverlay(workspaceRoot, options) {
2244
2255
  const sync = { ...nxJson.sync, ...SYNC_CONFIG };
2245
2256
  const mnci = { ...nxJson.mnci, ...mnciConfig(options) };
2246
2257
  const patched = withSharedGlobals(withEslintPlugin(withReleaseConfig(nxJson, options.ci)));
2258
+ onProgress("nx.json \u2014 release, sync, generators, shared inputs, mnci block");
2247
2259
  writeFileEnsured(nxJsonPath, toJson({ ...patched, generators, sync, mnci }));
2260
+ onProgress("package.json \u2014 root scripts, TS compilers, ESLint toolchain, overrides");
2248
2261
  const manifestPath = (0, import_node_path11.join)(workspaceRoot, "package.json");
2249
2262
  const manifest = readJson(manifestPath);
2250
2263
  const scripts = {
@@ -2283,20 +2296,29 @@ function applyOverlay(workspaceRoot, options) {
2283
2296
  nx
2284
2297
  })
2285
2298
  );
2299
+ onProgress(
2300
+ `.npmrc \u2014 ${options.registry.kind === "azure-artifacts" ? "Azure Artifacts feed routing and credentials" : "public npm registry auth"}`
2301
+ );
2286
2302
  writeFileEnsured((0, import_node_path11.join)(workspaceRoot, ".npmrc"), npmrcContent(options.registry, options.scope));
2303
+ onProgress("commitlint.config.mjs and .husky/commit-msg \u2014 conventional commit enforcement");
2287
2304
  writeFileEnsured((0, import_node_path11.join)(workspaceRoot, "commitlint.config.mjs"), COMMITLINT_CONFIG);
2288
2305
  const hookPath = (0, import_node_path11.join)(workspaceRoot, ".husky/commit-msg");
2289
2306
  writeFileEnsured(hookPath, COMMIT_MSG_HOOK);
2290
2307
  markExecutable(hookPath);
2308
+ onProgress("eslint.config.mjs \u2014 the shared lint AND formatting opinion");
2291
2309
  writeFileEnsured((0, import_node_path11.join)(workspaceRoot, "eslint.config.mjs"), ESLINT_CONFIG);
2292
2310
  for (const retired of RETIRED_FORMATTER_FILES) {
2293
2311
  removeIfPresent((0, import_node_path11.join)(workspaceRoot, retired));
2294
2312
  }
2313
+ onProgress(".devcontainer/devcontainer.json \u2014 a local toolchain matching CI");
2295
2314
  writeFileEnsured(
2296
2315
  (0, import_node_path11.join)(workspaceRoot, ".devcontainer/devcontainer.json"),
2297
2316
  devcontainerJson(options.workspaceName)
2298
2317
  );
2299
2318
  removeNxScaffolding(workspaceRoot);
2319
+ onProgress(
2320
+ `${options.workspaceName}.code-workspace \u2014 settings, extensions, launch configs`
2321
+ );
2300
2322
  const codeWorkspacePath = (0, import_node_path11.join)(workspaceRoot, `${options.workspaceName}.code-workspace`);
2301
2323
  const existing = readCodeWorkspace(codeWorkspacePath);
2302
2324
  writeFileEnsured(
@@ -2308,12 +2330,14 @@ function applyOverlay(workspaceRoot, options) {
2308
2330
  }
2309
2331
  const publishUrl = pythonPublishUrl(options.registry);
2310
2332
  if (options.ci === "azure" || options.ci === "both") {
2333
+ onProgress("azure-pipelines.yml \u2014 build, verify, pack and release");
2311
2334
  writeFileEnsured(
2312
2335
  (0, import_node_path11.join)(workspaceRoot, "azure-pipelines.yml"),
2313
2336
  azurePipelinesYaml(options.agent, options.variableGroup, publishUrl, options.registry.kind)
2314
2337
  );
2315
2338
  }
2316
2339
  if (options.ci === "github" || options.ci === "both") {
2340
+ onProgress(".github/workflows/ci.yml and dependabot.yml");
2317
2341
  writeFileEnsured(
2318
2342
  (0, import_node_path11.join)(workspaceRoot, ".github/workflows/ci.yml"),
2319
2343
  githubActionsYaml(options.agent, publishUrl, options.registry.kind, options.ci)
@@ -2622,7 +2646,11 @@ async function runNew(name, options) {
2622
2646
  logger.step(
2623
2647
  "Applying MoNecromanCI overlay (VS Code workspace, release config, .npmrc, commitlint, pipeline, stack)"
2624
2648
  );
2625
- applyOverlay(workspaceRoot, { workspaceName, scope, registry, agent, variableGroup, ci, stack });
2649
+ applyOverlay(
2650
+ workspaceRoot,
2651
+ { workspaceName, scope, registry, agent, variableGroup, ci, stack },
2652
+ logger.detail
2653
+ );
2626
2654
  (0, import_node_fs8.rmSync)((0, import_node_path13.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
2627
2655
  (0, import_node_fs8.rmSync)((0, import_node_path13.join)(workspaceRoot, "package-lock.json"), { force: true });
2628
2656
  logger.step("Installing the toolchain (commitlint + husky + linting/formatting)");
@@ -2737,10 +2765,11 @@ function runUpgrade(workspaceRoot, options) {
2737
2765
  }
2738
2766
  const persisted = readMnciConfig(workspaceRoot);
2739
2767
  const resolved = resolveOverlayOptions(workspaceRoot, options, persisted);
2768
+ logger.step("Re-applying the MoNecromanCI overlay");
2769
+ applyOverlay(workspaceRoot, resolved, logger.detail);
2740
2770
  logger.step(
2741
- "Re-applying the MoNecromanCI overlay (release config, .npmrc, commitlint, pipeline, stack)"
2771
+ "Formatting the workspace (eslint --fix) \u2014 the slowest step, minutes on a large workspace"
2742
2772
  );
2743
- applyOverlay(workspaceRoot, resolved);
2744
2773
  runFormatter(workspaceRoot);
2745
2774
  logger.success("Done. Review the changes with `git diff` before committing.");
2746
2775
  }