cabloy 5.1.11 → 5.1.13

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,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.1.13
4
+
5
+ ### Features
6
+
7
+ - Add upgrade script and remove testSecond flavor env files
8
+
9
+ ### Improvements
10
+
11
+ - Switch tsconfig base from front to api and update dependencies
12
+
13
+ ## 5.1.12
14
+
3
15
  ## 5.1.11
4
16
 
5
17
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cabloy",
3
- "version": "5.1.11",
3
+ "version": "5.1.13",
4
4
  "description": "A Node.js fullstack framework",
5
5
  "keywords": [
6
6
  "cabloy",
@@ -21,6 +21,8 @@
21
21
  "type": "module",
22
22
  "scripts": {
23
23
  "init": "pnpm install --no-frozen-lockfile && node scripts/init.ts",
24
+ "upgrade": "node scripts/upgrade.ts",
25
+ "upgrade:dry-run": "node scripts/upgrade.ts --dry-run",
24
26
  "build": "pnpm --dir zova run build:ssr:cabloyBasicBatch && pnpm --dir vona run build",
25
27
  "build:docker": "pnpm --dir zova run build:ssr:cabloyBasicBatch && pnpm --dir vona run build:docker",
26
28
  "start": "cd vona && npm run start",
@@ -0,0 +1,260 @@
1
+ import { execSync } from 'node:child_process';
2
+ import { createWriteStream } from 'node:fs';
3
+ import { cpSync, existsSync, mkdirSync, rmSync, unlinkSync } from 'node:fs';
4
+ import { tmpdir } from 'node:os';
5
+ import { dirname, join, resolve } from 'node:path';
6
+ import { pipeline } from 'node:stream/promises';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+ const ROOT_DIR = resolve(__dirname, '..');
11
+ const NPM_REGISTRY = 'https://registry.npmjs.org';
12
+ const PACKAGE_NAME = 'cabloy';
13
+ const TEMP_DIR = resolve(ROOT_DIR, 'node_modules/.cabloy-upgrade');
14
+
15
+ // --- Whitelist ---
16
+
17
+ const WHITELIST_DIRS: string[] = [
18
+ // root
19
+ 'scripts',
20
+ '.husky',
21
+ // vona
22
+ 'vona/packages-vona',
23
+ 'vona/packages-cli',
24
+ 'vona/packages-utils',
25
+ 'vona/src/suite-vendor',
26
+ 'vona/src/module-vendor',
27
+ 'vona/scripts',
28
+ 'vona/docker-compose-original',
29
+ // zova
30
+ 'zova/packages-zova',
31
+ 'zova/packages-cli',
32
+ 'zova/packages-utils',
33
+ 'zova/src/suite-vendor',
34
+ 'zova/src/module-vendor',
35
+ 'zova/src/boot',
36
+ 'zova/src-ssr',
37
+ 'zova/scripts',
38
+ ];
39
+
40
+ const WHITELIST_FILES: string[] = [
41
+ // root
42
+ 'package.json',
43
+ 'tsconfig.json',
44
+ 'tsconfig.base.json',
45
+ 'tsconfig.base.esm.json',
46
+ 'oxfmt.config.ts',
47
+ 'oxlint.config.ts',
48
+ 'lint-staged.config.mjs',
49
+ 'LICENSE',
50
+ // vona
51
+ 'vona/package.original.json',
52
+ 'vona/pnpm-workspace.yaml',
53
+ 'vona/lerna.json',
54
+ 'vona/tsconfig.json',
55
+ 'vona/tsconfig.base.json',
56
+ 'vona/tsconfig.base.esm.json',
57
+ 'vona/oxfmt.config.ts',
58
+ 'vona/oxlint.config.ts',
59
+ 'vona/nginx.conf',
60
+ 'vona/docker-compose.original.yml',
61
+ 'vona/docker-compose-dockerfile-app',
62
+ 'vona/codecov.yml',
63
+ // zova
64
+ 'zova/package.original.json',
65
+ 'zova/pnpm-workspace.yaml',
66
+ 'zova/lerna.json',
67
+ 'zova/tsconfig.json',
68
+ 'zova/tsconfig.base.json',
69
+ 'zova/tsconfig.base.esm.json',
70
+ 'zova/tsconfig.rest.json',
71
+ 'zova/tsconfig.vue-tsc.json',
72
+ 'zova/oxfmt.config.ts',
73
+ 'zova/oxlint.config.ts',
74
+ 'zova/quasar.config.ts',
75
+ 'zova/quasar.extensions.json',
76
+ 'zova/postcss.config.js',
77
+ 'zova/index.html',
78
+ 'zova/openapi.config.ts',
79
+ ];
80
+
81
+ // --- Helpers ---
82
+
83
+ // oxlint-disable no-console
84
+ const log = console.log; // eslint-disable-line no-console
85
+
86
+ function exec(cmd: string): void {
87
+ execSync(cmd, { stdio: 'inherit', cwd: ROOT_DIR });
88
+ }
89
+
90
+ // --- Step 1: Pre-flight ---
91
+
92
+ function preflight(): void {
93
+ const markers = ['__CABLOY_BASIC__', '__CABLOY_START__'];
94
+ const found = markers.find(m => existsSync(resolve(ROOT_DIR, m)));
95
+ if (!found) {
96
+ console.error(
97
+ 'Error: Not a cabloy project (no __CABLOY_BASIC__ or __CABLOY_START__ marker found)',
98
+ );
99
+ process.exit(1);
100
+ }
101
+ }
102
+
103
+ // --- Step 2: Download & extract ---
104
+
105
+ async function fetchLatestTarballUrl(): Promise<string> {
106
+ const url = `${NPM_REGISTRY}/${PACKAGE_NAME}/latest`;
107
+ const res = await fetch(url);
108
+ if (!res.ok) {
109
+ throw new Error(`Failed to fetch package info: ${res.status} ${res.statusText}`);
110
+ }
111
+ const data = (await res.json()) as { dist: { tarball: string } };
112
+ return data.dist.tarball;
113
+ }
114
+
115
+ async function downloadTarball(tarballUrl: string): Promise<string> {
116
+ const tmpFile = join(tmpdir(), `cabloy-upgrade-${Date.now()}.tgz`);
117
+ const res = await fetch(tarballUrl);
118
+ if (!res.ok) {
119
+ throw new Error(`Failed to download tarball: ${res.status} ${res.statusText}`);
120
+ }
121
+ if (!res.body) {
122
+ throw new Error('Failed to download tarball: empty response body');
123
+ }
124
+ mkdirSync(dirname(tmpFile), { recursive: true });
125
+ const fileStream = createWriteStream(tmpFile);
126
+ // @ts-expect-error Node.js ReadableStream vs Web ReadableStream
127
+ await pipeline(res.body, fileStream);
128
+ return tmpFile;
129
+ }
130
+
131
+ async function extractTarball(tarballPath: string, targetDir: string): Promise<void> {
132
+ mkdirSync(targetDir, { recursive: true });
133
+ const exitCode = execSync(`tar --strip-components=1 -xzf "${tarballPath}" -C "${targetDir}"`, {
134
+ stdio: 'pipe',
135
+ });
136
+ if (exitCode !== 0) {
137
+ throw new Error('Failed to extract tarball');
138
+ }
139
+ }
140
+
141
+ async function downloadAndExtract(): Promise<void> {
142
+ const tarballUrl = await fetchLatestTarballUrl();
143
+ const tarballPath = await downloadTarball(tarballUrl);
144
+ try {
145
+ await extractTarball(tarballPath, TEMP_DIR);
146
+ } finally {
147
+ try {
148
+ unlinkSync(tarballPath);
149
+ } catch {}
150
+ }
151
+ }
152
+
153
+ // --- Step 3: Selective overwrite ---
154
+
155
+ function selectiveOverwrite(dryRun?: boolean): void {
156
+ // Overwrite directories
157
+ for (const dir of WHITELIST_DIRS) {
158
+ const src = resolve(TEMP_DIR, dir);
159
+ const dest = resolve(ROOT_DIR, dir);
160
+ if (!existsSync(src)) continue;
161
+ if (dryRun) {
162
+ log(` [dry-run] Overwrite directory: ${dir}`);
163
+ continue;
164
+ }
165
+ if (existsSync(dest)) {
166
+ rmSync(dest, { recursive: true, force: true });
167
+ }
168
+ cpSync(src, dest, { recursive: true, filter: src => !src.includes('.DS_Store') });
169
+ }
170
+
171
+ // Overwrite files
172
+ for (const file of WHITELIST_FILES) {
173
+ const src = resolve(TEMP_DIR, file);
174
+ const dest = resolve(ROOT_DIR, file);
175
+ if (!existsSync(src)) continue;
176
+ if (dryRun) {
177
+ log(` [dry-run] Overwrite file: ${file}`);
178
+ continue;
179
+ }
180
+ cpSync(src, dest);
181
+ }
182
+ }
183
+
184
+ // --- Step 4: Delete generated package.json files ---
185
+
186
+ function deleteGeneratedPackageJsons(dryRun?: boolean): void {
187
+ const files = ['vona/package.json', 'zova/package.json'];
188
+ for (const file of files) {
189
+ const filePath = resolve(ROOT_DIR, file);
190
+ if (!existsSync(filePath)) continue;
191
+ if (dryRun) {
192
+ log(` [dry-run] Delete: ${file}`);
193
+ continue;
194
+ }
195
+ rmSync(filePath);
196
+ }
197
+ }
198
+
199
+ // --- Step 5: Run init ---
200
+
201
+ function runInit(dryRun?: boolean): void {
202
+ if (dryRun) {
203
+ log(' [dry-run] Run: npm run init');
204
+ return;
205
+ }
206
+ exec('npm run init');
207
+ }
208
+
209
+ // --- Step 6: Cleanup ---
210
+
211
+ function cleanup(dryRun?: boolean): void {
212
+ if (dryRun) {
213
+ log(' [dry-run] Remove temp dir: node_modules/.cabloy-upgrade/');
214
+ return;
215
+ }
216
+ if (existsSync(TEMP_DIR)) {
217
+ rmSync(TEMP_DIR, { recursive: true, force: true });
218
+ }
219
+ }
220
+
221
+ // --- Main ---
222
+
223
+ async function main(): Promise<void> {
224
+ const dryRun = process.argv.includes('--dry-run');
225
+
226
+ log('Cabloy Upgrade\n');
227
+
228
+ // 1. Pre-flight
229
+ preflight();
230
+
231
+ // 2. Download & extract
232
+ log('Downloading latest cabloy from npm registry...');
233
+ await downloadAndExtract();
234
+ log('Downloaded and extracted successfully!\n');
235
+
236
+ // 3. Selective overwrite
237
+ log('Overwriting framework-owned files...');
238
+ selectiveOverwrite(dryRun);
239
+ log('');
240
+
241
+ // 4. Delete generated package.json
242
+ log('Removing generated package.json files...');
243
+ deleteGeneratedPackageJsons(dryRun);
244
+ log('');
245
+
246
+ // 5. Run init
247
+ log('Running npm run init...');
248
+ runInit(dryRun);
249
+ log('');
250
+
251
+ // 6. Cleanup
252
+ cleanup(dryRun);
253
+
254
+ log('Upgrade complete!');
255
+ }
256
+
257
+ main().catch(err => {
258
+ console.error(`\nUpgrade failed: ${err.message}`);
259
+ process.exit(1);
260
+ });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-cli",
3
- "version": "1.2.68",
3
+ "version": "1.2.69",
4
4
  "gitHead": "6f675a8cc46d596142c591c28a40cc4d82fcc6cc",
5
5
  "description": "zova cli",
6
6
  "keywords": [
@@ -44,7 +44,7 @@
44
44
  "@cabloy/process-helper": "^3.0.0",
45
45
  "fs-extra": "^11.3.5",
46
46
  "semver": "^7.6.2",
47
- "zova-cli-set-front": "^1.2.66"
47
+ "zova-cli-set-front": "^1.2.67"
48
48
  },
49
49
  "devDependencies": {
50
50
  "clean-package": "^2.2.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-cli-set-front",
3
- "version": "1.2.66",
3
+ "version": "1.2.67",
4
4
  "gitHead": "6f675a8cc46d596142c591c28a40cc4d82fcc6cc",
5
5
  "description": "zova cli-set-front",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova",
3
- "version": "5.1.82",
3
+ "version": "5.1.83",
4
4
  "gitHead": "09d901d17140a80ee0764211b441cda72fd94663",
5
5
  "description": "A vue3 framework with ioc",
6
6
  "keywords": [
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "zova-core": "^5.1.42",
49
- "zova-suite-a-zova": "^5.1.81"
49
+ "zova-suite-a-zova": "^5.1.82"
50
50
  },
51
51
  "devDependencies": {
52
52
  "clean-package": "^2.2.0",
@@ -29,7 +29,7 @@ importers:
29
29
  specifier: ^1.1.6
30
30
  version: 1.1.6
31
31
  '@cabloy/logger':
32
- specifier: ^1.1.14
32
+ specifier: ^1.1.15
33
33
  version: link:packages-utils/logger
34
34
  '@cabloy/module-info':
35
35
  specifier: ^2.0.0
@@ -41,7 +41,7 @@ importers:
41
41
  specifier: ^4.4.16
42
42
  version: 4.4.16(vue@3.5.34(typescript@5.9.3))
43
43
  '@cabloy/word-utils':
44
- specifier: ^2.1.13
44
+ specifier: ^2.1.14
45
45
  version: link:packages-utils/word-utils
46
46
  '@cabloy/zod-openapi':
47
47
  specifier: ^1.1.6
@@ -98,7 +98,7 @@ importers:
98
98
  specifier: ^3.7.2
99
99
  version: 3.7.2
100
100
  mutate-on-copy:
101
- specifier: ^1.1.12
101
+ specifier: ^1.1.13
102
102
  version: link:packages-utils/mutate-on-copy
103
103
  openapi3-ts:
104
104
  specifier: ^4.5.0
@@ -131,7 +131,7 @@ importers:
131
131
  specifier: workspace:^
132
132
  version: link:packages-zova/zova
133
133
  zova-jsx:
134
- specifier: ^1.1.47
134
+ specifier: ^1.1.48
135
135
  version: link:packages-utils/zova-jsx
136
136
  zova-module-a-api:
137
137
  specifier: workspace:^
@@ -360,7 +360,7 @@ importers:
360
360
  specifier: ^3.2.6
361
361
  version: 3.2.9(typescript@5.9.3)
362
362
  zova-openapi:
363
- specifier: ^1.1.13
363
+ specifier: ^1.1.14
364
364
  version: link:packages-utils/zova-openapi
365
365
  zova-vite:
366
366
  specifier: workspace:^
@@ -381,7 +381,7 @@ importers:
381
381
  specifier: ^7.6.2
382
382
  version: 7.8.0
383
383
  zova-cli-set-front:
384
- specifier: ^1.2.66
384
+ specifier: ^1.2.67
385
385
  version: link:../cli-set-front
386
386
  devDependencies:
387
387
  clean-package:
@@ -839,7 +839,7 @@ importers:
839
839
  specifier: ^5.1.42
840
840
  version: link:../zova-core
841
841
  zova-suite-a-zova:
842
- specifier: ^5.1.81
842
+ specifier: ^5.1.82
843
843
  version: link:../../src/suite-vendor/a-zova
844
844
  devDependencies:
845
845
  clean-package:
@@ -1030,7 +1030,7 @@ importers:
1030
1030
  specifier: ^5.1.27
1031
1031
  version: link:modules/a-table
1032
1032
  zova-module-a-zod:
1033
- specifier: ^5.1.21
1033
+ specifier: ^5.1.23
1034
1034
  version: link:modules/a-zod
1035
1035
  zova-module-a-zova:
1036
1036
  specifier: ^5.1.53
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-module-a-zod",
3
- "version": "5.1.21",
3
+ "version": "5.1.23",
4
4
  "gitHead": "09d901d17140a80ee0764211b441cda72fd94663",
5
5
  "description": "",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-suite-a-zova",
3
- "version": "5.1.81",
3
+ "version": "5.1.82",
4
4
  "gitHead": "09d901d17140a80ee0764211b441cda72fd94663",
5
5
  "description": "zova",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "zova-module-a-ssrserver": "^5.1.15",
32
32
  "zova-module-a-style": "^5.1.25",
33
33
  "zova-module-a-table": "^5.1.27",
34
- "zova-module-a-zod": "^5.1.21",
34
+ "zova-module-a-zod": "^5.1.23",
35
35
  "zova-module-a-zova": "^5.1.53"
36
36
  },
37
37
  "title": "a-zova"
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "@cabloy/lint/front/tsconfig.base.esm",
2
+ "extends": "@cabloy/lint/api/tsconfig.base.esm",
3
3
  "compilerOptions": {
4
4
  "target": "ESNext",
5
5
  "jsx": "preserve",
@@ -1,5 +0,0 @@
1
- APP_PUBLIC_PATH = second
2
-
3
- SSR_COOKIE = true
4
- SSR_BODYREADYOBSERVER = true
5
- SSR_WITH_VONA = true
@@ -1,7 +0,0 @@
1
- BUILD_MINIFY = false
2
- BUILD_SOURCEMAP = false
3
-
4
- BUILD_COPY_RELEASE = ../vona/src/suite-vendor/a-cabloy/modules/test-ssr/assets/site
5
- BUILD_REST_COPY_DIST = ../vona/src/suite-vendor/a-cabloy/modules/test-ssr/zovaRest
6
-
7
- MOCK_ENABLED = false