@dokebi/i18n 0.2.6 → 0.2.7

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/AI.md CHANGED
@@ -118,7 +118,7 @@ Disabled integration installs no request/response hooks and contributes no page
118
118
 
119
119
  ## Upgrading catalogs
120
120
 
121
- Use CLI 0.4.6 or newer for the `src/shared/locales` folder contract and preservation of retired user files. An upgrade never automatically merges a generated sample into user translations. The upgrade entry keeps existing `src/shared/views/locales` catalogs authoritative while that legacy directory exists. Move all language folders to `src/shared/locales`, resolve any generated-sample collision explicitly, remove the old empty directory, then use the canonical entry shown above. Edited entries are preserved by the CLI; update their path explicitly. New installations only create the canonical folder.
121
+ Use CLI 0.4.6 or newer for the `src/shared/locales` folder contract and preservation of retired user files. An upgrade never automatically merges a generated sample into user translations. An upgrade from 0.1.x (whose entry read `src/shared/views/locales`) gets a compatibility entry that keeps those catalogs authoritative while that legacy directory exists; an upgrade from 0.2.0 or later names the canonical entry, so an entry you never edited stays the canonical one (0.2.7; 0.2.6 and earlier put the compatibility entry in its place). Move all language folders to `src/shared/locales`, resolve any generated-sample collision explicitly, remove the old empty directory, then use the canonical entry shown above. Edited entries are preserved by the CLI; update their path explicitly. New installations only create the canonical folder.
122
122
 
123
123
  ## Runtime API
124
124
 
package/dist/install.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  interface InstallContext {
2
2
  readonly options: Readonly<Record<string, unknown>>;
3
3
  }
4
+ interface UpgradeContext extends InstallContext {
5
+ /** The installed version the upgrade starts from. */
6
+ readonly from: string;
7
+ }
4
8
  export declare function planInstall(context: InstallContext): {
5
9
  requires: string[];
6
10
  entry: {
@@ -13,7 +17,7 @@ export declare function planInstall(context: InstallContext): {
13
17
  owner: 'user';
14
18
  }[];
15
19
  };
16
- export declare function planUpgrade(context: InstallContext): {
20
+ export declare function planUpgrade(context: UpgradeContext): {
17
21
  requires: string[];
18
22
  entry: {
19
23
  source: string;
package/dist/install.js CHANGED
@@ -9,6 +9,14 @@ const files = [
9
9
  function requires(context) {
10
10
  return context.options.http?.enabled ? ['dokebi-web'] : [];
11
11
  }
12
+ /**
13
+ * Whether `from` is a 0.1.x install, whose entry read the catalogs from src/shared/views/locales/
14
+ * (0.2.0 moved them to src/shared/locales/). Only those get the compatibility entry.
15
+ */
16
+ function legacyLayout(from) {
17
+ const [major, minor] = from.split('.').map((part) => Number.parseInt(part, 10));
18
+ return major === 0 && minor !== undefined && minor < 2;
19
+ }
12
20
  export function planInstall(context) {
13
21
  return {
14
22
  requires: requires(context),
@@ -17,10 +25,18 @@ export function planInstall(context) {
17
25
  };
18
26
  }
19
27
  export function planUpgrade(context) {
20
- // CLI >=0.4.6 preserves retired user-owned files. No user translation is overwritten or deleted.
28
+ // The CLI rewrites an entry the project never edited with the template named here, so a project
29
+ // already on the 0.2 layout gets the current entry, never the 0.1 compatibility one (an upgrade
30
+ // to 0.2.6 put that in place of shop's entry). An edited entry is kept either way, and CLI
31
+ // >=0.4.6 preserves retired user-owned files: no translation is overwritten or deleted.
21
32
  return {
22
33
  requires: requires(context),
23
- entry: { source: 'templates/upgrade-extension.ts', target },
34
+ entry: {
35
+ source: legacyLayout(context.from)
36
+ ? 'templates/upgrade-extension.ts'
37
+ : 'templates/extension.ts',
38
+ target,
39
+ },
24
40
  files,
25
41
  };
26
42
  }
package/dist/plugin.js CHANGED
@@ -106,7 +106,7 @@ export class I18nRuntime {
106
106
  }
107
107
  export const createPlugin = definePlugin({
108
108
  name: 'dokebi-i18n',
109
- version: '0.2.6',
109
+ version: '0.2.7',
110
110
  core: '^0.4.0',
111
111
  options,
112
112
  contributes: [localeData],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dokebi/i18n",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Compiled translation catalogs, locale negotiation, cardinal plurals and named Intl formats.",
5
5
  "keywords": [
6
6
  "dokebi",