@nocobase/cli 1.6.22 → 1.6.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/cli",
3
- "version": "1.6.22",
3
+ "version": "1.6.24",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "./src/index.js",
@@ -8,28 +8,30 @@
8
8
  "nocobase": "./bin/index.js"
9
9
  },
10
10
  "dependencies": {
11
- "@nocobase/app": "1.6.22",
11
+ "@nocobase/app": "1.6.24",
12
12
  "@types/fs-extra": "^11.0.1",
13
13
  "@umijs/utils": "3.5.20",
14
14
  "chalk": "^4.1.1",
15
15
  "commander": "^9.2.0",
16
+ "deepmerge": "^4.3.1",
16
17
  "dotenv": "^16.0.0",
17
18
  "execa": "^5.1.1",
18
19
  "fast-glob": "^3.3.1",
19
20
  "fs-extra": "^11.1.1",
20
21
  "p-all": "3.0.0",
22
+ "pm2": "^6.0.5",
21
23
  "portfinder": "^1.0.28",
22
24
  "tar": "^7.4.3",
23
25
  "tree-kill": "^1.2.2",
24
26
  "tsx": "^4.19.0"
25
27
  },
26
28
  "devDependencies": {
27
- "@nocobase/devtools": "1.6.22"
29
+ "@nocobase/devtools": "1.6.24"
28
30
  },
29
31
  "repository": {
30
32
  "type": "git",
31
33
  "url": "git+https://github.com/nocobase/nocobase.git",
32
34
  "directory": "packages/core/cli"
33
35
  },
34
- "gitHead": "321c0effa18670c0c3edfa09c79d535351ef2b0d"
36
+ "gitHead": "d453b271bc1dedb56af2252dcb5d1a3ab9828ca1"
35
37
  }
@@ -30,6 +30,7 @@ module.exports = (cli) => {
30
30
  require('./test')(cli);
31
31
  require('./test-coverage')(cli);
32
32
  require('./umi')(cli);
33
+ require('./update-deps')(cli);
33
34
  require('./upgrade')(cli);
34
35
  require('./postinstall')(cli);
35
36
  require('./pkg')(cli);
@@ -0,0 +1,71 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ const chalk = require('chalk');
11
+ const { Command } = require('commander');
12
+ const { resolve } = require('path');
13
+ const { run, promptForTs, runAppCommand, hasCorePackages, downloadPro, hasTsNode, checkDBDialect } = require('../util');
14
+ const { existsSync, rmSync } = require('fs');
15
+ const { readJSON, writeJSON } = require('fs-extra');
16
+ const deepmerge = require('deepmerge');
17
+
18
+ const rmAppDir = () => {
19
+ // If ts-node is not installed, do not do the following
20
+ const appDevDir = resolve(process.cwd(), './storage/.app-dev');
21
+ if (existsSync(appDevDir)) {
22
+ rmSync(appDevDir, { recursive: true, force: true });
23
+ }
24
+ };
25
+
26
+ /**
27
+ *
28
+ * @param {Command} cli
29
+ */
30
+ module.exports = (cli) => {
31
+ cli
32
+ .command('update-deps')
33
+ .option('--force')
34
+ .allowUnknownOption()
35
+ .action(async (options) => {
36
+ if (hasCorePackages() || !hasTsNode()) {
37
+ await downloadPro();
38
+ return;
39
+ }
40
+ const pkg = require('../../package.json');
41
+ let distTag = 'latest';
42
+ if (pkg.version.includes('alpha')) {
43
+ distTag = 'alpha';
44
+ } else if (pkg.version.includes('beta')) {
45
+ distTag = 'beta';
46
+ }
47
+ const { stdout } = await run('npm', ['info', `@nocobase/cli@${distTag}`, 'version'], {
48
+ stdio: 'pipe',
49
+ });
50
+ if (!options.force && pkg.version === stdout) {
51
+ await downloadPro();
52
+ rmAppDir();
53
+ return;
54
+ }
55
+ const descPath = resolve(process.cwd(), 'package.json');
56
+ const descJson = await readJSON(descPath, 'utf8');
57
+ const sourcePath = resolve(__dirname, '../../templates/create-app-package.json');
58
+ const sourceJson = await readJSON(sourcePath, 'utf8');
59
+ if (descJson['dependencies']?.['@nocobase/cli']) {
60
+ descJson['dependencies']['@nocobase/cli'] = stdout;
61
+ }
62
+ if (descJson['devDependencies']?.['@nocobase/devtools']) {
63
+ descJson['devDependencies']['@nocobase/devtools'] = stdout;
64
+ }
65
+ const json = deepmerge(descJson, sourceJson);
66
+ await writeJSON(descPath, json, { spaces: 2, encoding: 'utf8' });
67
+ await run('yarn', ['install']);
68
+ await downloadPro();
69
+ rmAppDir();
70
+ });
71
+ };
@@ -12,13 +12,23 @@ const { Command } = require('commander');
12
12
  const { resolve } = require('path');
13
13
  const { run, promptForTs, runAppCommand, hasCorePackages, downloadPro, hasTsNode, checkDBDialect } = require('../util');
14
14
  const { existsSync, rmSync } = require('fs');
15
+ const { readJSON, writeJSON } = require('fs-extra');
16
+ const deepmerge = require('deepmerge');
17
+
18
+ async function updatePackage() {
19
+ const sourcePath = resolve(__dirname, '../../templates/create-app-package.json');
20
+ const descPath = resolve(process.cwd(), 'package.json');
21
+ const sourceJson = await readJSON(sourcePath, 'utf8');
22
+ const descJson = await readJSON(descPath, 'utf8');
23
+ const json = deepmerge(descJson, sourceJson);
24
+ await writeJSON(descPath, json, { spaces: 2, encoding: 'utf8' });
25
+ }
15
26
 
16
27
  /**
17
28
  *
18
29
  * @param {Command} cli
19
30
  */
20
31
  module.exports = (cli) => {
21
- const { APP_PACKAGE_ROOT } = process.env;
22
32
  cli
23
33
  .command('upgrade')
24
34
  .allowUnknownOption()
@@ -27,52 +37,11 @@ module.exports = (cli) => {
27
37
  .option('-S|--skip-code-update')
28
38
  .action(async (options) => {
29
39
  checkDBDialect();
30
- if (hasTsNode()) promptForTs();
31
- if (hasCorePackages()) {
32
- // await run('yarn', ['install']);
33
- await downloadPro();
34
- await runAppCommand('upgrade');
35
- return;
36
- }
37
40
  if (options.skipCodeUpdate) {
38
- await downloadPro();
39
- await runAppCommand('upgrade');
40
- return;
41
- }
42
- // await runAppCommand('upgrade');
43
- if (!hasTsNode()) {
44
- await downloadPro();
45
- await runAppCommand('upgrade');
46
- return;
47
- }
48
- const rmAppDir = () => {
49
- // If ts-node is not installed, do not do the following
50
- const appDevDir = resolve(process.cwd(), './storage/.app-dev');
51
- if (existsSync(appDevDir)) {
52
- rmSync(appDevDir, { recursive: true, force: true });
53
- }
54
- };
55
- const pkg = require('../../package.json');
56
- let distTag = 'latest';
57
- if (pkg.version.includes('alpha')) {
58
- distTag = 'alpha';
59
- } else if (pkg.version.includes('beta')) {
60
- distTag = 'beta';
61
- }
62
- // get latest version
63
- const { stdout } = await run('npm', ['info', `@nocobase/cli@${distTag}`, 'version'], {
64
- stdio: 'pipe',
65
- });
66
- if (pkg.version === stdout) {
67
- await downloadPro();
68
41
  await runAppCommand('upgrade');
69
- await rmAppDir();
70
- return;
42
+ } else {
43
+ await run('nocobase', ['update-deps']);
44
+ await run('nocobase', ['upgrade', '--skip-code-update']);
71
45
  }
72
- await run('yarn', ['add', `@nocobase/cli@${distTag}`, `@nocobase/devtools@${distTag}`, '-W']);
73
- await run('yarn', ['install']);
74
- await downloadPro();
75
- await runAppCommand('upgrade');
76
- await rmAppDir();
77
46
  });
78
47
  };
@@ -0,0 +1,39 @@
1
+ {
2
+ "private": true,
3
+ "workspaces": ["packages/*/*", "packages/*/*/*"],
4
+ "engines": {
5
+ "node": ">=18"
6
+ },
7
+ "scripts": {
8
+ "nocobase": "nocobase",
9
+ "pm": "nocobase pm",
10
+ "pm2": "nocobase pm2",
11
+ "dev": "nocobase dev",
12
+ "start": "nocobase start",
13
+ "clean": "nocobase clean",
14
+ "build": "nocobase build",
15
+ "test": "nocobase test",
16
+ "e2e": "nocobase e2e",
17
+ "tar": "nocobase tar",
18
+ "postinstall": "nocobase postinstall",
19
+ "lint": "eslint ."
20
+ },
21
+ "resolutions": {
22
+ "cytoscape": "3.28.0",
23
+ "@types/react": "18.3.18",
24
+ "@types/react-dom": "^18.0.0",
25
+ "react-router-dom": "6.28.1",
26
+ "react-router": "6.28.1",
27
+ "async": "^3.2.6",
28
+ "antd": "5.12.8",
29
+ "rollup": "4.24.0",
30
+ "semver": "^7.7.1"
31
+ },
32
+ "dependencies": {
33
+ "pm2": "^6.0.5",
34
+ "mysql2": "^3.14.0",
35
+ "mariadb": "^3.4.1",
36
+ "pg": "^8.14.1",
37
+ "pg-hstore": "^2.3.4"
38
+ }
39
+ }