@nocobase/cli 0.8.0-alpha.9 → 0.8.1-alpha.3

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/bin/index.js CHANGED
@@ -16,6 +16,7 @@ const env = {
16
16
  DEFAULT_STORAGE_TYPE: 'local',
17
17
  LOCAL_STORAGE_DEST: 'storage/uploads',
18
18
  MFSU_AD: 'none',
19
+ PM2_HOME: resolve(process.cwd(), './storage/.pm2'),
19
20
  };
20
21
 
21
22
  if (!process.env.APP_ENV_PATH && process.argv[2] && process.argv[2] === 'test') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/cli",
3
- "version": "0.8.0-alpha.9",
3
+ "version": "0.8.1-alpha.3",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "licenses": [
@@ -23,12 +23,12 @@
23
23
  "serve": "^13.0.2"
24
24
  },
25
25
  "devDependencies": {
26
- "@nocobase/devtools": "0.8.0-alpha.9"
26
+ "@nocobase/devtools": "0.8.1-alpha.3"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",
30
30
  "url": "git+https://github.com/nocobase/nocobase.git",
31
31
  "directory": "packages/core/cli"
32
32
  },
33
- "gitHead": "6afe02d59bb22df0f96a7605c9001dcc17a30d6a"
33
+ "gitHead": "e03df3df5962b99d9fbf5b6e33fbe2b23f14f3d3"
34
34
  }
@@ -18,6 +18,7 @@ module.exports = (cli) => {
18
18
  .allowUnknownOption()
19
19
  .action(async (opts) => {
20
20
  promptForTs();
21
+
21
22
  if (process.argv.includes('-h') || process.argv.includes('--help')) {
22
23
  run('ts-node', [
23
24
  '-P',
@@ -29,15 +30,22 @@ module.exports = (cli) => {
29
30
  ]);
30
31
  return;
31
32
  }
33
+
32
34
  const { port, client, server } = opts;
35
+
33
36
  if (port) {
34
37
  process.env.APP_PORT = opts.port;
35
38
  }
39
+
36
40
  const { APP_PORT } = process.env;
41
+
37
42
  let clientPort = APP_PORT;
38
43
  let serverPort;
44
+
39
45
  nodeCheck();
46
+
40
47
  await postCheck(opts);
48
+
41
49
  if (server) {
42
50
  serverPort = APP_PORT;
43
51
  } else if (!server && !client) {
@@ -45,10 +53,11 @@ module.exports = (cli) => {
45
53
  port: 1 * clientPort + 1,
46
54
  });
47
55
  }
56
+
48
57
  await runAppCommand('install', ['--silent']);
49
- if (opts.dbSync) {
50
- await runAppCommand('db:sync');
51
- }
58
+ // if (opts.dbSync) {
59
+ // await runAppCommand('db:sync');
60
+ // }
52
61
  if (server || !client) {
53
62
  console.log('starting server', serverPort);
54
63
  const argv = [
@@ -61,6 +70,9 @@ module.exports = (cli) => {
61
70
  ...process.argv.slice(3),
62
71
  `--port=${serverPort}`,
63
72
  ];
73
+ if (opts.dbSync) {
74
+ argv.push('--db-sync');
75
+ }
64
76
  run('ts-node-dev', argv, {
65
77
  env: {
66
78
  APP_PORT: serverPort,
@@ -73,7 +85,8 @@ module.exports = (cli) => {
73
85
  env: {
74
86
  PORT: clientPort,
75
87
  APP_ROOT: `packages/${APP_PACKAGE_ROOT}/client`,
76
- PROXY_TARGET_URL: process.env.PROXY_TARGET_URL || (serverPort ? `http://127.0.0.1:${serverPort}` : undefined),
88
+ PROXY_TARGET_URL:
89
+ process.env.PROXY_TARGET_URL || (serverPort ? `http://127.0.0.1:${serverPort}` : undefined),
77
90
  },
78
91
  });
79
92
  }
@@ -21,6 +21,10 @@ module.exports = (cli) => {
21
21
  const content = await readFile(resolve(cwd, '.env.example'), 'utf-8');
22
22
  await writeFile(resolve(cwd, '.env'), content, 'utf-8');
23
23
  }
24
+ if (!existsSync(resolve(cwd, '.env.test')) && existsSync(resolve(cwd, '.env.test.example'))) {
25
+ const content = await readFile(resolve(cwd, '.env.test.example'), 'utf-8');
26
+ await writeFile(resolve(cwd, '.env.test'), content, 'utf-8');
27
+ }
24
28
  if (!isPackageValid('umi')) {
25
29
  return;
26
30
  }
@@ -15,17 +15,12 @@ module.exports = (cli) => {
15
15
  .option('-p, --port [port]')
16
16
  .option('-d, --daemon')
17
17
  .option('--db-sync')
18
+ .option('--quickstart')
18
19
  .allowUnknownOption()
19
20
  .action(async (opts) => {
20
21
  if (opts.port) {
21
22
  process.env.APP_PORT = opts.port;
22
23
  }
23
- if (process.platform === 'win32') {
24
- console.log(
25
- chalk.yellow(`It is not supported on win platform, please use \`${chalk.green('yarn dev')}\` instead`),
26
- );
27
- return;
28
- }
29
24
  if (process.argv.includes('-h') || process.argv.includes('--help')) {
30
25
  promptForTs();
31
26
  run('ts-node', [
@@ -46,6 +41,10 @@ module.exports = (cli) => {
46
41
  return;
47
42
  }
48
43
  await postCheck(opts);
44
+ if (opts.quickstart) {
45
+ await run('node', [`./packages/${APP_PACKAGE_ROOT}/server/lib/index.js`, 'install', '--ignore-installed']);
46
+ await run('node', [`./packages/${APP_PACKAGE_ROOT}/server/lib/index.js`, 'upgrade']);
47
+ }
49
48
  if (opts.dbSync) {
50
49
  await run('node', [`./packages/${APP_PACKAGE_ROOT}/server/lib/index.js`, 'db:sync']);
51
50
  }