@vizualmodel/vmblu-cli 0.3.3 → 0.3.5
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/commands/init/index.js +54 -51
- package/commands/init/init-project.js +290 -288
- package/commands/init/make-package-json.js +65 -51
- package/commands/profile/profile.bundle.js +11442 -10521
- package/package.json +43 -30
- package/templates/0.8.3/vmblu.annex.md +2 -2
- package/templates/0.8.4/profile.schema.json +74 -0
- package/templates/0.8.4/seed.md +17 -0
- package/templates/0.8.4/vmblu.annex.md +151 -0
- package/templates/0.8.4/vmblu.schema.json +268 -0
package/commands/init/index.js
CHANGED
|
@@ -1,51 +1,54 @@
|
|
|
1
|
-
// vmblu init [targetDir] --name <project> --schema <ver> --force --dry-run
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import { initProject } from './init-project.js';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{ flag: '--
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
else if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
|
|
1
|
+
// vmblu init [targetDir] --name <project> --schema <ver> --force --dry-run
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { initProject } from './init-project.js';
|
|
5
|
+
import { createRequire } from 'module';
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const pckg = require('../../package.json');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
|
|
13
|
+
export const command = 'init <folder name>';
|
|
14
|
+
export const describe = 'Scaffold an empty vmblu project';
|
|
15
|
+
export const builder = [
|
|
16
|
+
{ flag: '--name <project>', desc: 'Project name (default: folder name)' },
|
|
17
|
+
{ flag: '--schema <ver>', desc: 'Schema version (default: latest version)' },
|
|
18
|
+
{ flag: '--force', desc: 'Overwrite existing files' },
|
|
19
|
+
{ flag: '--dry-run', desc: 'Show actions without writing' }
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export const handler = async (argv) => {
|
|
23
|
+
// tiny arg parse (no deps)
|
|
24
|
+
const args = { _: [] };
|
|
25
|
+
for (let i = 0; i < argv.length; i++) {
|
|
26
|
+
const a = argv[i];
|
|
27
|
+
if (a === '--force') args.force = true;
|
|
28
|
+
else if (a === '--dry-run') args.dryRun = true;
|
|
29
|
+
else if (a === '--name') args.name = argv[++i];
|
|
30
|
+
else if (a === '--schema') args.schema = argv[++i];
|
|
31
|
+
else if (!a.startsWith('-')) args._.push(a);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const targetDir = path.resolve(args._[0] || '.');
|
|
35
|
+
const projectName = args.name || path.basename(targetDir);
|
|
36
|
+
const schemaVersion = args.schema || pckg.schemaVersion;
|
|
37
|
+
|
|
38
|
+
await initProject({
|
|
39
|
+
targetDir,
|
|
40
|
+
projectName,
|
|
41
|
+
schemaVersion,
|
|
42
|
+
force: Boolean(args.force),
|
|
43
|
+
dryRun: Boolean(args.dryRun),
|
|
44
|
+
templatesDir: path.join(__dirname, '..', '..', 'templates'),
|
|
45
|
+
ui: {
|
|
46
|
+
info: (m) => console.log(m),
|
|
47
|
+
warn: (m) => console.warn(m),
|
|
48
|
+
error: (m) => console.error(m)
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
console.log(`vmblu project scaffolded in ${targetDir}`);
|
|
53
|
+
};
|
|
54
|
+
|