@nocobase/cli 0.13.0-alpha.4 → 0.13.0-alpha.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/bin/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  const dotenv = require('dotenv');
4
4
  const { resolve } = require('path');
5
5
  const { existsSync } = require('fs');
6
+ const chalk = require('chalk');
6
7
 
7
8
  const env = {
8
9
  APP_ENV: 'development',
@@ -35,6 +36,11 @@ for (const key in env) {
35
36
  }
36
37
  }
37
38
 
39
+ if (require('semver').satisfies(process.version, '<16')) {
40
+ console.error(chalk.red('[nocobase cli]: Node.js version must be >= 16'));
41
+ process.exit(1);
42
+ }
43
+
38
44
  if (require('semver').satisfies(process.version, '>16') && !process.env.UNSET_NODE_OPTIONS) {
39
45
  if (process.env.NODE_OPTIONS) {
40
46
  let opts = process.env.NODE_OPTIONS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/cli",
3
- "version": "0.13.0-alpha.4",
3
+ "version": "0.13.0-alpha.5",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./src/index.js",
@@ -8,7 +8,7 @@
8
8
  "nocobase": "./bin/index.js"
9
9
  },
10
10
  "dependencies": {
11
- "@nocobase/app": "0.13.0-alpha.4",
11
+ "@nocobase/app": "0.13.0-alpha.5",
12
12
  "@types/fs-extra": "^11.0.1",
13
13
  "@umijs/utils": "3.5.20",
14
14
  "chalk": "^4.1.1",
@@ -24,12 +24,12 @@
24
24
  "tsx": "^3.12.7"
25
25
  },
26
26
  "devDependencies": {
27
- "@nocobase/devtools": "0.13.0-alpha.4"
27
+ "@nocobase/devtools": "0.13.0-alpha.5"
28
28
  },
29
29
  "repository": {
30
30
  "type": "git",
31
31
  "url": "git+https://github.com/nocobase/nocobase.git",
32
32
  "directory": "packages/core/cli"
33
33
  },
34
- "gitHead": "29594e9dbb2455e2f3f6bea95340c4ed75789b61"
34
+ "gitHead": "9eabe607b4a20c356fdb2fd95e40fa476986dcb0"
35
35
  }
@@ -1,41 +1,34 @@
1
- const { resolve, dirname } = require('path');
1
+ const { resolve } = require('path');
2
2
  const { Command } = require('commander');
3
- const { run, nodeCheck, isPackageValid, promptForTs, hasCorePackages } = require('../util');
3
+ const { run, nodeCheck, isPackageValid } = require('../util');
4
4
 
5
5
  /**
6
6
  *
7
7
  * @param {Command} cli
8
8
  */
9
9
  module.exports = (cli) => {
10
- const { APP_PACKAGE_ROOT } = process.env;
11
- const clientPackage = `core/app`;
12
10
  cli
13
11
  .command('build')
14
12
  .allowUnknownOption()
15
13
  .argument('[packages...]')
14
+ .option('-v, --version', 'print version')
16
15
  .option('-c, --compile', 'compile the @nocobase/build package')
16
+ .option('-w, --watch', 'watch compile the @nocobase/build package')
17
+ .option('-s, --sourcemap', 'generate sourcemap')
18
+ .option('--no-dts', 'not generate dts')
17
19
  .action(async (pkgs, options) => {
18
- promptForTs();
19
20
  nodeCheck();
20
- if (isPackageValid('umi-tools/cli')) {
21
- if (options.compile || !isPackageValid('@nocobase/build/lib')) {
22
- await run('umi-tools', ['build'], {
23
- cwd: resolve(process.cwd(), 'packages/core/build'),
24
- });
25
- }
26
- }
27
- await run('nocobase-build', process.argv.slice(3));
28
- if (!hasCorePackages()) {
29
- return;
30
- }
31
- if (!pkgs.length || pkgs.includes(clientPackage)) {
32
- const file = require.resolve('@nocobase/app');
33
- await run('umi', ['build'], {
34
- env: {
35
- APP_ROOT: `${dirname(dirname(file))}/client`,
36
- NODE_ENV: 'production',
37
- },
21
+ if (options.compile || options.watch || isPackageValid('@nocobase/build/src/index.ts')) {
22
+ await run('yarn', ['build', options.watch ? '--watch' : ''], {
23
+ cwd: resolve(process.cwd(), 'packages/core/build'),
38
24
  });
25
+ if (options.watch) return;
39
26
  }
27
+ await run('nocobase-build', [
28
+ ...pkgs,
29
+ options.version ? '--version' : '',
30
+ !options.dts ? '--no-dts' : '',
31
+ options.sourcemap ? '--sourcemap' : '',
32
+ ]);
40
33
  });
41
34
  };