vona-cli-set-api 1.0.339 → 1.0.342

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.
@@ -22,7 +22,7 @@
22
22
  "description": "<%=argv.description%>",
23
23
  "keywords": ["Vona Module"],
24
24
  "author": "<%=argv.author%>",
25
- "files": ["dist", "static"],
25
+ "files": ["dist", "assets"],
26
26
  "scripts": {
27
27
  "clean": "rimraf dist tsconfig.build.tsbuildinfo",
28
28
  "tsc:publish": "npm run clean && vona :bin:buildModule && tsc -p tsconfig.build.json",
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "vona": "^5.0.197"
49
+ "vona": "^5.0.199"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@cabloy/lint": "^5.0.16",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-home-base",
3
3
  "type": "module",
4
- "version": "5.0.10",
4
+ "version": "5.0.11",
5
5
  "title": "home-base",
6
6
  "vonaModule": {
7
7
  "dependencies": {
@@ -25,8 +25,8 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "files": [
28
- "dist",
29
- "static"
28
+ "assets",
29
+ "dist"
30
30
  ],
31
31
  "scripts": {
32
32
  "clean": "rimraf dist tsconfig.build.tsbuildinfo",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-home-index",
3
3
  "type": "module",
4
- "version": "5.0.8",
4
+ "version": "5.0.9",
5
5
  "title": "home-index",
6
6
  "vonaModule": {
7
7
  "dependencies": {
@@ -25,8 +25,8 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "files": [
28
- "dist",
29
- "static"
28
+ "assets",
29
+ "dist"
30
30
  ],
31
31
  "scripts": {
32
32
  "clean": "rimraf dist tsconfig.build.tsbuildinfo",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-home-user",
3
3
  "type": "module",
4
- "version": "5.0.16",
4
+ "version": "5.0.17",
5
5
  "title": "home-user",
6
6
  "vonaModule": {
7
7
  "fileVersion": 1,
@@ -26,8 +26,8 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "files": [
29
- "dist",
30
- "static"
29
+ "assets",
30
+ "dist"
31
31
  ],
32
32
  "scripts": {
33
33
  "clean": "rimraf dist tsconfig.build.tsbuildinfo",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-suite-a-home",
3
3
  "type": "module",
4
- "version": "5.0.18",
4
+ "version": "5.0.19",
5
5
  "title": "a-home",
6
6
  "description": "",
7
7
  "author": "zhennann",
@@ -8,6 +8,7 @@ import resolveImport from '@rollup/plugin-node-resolve';
8
8
  import replaceImport from '@rollup/plugin-replace';
9
9
  import terserImport from '@rollup/plugin-terser';
10
10
  import fse from 'fs-extra';
11
+ import { globby } from 'globby';
11
12
  import { rimraf } from 'rimraf';
12
13
  import { rollup } from 'rollup';
13
14
  import { generateConfigDefine, getAbsolutePathOfModule, getOutDir, getOutReleasesDir } from "../utils.js";
@@ -71,16 +72,12 @@ export class CliBinBuild extends BeanCliBase {
71
72
  const assetsPath = path.join(outDir, 'assets');
72
73
  for (const relativeName in modulesMeta.modules) {
73
74
  const module = modulesMeta.modules[relativeName];
74
- if (!module.package.files)
75
- continue;
76
- for (const scene of module.package.files) {
77
- if (['src', 'dist', 'cli', 'test'].includes(scene))
78
- continue;
79
- const scenePath = path.join(module.root, scene);
80
- if (fse.existsSync(scenePath)) {
81
- const destPath = path.join(assetsPath, scene, relativeName);
82
- await fse.copy(scenePath, destPath);
83
- }
75
+ const scenes = await globby('assets/*', { cwd: module.root, onlyDirectories: true });
76
+ for (const scene2 of scenes) {
77
+ const scene = scene2.substring('assets/'.length);
78
+ const scenePath = path.join(module.root, scene2);
79
+ const destPath = path.join(assetsPath, scene, relativeName);
80
+ await fse.copy(scenePath, destPath);
84
81
  }
85
82
  }
86
83
  }
@@ -9,5 +9,4 @@ declare module '@cabloy/cli' {
9
9
  }
10
10
  export declare class CliInitAsset extends BeanCliBase {
11
11
  execute(): Promise<void>;
12
- _setPackageInfo(modulePath: string, scene: string): Promise<void>;
13
12
  }
@@ -19,28 +19,10 @@ export class CliInitAsset extends BeanCliBase {
19
19
  // scene
20
20
  const scene = argv.scene;
21
21
  // directory
22
- const assetDir = path.join(targetDir, scene);
22
+ const assetDir = path.join(targetDir, 'assets', scene);
23
23
  if (fse.existsSync(assetDir)) {
24
- throw new Error(`asset exists: ${moduleName}/${scene}`);
24
+ throw new Error(`asset exists: ${moduleName}/assets/${scene}`);
25
25
  }
26
26
  await this.helper.ensureDir(assetDir);
27
- // package.json
28
- await this._setPackageInfo(targetDir, scene);
29
- }
30
- async _setPackageInfo(modulePath, scene) {
31
- const pkgFile = path.join(modulePath, 'package.json');
32
- const pkg = await this.helper.loadJSONFile(pkgFile);
33
- if (!pkg.files)
34
- pkg.files = [];
35
- let changed;
36
- // files
37
- if (!pkg.files.includes(scene)) {
38
- pkg.files.push(scene);
39
- changed = true;
40
- }
41
- // save
42
- if (changed) {
43
- await this.helper.saveJSONFile(pkgFile, pkg);
44
- }
45
27
  }
46
28
  }
@@ -19,7 +19,7 @@ export class CliInitStatic extends BeanCliBase {
19
19
  }
20
20
  // target dir
21
21
  const targetDir = await this.helper.ensureDir(_module.root);
22
- const staticDir = path.join(targetDir, 'static');
22
+ const staticDir = path.join(targetDir, 'assets/static');
23
23
  if (fse.existsSync(staticDir)) {
24
24
  throw new Error(`static exists: ${moduleName}`);
25
25
  }
@@ -11,4 +11,5 @@ export declare class CliToolsMetadata extends BeanCliBase {
11
11
  _generatePatch_resources(content: string, packageName: string, resources: string[], type: boolean): string;
12
12
  _generateThis(moduleName: string, relativeNameCapitalize: string, modulePath: string): Promise<void>;
13
13
  _generateIndex(modulePath: string): Promise<void>;
14
+ _generatePackage(modulePath: string): Promise<void>;
14
15
  }
@@ -3,6 +3,7 @@ import { BeanCliBase } from '@cabloy/cli';
3
3
  import { getOnionMetasMeta, getOnionScenesMeta } from '@cabloy/module-info';
4
4
  import { toUpperCaseFirstChar } from '@cabloy/word-utils';
5
5
  import fse from 'fs-extra';
6
+ import { loadJSONFile, saveJSONFile } from "../utils.js";
6
7
  import { generateBeanGenerals } from "./toolsMetadata/generateBeanGenerals.js";
7
8
  import { generateConfig, generateConstant, generateError, generateLocale } from "./toolsMetadata/generateConfig.js";
8
9
  import { generateMetadataCustom } from "./toolsMetadata/generateMetadataCustom.js";
@@ -130,6 +131,8 @@ export class CliToolsMetadata extends BeanCliBase {
130
131
  await this._generateThis(moduleName, relativeNameCapitalize, modulePath);
131
132
  // index
132
133
  await this._generateIndex(modulePath);
134
+ // package
135
+ await this._generatePackage(modulePath);
133
136
  }
134
137
  _generatePatch(content) {
135
138
  if (!content)
@@ -198,4 +201,31 @@ export { ScopeModule${relativeNameCapitalize} as ScopeModule } from './index.ts'
198
201
  await fse.writeFile(jsFile, jsContent);
199
202
  await this.helper.formatFile({ fileName: jsFile, logPrefix: 'format: ' });
200
203
  }
204
+ async _generatePackage(modulePath) {
205
+ let pkgFile;
206
+ let pkg;
207
+ let changed;
208
+ async function _loadPkg() {
209
+ if (!pkg) {
210
+ pkgFile = path.join(modulePath, 'package.json');
211
+ pkg = await loadJSONFile(pkgFile);
212
+ }
213
+ return pkg;
214
+ }
215
+ // cli
216
+ const cli = path.join(modulePath, 'cli');
217
+ if (fse.existsSync(cli)) {
218
+ pkg = await _loadPkg();
219
+ const index = pkg.files.indexOf('cli');
220
+ if (index === -1) {
221
+ changed = true;
222
+ pkg.files.push('cli');
223
+ }
224
+ }
225
+ // save
226
+ if (changed) {
227
+ await saveJSONFile(pkgFile, pkg);
228
+ await this.helper.formatFile({ fileName: pkgFile });
229
+ }
230
+ }
201
231
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-cli-set-api",
3
3
  "type": "module",
4
- "version": "1.0.339",
4
+ "version": "1.0.342",
5
5
  "description": "vona cli-set-api",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -31,7 +31,7 @@
31
31
  "@babel/plugin-proposal-decorators": "^7.25.9",
32
32
  "@babel/plugin-transform-class-properties": "^7.25.9",
33
33
  "@babel/plugin-transform-typescript": "^7.26.8",
34
- "@cabloy/cli": "^3.0.55",
34
+ "@cabloy/cli": "^3.0.56",
35
35
  "@cabloy/dotenv": "^1.1.10",
36
36
  "@cabloy/extend": "^3.1.10",
37
37
  "@cabloy/module-glob": "^5.2.32",
@@ -61,7 +61,7 @@
61
61
  "ts-node-maintained": "^10.9.6",
62
62
  "urllib": "^4.6.11",
63
63
  "uuid": "^11.1.0",
64
- "vona-core": "^5.0.92",
64
+ "vona-core": "^5.0.93",
65
65
  "why-is-node-running": "^3.2.2",
66
66
  "yargs-parser": "^21.1.1"
67
67
  },