@dokebi/cli 0.4.52 → 0.4.54

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/project.js CHANGED
@@ -27,8 +27,8 @@ import { CliError } from './errors.js';
27
27
  import { markExampleRemoved, syncExample } from './example-config.js';
28
28
  import { exists, fingerprint, hash, json, object, parseObject, securePath, templateTarget, } from './filesystem.js';
29
29
  import { adminSections } from './first-admin.js';
30
- import { biomeConfigText, biomeMajor, formatterFix, formatterUses, GENERATED_FILE, migrationsFolder, PRETTIER_IGNORE, prettierIgnoreText, } from './formatter-ignore.js';
31
- import { generateRegistration, LEGACY_MAIN_SOURCE, MAIN_SOURCE, MAIN_SOURCE_V1, MAIN_SOURCE_V2, MAIN_SOURCE_V3, MAIN_SOURCE_V4, MAIN_SOURCE_V5, PROJECT_DEV_DEPENDENCIES, TEST_SCRIPT, TSCONFIG_SOURCE, TYPECHECK_SCRIPT, } from './generator.js';
30
+ import { biomeConfigText, biomeMajor, formatterFix, formatterUses, GENERATED_FILE, GENERATED_FILES, migrationsFolder, PRETTIER_IGNORE, prettierIgnoreText, } from './formatter-ignore.js';
31
+ import { generateModuleList, generateRegistration, LEGACY_MAIN_SOURCE, MAIN_SOURCE, MAIN_SOURCE_V1, MAIN_SOURCE_V2, MAIN_SOURCE_V3, MAIN_SOURCE_V4, MAIN_SOURCE_V5, MODULE_LIST_FILE, PROJECT_DEV_DEPENDENCIES, TEST_SCRIPT, TSCONFIG_SOURCE, TYPECHECK_SCRIPT, } from './generator.js';
32
32
  import { findHost, HOST_ROLES, missingDependency, optionsKey, orderPlugins, PACKAGE_NAME, readManifest, } from './manifest.js';
33
33
  import { mergeInstallDefaults } from './merge-install-defaults.js';
34
34
  import { dependencyMap, NpmClient, packageSpec, projectTarball, stageNpmConfig, validateProjectPackage, } from './npm-client.js';
@@ -2378,6 +2378,9 @@ export class Project {
2378
2378
  // R1 measurement: the registration the CLI writes, too (a reformatted copy is
2379
2379
  // MODIFIED_REGISTRATION); the migrations folder only in a project with migrations.
2380
2380
  const targets = [GENERATED_FILE];
2381
+ // D-0227: the module list beside it, written while a plugin hosts modules.
2382
+ if (findHost(plugins, 'modules'))
2383
+ targets.push(MODULE_LIST_FILE);
2381
2384
  if (plugins.some((plugin) => plugin.id === 'dokebi-migrate') ||
2382
2385
  (await exists(await securePath(root, migrations))))
2383
2386
  targets.push(migrations);
@@ -2408,7 +2411,7 @@ export class Project {
2408
2411
  }
2409
2412
  }
2410
2413
  warnings.push({
2411
- code: folder === GENERATED_FILE
2414
+ code: GENERATED_FILES.includes(folder)
2412
2415
  ? 'FORMATTER_FORMATS_GENERATED'
2413
2416
  : 'FORMATTER_FORMATS_MIGRATIONS',
2414
2417
  path: use.config,
@@ -4129,6 +4132,23 @@ export class Project {
4129
4132
  await tx.close();
4130
4133
  }
4131
4134
  }
4135
+ /**
4136
+ * `dokebi module sync` (D-0227): writes src/dokebi.modules.generated.ts (and the registration)
4137
+ * from the registered modules, unchanged otherwise. A project made before cli 0.4.54 gets its
4138
+ * module list this way; any later module add or remove keeps it current.
4139
+ */
4140
+ async moduleSync(root, dryRun = false) {
4141
+ const session = await this.#begin(root);
4142
+ const { tx, state } = session;
4143
+ try {
4144
+ await this.#requireHost(state, 'modules');
4145
+ await this.writeConfiguration(tx, state, session.configSource, session.configFile);
4146
+ return await this.#finish(session, { changed: tx.paths, preserved: [] }, dryRun);
4147
+ }
4148
+ finally {
4149
+ await tx.close();
4150
+ }
4151
+ }
4132
4152
  /** `dokebi module list`: the registered modules in registration order. */
4133
4153
  async moduleList(root) {
4134
4154
  const state = readState(parseObject(await projectStateText(root), 'state'));
@@ -4655,6 +4675,12 @@ export class Project {
4655
4675
  const generated = generateRegistration(state.plugins, state.installations, state.apps ?? [], state.modules ?? [], state.settings ?? []);
4656
4676
  state.generatedHash = hash(generated);
4657
4677
  await tx.write(GENERATED, generated);
4678
+ // D-0227: the registered modules as code apps import, while a plugin hosts modules; a list
4679
+ // left by a removed module host goes with it (its modules are no longer registered).
4680
+ if (findHost(state.plugins, 'modules'))
4681
+ await tx.write(MODULE_LIST_FILE, generateModuleList(state.modules ?? []));
4682
+ else if (await exists(await securePath(tx.root, MODULE_LIST_FILE)))
4683
+ await tx.replace(MODULE_LIST_FILE);
4658
4684
  await tx.write(configFile, configSource);
4659
4685
  await tx.write('.dokebi/state.json', json(state));
4660
4686
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dokebi/cli",
3
- "version": "0.4.52",
3
+ "version": "0.4.54",
4
4
  "description": "Project scaffolding, plugin catalog, recipes, install and verification CLI for Dokebi.",
5
5
  "keywords": [
6
6
  "dokebi",