create-procode 1.0.0 → 1.1.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/README.md +28 -2
- package/package.json +1 -1
- package/src/args.mjs +6 -0
- package/src/cli.mjs +123 -1
- package/src/deps.mjs +208 -195
- package/src/multiLanguage.mjs +409 -0
- package/templates/base/README.md.tmpl +5 -3
- package/templates/base/src/assets/styles/index.scss.tmpl +149 -146
- package/templates/base/vite.config.ts.tmpl +83 -54
- package/templates/multi-language/locales/fr/core.json +76 -0
- package/templates/multi-language/locales/fr/kendo.json +181 -0
- package/templates/multi-language/locales/fr/template.json +169 -0
- package/templates/multi-language/locales/fr/widget.json +65 -0
- package/templates/multi-language/locales/hi/core.json +76 -0
- package/templates/multi-language/locales/hi/kendo.json +181 -0
- package/templates/multi-language/locales/hi/template.json +169 -0
- package/templates/multi-language/locales/hi/widget.json +65 -0
- package/templates/multi-language/sample/fr.json +55 -0
- package/templates/multi-language/sample/hi.json +55 -0
- package/templates/tests/src/Module/schemas.test.ts +50 -0
- package/templates/tests-multi-language/src/multiLanguage/enText.ts +68 -0
- package/templates/tests-multi-language/src/multiLanguage/translations.test.ts +92 -0
package/src/deps.mjs
CHANGED
|
@@ -1,195 +1,208 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dependency set for a generated ProCode app.
|
|
3
|
-
*
|
|
4
|
-
* By default the CLI resolves it at scaffold time with resolveDependencySet():
|
|
5
|
-
* the newest published version of each ProCode package, plus the peers and
|
|
6
|
-
* bundled packages THOSE versions declare — so an app scaffolded after a
|
|
7
|
-
* library release gets that release and the peers it was built against, with
|
|
8
|
-
* no generator update. The constants below are the fallback (--no-latest, or
|
|
9
|
-
* the registry is unreachable): the set verified against a running ProCode
|
|
10
|
-
* host app (vsbackoffice / WorksLogicERP, 2026-10-
|
|
11
|
-
* kendo-widget
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"procode-lowcode-
|
|
29
|
-
"procode-
|
|
30
|
-
"procode-vs-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"react-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"@progress/kendo-
|
|
42
|
-
"@progress/kendo-
|
|
43
|
-
"@progress/kendo-react-
|
|
44
|
-
"@progress/kendo-react-
|
|
45
|
-
"@progress/kendo-react-
|
|
46
|
-
"@progress/kendo-react-
|
|
47
|
-
"@progress/kendo-react-
|
|
48
|
-
"@progress/kendo-react-
|
|
49
|
-
"@progress/kendo-react-
|
|
50
|
-
"@progress/kendo-react-
|
|
51
|
-
"@progress/kendo-react-
|
|
52
|
-
"@progress/kendo-react-
|
|
53
|
-
"@progress/kendo-react-
|
|
54
|
-
"@progress/kendo-react-
|
|
55
|
-
"@progress/kendo-react-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
procode:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Dependency set for a generated ProCode app.
|
|
3
|
+
*
|
|
4
|
+
* By default the CLI resolves it at scaffold time with resolveDependencySet():
|
|
5
|
+
* the newest published version of each ProCode package, plus the peers and
|
|
6
|
+
* bundled packages THOSE versions declare — so an app scaffolded after a
|
|
7
|
+
* library release gets that release and the peers it was built against, with
|
|
8
|
+
* no generator update. The constants below are the fallback (--no-latest, or
|
|
9
|
+
* the registry is unreachable): the set verified against a running ProCode
|
|
10
|
+
* host app (vsbackoffice / WorksLogicERP, 2026-10-28) at core 2.5.2 /
|
|
11
|
+
* kendo-widget 3.0.0 / vs-template 2.14.1 / vs-theme 2.6.1 — KendoReact 16.2.0
|
|
12
|
+
* with kendo-theme-default 14.7.0, and react-router-dom 7.
|
|
13
|
+
*
|
|
14
|
+
* Three rules encoded here, each of which is a hard failure if broken:
|
|
15
|
+
*
|
|
16
|
+
* 1. React stays on 18. All three runtime libraries declare `react ^18.2.0`
|
|
17
|
+
* as a peer; React 19 installs cleanly and then fails at runtime.
|
|
18
|
+
* 2. `react-redux` stays on 8.x. On 9.x you get two Provider contexts, the
|
|
19
|
+
* core's store becomes invisible to your components, and every screen
|
|
20
|
+
* renders blank with nothing in the console.
|
|
21
|
+
* 3. `@progress/kendo-theme-default` is a MISSING peer declaration, not an
|
|
22
|
+
* optional extra — the widget library's SCSS imports it by name, so
|
|
23
|
+
* leaving it out is a hard build failure on the first `npm run dev`.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** The four ProCode packages. */
|
|
27
|
+
export const PROCODE = {
|
|
28
|
+
"procode-lowcode-core": "^2.7.0",
|
|
29
|
+
"procode-lowcode-kendo-widget": "^3.2.0",
|
|
30
|
+
"procode-vs-template": "^2.15.1",
|
|
31
|
+
"procode-vs-theme": "^2.7.1",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** Every peer the four packages declare. peerDependenciesMeta is empty on all
|
|
35
|
+
* four — nothing here is optional. */
|
|
36
|
+
export const DECLARED_PEERS = {
|
|
37
|
+
react: "^18.2.0",
|
|
38
|
+
"react-dom": "^18.2.0",
|
|
39
|
+
"react-router-dom": "^6.22.3 || ^7.18.0",
|
|
40
|
+
axios: "^1.6.7",
|
|
41
|
+
"@progress/kendo-data-query": "^1.7.2",
|
|
42
|
+
"@progress/kendo-svg-icons": "^4.9.0 || ^5.0.0",
|
|
43
|
+
"@progress/kendo-react-buttons": "^16.2.0",
|
|
44
|
+
"@progress/kendo-react-charts": "^16.2.0",
|
|
45
|
+
"@progress/kendo-react-common": "^16.2.0",
|
|
46
|
+
"@progress/kendo-react-conversational-ui": "^16.2.0",
|
|
47
|
+
"@progress/kendo-react-data-tools": "^16.2.0",
|
|
48
|
+
"@progress/kendo-react-dateinputs": "^16.2.0",
|
|
49
|
+
"@progress/kendo-react-dialogs": "^16.2.0",
|
|
50
|
+
"@progress/kendo-react-dropdowns": "^16.2.0",
|
|
51
|
+
"@progress/kendo-react-editor": "^16.2.0",
|
|
52
|
+
"@progress/kendo-react-gauges": "^16.2.0",
|
|
53
|
+
"@progress/kendo-react-grid": "^16.2.0",
|
|
54
|
+
"@progress/kendo-react-inputs": "^16.2.0",
|
|
55
|
+
"@progress/kendo-react-intl": "^16.2.0",
|
|
56
|
+
"@progress/kendo-react-layout": "^16.2.0",
|
|
57
|
+
"@progress/kendo-react-listview": "^16.2.0",
|
|
58
|
+
"@progress/kendo-react-popup": "^16.2.0",
|
|
59
|
+
"@progress/kendo-react-upload": "^16.2.0",
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** Required at runtime or build time, but NOT declared as a peer by anything. */
|
|
63
|
+
export const UNDECLARED_BUT_REQUIRED = {
|
|
64
|
+
// NOT the KendoReact major: from KendoReact 13 the theme versions apart
|
|
65
|
+
// (KendoReact 16.2 ships against theme 14.7, and no theme 16 exists).
|
|
66
|
+
"@progress/kendo-theme-default": "^14.7.0",
|
|
67
|
+
// A peer of kendo-react-grid 16 that nothing in ProCode declares.
|
|
68
|
+
"@progress/kendo-csv": "^1.0.0",
|
|
69
|
+
"@progress/kendo-licensing": "^1.11.3",
|
|
70
|
+
"@progress/kendo-react-labels": "^16.2.0",
|
|
71
|
+
"@progress/kendo-intl": "^3.2.1",
|
|
72
|
+
"react-toastify": "^11.0.5",
|
|
73
|
+
sass: "^1.38.0",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const DEV_DEPS = {
|
|
77
|
+
// vite.config.ts imports node:url.
|
|
78
|
+
"@types/node": "^24.9.2",
|
|
79
|
+
"@types/react": "^18.2.43",
|
|
80
|
+
"@types/react-dom": "^18.2.17",
|
|
81
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
82
|
+
typescript: "^5.2.2",
|
|
83
|
+
vite: "^5.2.0",
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** `npm test`. vitest 1.x is the line that runs on Vite 5 (DEV_DEPS.vite). */
|
|
87
|
+
export const TEST_DEV_DEPS = {
|
|
88
|
+
vitest: "^1.6.0",
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const LINT_DEV_DEPS = {
|
|
92
|
+
eslint: "^8.57.0",
|
|
93
|
+
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
94
|
+
"@typescript-eslint/parser": "^7.2.0",
|
|
95
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
96
|
+
"eslint-plugin-react-refresh": "^0.4.6",
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/** Bundled INSIDE the libraries. Listed for documentation only — do not add
|
|
100
|
+
* them to a generated package.json, and never bump them independently. */
|
|
101
|
+
export const BUNDLED_DO_NOT_ADD = {
|
|
102
|
+
"procode-lowcode-core": {
|
|
103
|
+
"@reduxjs/toolkit": "^1.9.1",
|
|
104
|
+
"react-redux": "^8.0.5",
|
|
105
|
+
"redux-saga": "^1.2.3",
|
|
106
|
+
uuid: "^11.1.1",
|
|
107
|
+
},
|
|
108
|
+
"procode-lowcode-kendo-widget": { lodash: "^4.17.21", uuid: "^11.1.1" },
|
|
109
|
+
"procode-vs-template": {
|
|
110
|
+
lodash: "^4.17.21",
|
|
111
|
+
"react-beautiful-dnd": "^13.1.1",
|
|
112
|
+
uuid: "^11.1.1",
|
|
113
|
+
},
|
|
114
|
+
"procode-vs-theme": {},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const sortKeys = (obj) =>
|
|
118
|
+
Object.fromEntries(Object.entries(obj).sort(([a], [b]) => a.localeCompare(b)));
|
|
119
|
+
|
|
120
|
+
/** The tested set, used with --no-latest or when the registry is unreachable. */
|
|
121
|
+
export const PINNED_SET = {
|
|
122
|
+
procode: PROCODE,
|
|
123
|
+
peers: DECLARED_PEERS,
|
|
124
|
+
extras: UNDECLARED_BUT_REQUIRED,
|
|
125
|
+
bundled: BUNDLED_DO_NOT_ADD,
|
|
126
|
+
source: "pinned",
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/** Lowest version a range admits, as [major, minor, patch]; [0,0,0] if none. */
|
|
130
|
+
const floorOf = (range) => (String(range).match(/(\d+)\.(\d+)\.(\d+)/) ?? [0, 0, 0, 0]).slice(1).map(Number);
|
|
131
|
+
const newer = (a, b) => {
|
|
132
|
+
const [x, y] = [floorOf(a), floorOf(b)];
|
|
133
|
+
for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return x[i] > y[i] ? a : b;
|
|
134
|
+
return a;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Ask the registry for the newest published version of each ProCode package,
|
|
139
|
+
* and derive everything else from those manifests:
|
|
140
|
+
*
|
|
141
|
+
* peers every peerDependency the four declare; where two declare the same
|
|
142
|
+
* peer, the range with the higher floor wins (vs-template wants
|
|
143
|
+
* react-router-dom ^6.22.3 where core wants ^6.6.1).
|
|
144
|
+
* extras required but undeclared. kendo-react-labels follows the
|
|
145
|
+
* kendo-react range the widget library declares (KendoReact 16 wants
|
|
146
|
+
* exact siblings). kendo-theme-default does NOT: its major stopped
|
|
147
|
+
* tracking KendoReact's at 13, so it stays on its tested pin and is
|
|
148
|
+
* bumped by hand with the widget library. The rest stay pinned too.
|
|
149
|
+
* bundled each package's own dependencies, for the _procodeBundled note.
|
|
150
|
+
*
|
|
151
|
+
* Uses the registry npm/npx was invoked with (npm_config_registry), so a
|
|
152
|
+
* mirror or proxy registry is honoured. Throws on any failure; the caller
|
|
153
|
+
* falls back to PINNED_SET.
|
|
154
|
+
*/
|
|
155
|
+
export async function resolveDependencySet({ registry, timeoutMs = 10000 } = {}) {
|
|
156
|
+
const base = String(registry || process.env.npm_config_registry || "https://registry.npmjs.org/").replace(/\/?$/, "/");
|
|
157
|
+
|
|
158
|
+
const manifests = await Promise.all(
|
|
159
|
+
Object.keys(PROCODE).map(async (name) => {
|
|
160
|
+
const res = await fetch(base + name.replace("/", "%2f") + "/latest", {
|
|
161
|
+
headers: { accept: "application/json" },
|
|
162
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
163
|
+
});
|
|
164
|
+
if (!res.ok) throw new Error(name + ": HTTP " + res.status + " from " + base);
|
|
165
|
+
const manifest = await res.json();
|
|
166
|
+
if (typeof manifest?.version !== "string") throw new Error(name + ": no version in the registry response");
|
|
167
|
+
return manifest;
|
|
168
|
+
}),
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const procode = {};
|
|
172
|
+
const peers = {};
|
|
173
|
+
const bundled = {};
|
|
174
|
+
for (const m of manifests) {
|
|
175
|
+
procode[m.name] = "^" + m.version;
|
|
176
|
+
bundled[m.name] = m.dependencies ?? {};
|
|
177
|
+
for (const [peer, range] of Object.entries(m.peerDependencies ?? {})) {
|
|
178
|
+
peers[peer] = peers[peer] ? newer(peers[peer], range) : range;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const extras = { ...UNDECLARED_BUT_REQUIRED };
|
|
183
|
+
const kendoReact = Object.entries(peers).find(([n]) => n.startsWith("@progress/kendo-react-"))?.[1];
|
|
184
|
+
if (kendoReact) {
|
|
185
|
+
extras["@progress/kendo-react-labels"] = kendoReact;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return { procode, peers, extras, bundled, source: "latest" };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** `set` is PINNED_SET or what resolveDependencySet() returned. */
|
|
192
|
+
export function buildDependencies(set = PINNED_SET) {
|
|
193
|
+
return sortKeys({ ...set.procode, ...set.peers, ...set.extras });
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The React type packages follow the React major the libraries declare, so a
|
|
198
|
+
* future move off React 18 does not leave @types/react behind.
|
|
199
|
+
*/
|
|
200
|
+
export function buildDevDependencies({ lint = true, tests = true, set = PINNED_SET } = {}) {
|
|
201
|
+
const devDeps = { ...DEV_DEPS, ...(lint ? LINT_DEV_DEPS : {}), ...(tests ? TEST_DEV_DEPS : {}) };
|
|
202
|
+
const reactMajor = floorOf(set.peers.react ?? "")[0];
|
|
203
|
+
if (reactMajor && reactMajor !== floorOf(DEV_DEPS["@types/react"])[0]) {
|
|
204
|
+
devDeps["@types/react"] = "^" + reactMajor + ".0.0";
|
|
205
|
+
devDeps["@types/react-dom"] = "^" + reactMajor + ".0.0";
|
|
206
|
+
}
|
|
207
|
+
return sortKeys(devDeps);
|
|
208
|
+
}
|