vona-cli 1.1.102 → 1.1.103

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.
Files changed (2) hide show
  1. package/dist/bin/vona.js +15 -4
  2. package/package.json +5 -4
package/dist/bin/vona.js CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import { parseProjectPath } from '@cabloy/cli';
2
3
  import { ProcessHelper } from '@cabloy/process-helper';
4
+ import mri from 'mri';
3
5
  import semver from 'semver';
4
6
  import { playAttach } from "../play.js";
5
7
  import { VonaCommand } from "../start.js";
@@ -23,23 +25,32 @@ async function checkPnpm() {
23
25
  }
24
26
  }
25
27
  async function main() {
28
+ const rawArgv = process.argv.slice(2);
29
+ const _args = mri(rawArgv, {
30
+ boolean: ['force', 'help', 'version'],
31
+ alias: { h: 'help', v: 'version' },
32
+ });
33
+ const projectPath = parseProjectPath(_args.projectPath);
26
34
  // args
27
35
  let args = [];
28
- const rawArgv = process.argv.slice(2);
29
- const isPlay = rawArgv[0] === 'play';
36
+ const isPlay = _args._[0] === 'play';
30
37
  const isPlayAttach = isPlay && (rawArgv.includes('-a') || rawArgv.includes('--attach'));
31
38
  if (isPlay) {
32
39
  if (!isPlayAttach) {
33
40
  args = args.concat([':bin:play']);
34
41
  }
35
- args = args.concat(rawArgv.slice(1)).concat(['--dummy']);
42
+ const indexPlay = rawArgv.indexOf('play');
43
+ args = args.concat(rawArgv.slice(indexPlay + 1)).concat(['--dummy']);
44
+ if (_args.projectPath) {
45
+ args = [`--projectPath=${_args.projectPath}`].concat(args);
46
+ }
36
47
  }
37
48
  else {
38
49
  args = rawArgv;
39
50
  }
40
51
  // run
41
52
  if (isPlayAttach) {
42
- await playAttach(process.cwd(), args);
53
+ await playAttach(projectPath, args);
43
54
  }
44
55
  else {
45
56
  if (!isPlay) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-cli",
3
- "version": "1.1.102",
4
- "gitHead": "c4ed219c0de3e0163a406268597dda062275e551",
3
+ "version": "1.1.103",
4
+ "gitHead": "77e7d321e21482a08f743d441a017f3fb7be43cc",
5
5
  "description": "vona cli",
6
6
  "keywords": [
7
7
  "framework",
@@ -31,11 +31,12 @@
31
31
  "postpack": "clean-package restore"
32
32
  },
33
33
  "dependencies": {
34
- "@cabloy/cli": "^3.1.13",
34
+ "@cabloy/cli": "^3.1.14",
35
35
  "@cabloy/process-helper": "^3.1.5",
36
36
  "fs-extra": "^11.3.4",
37
+ "mri": "^1.2.0",
37
38
  "semver": "^7.7.4",
38
- "vona-cli-set-api": "^1.1.100"
39
+ "vona-cli-set-api": "^1.1.101"
39
40
  },
40
41
  "bin": {
41
42
  "vona": "dist/bin/vona.js"