create-nocobase-app 0.7.0-alpha.56 → 0.7.0-alpha.57
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 +2 -2
- package/src/cli.js +1 -1
- package/src/generator.js +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nocobase-app",
|
|
3
|
-
"version": "0.7.0-alpha.
|
|
3
|
+
"version": "0.7.0-alpha.57",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"licenses": [
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
25
25
|
"directory": "packages/core/create-nocobase-app"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "33f076e430645055d79254592971c50d9f131a6d"
|
|
28
28
|
}
|
package/src/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ const cli = new Command('create-nocobase');
|
|
|
10
10
|
cli
|
|
11
11
|
.arguments('<name>', 'directory of new NocoBase app')
|
|
12
12
|
.option('--quickstart', 'quickstart app creation')
|
|
13
|
-
.option('--all-db-
|
|
13
|
+
.option('-a, --all-db-dialect', 'install all database dialect dependencies')
|
|
14
14
|
.option('-d, --db-dialect <dbDialect>', 'database dialect, current support sqlite/mysql/postgres', 'sqlite')
|
|
15
15
|
.option('-e, --env <env>', 'environment variables write into .env file', concat, [])
|
|
16
16
|
.description('create a new application')
|
package/src/generator.js
CHANGED
|
@@ -66,9 +66,9 @@ class AppGenerator extends Generator {
|
|
|
66
66
|
const env = this.env;
|
|
67
67
|
const envs = [];
|
|
68
68
|
const dependencies = [];
|
|
69
|
-
const { dbDialect,
|
|
69
|
+
const { dbDialect, allDbDialect } = this.args;
|
|
70
70
|
|
|
71
|
-
if (
|
|
71
|
+
if (allDbDialect) {
|
|
72
72
|
dependencies.push(`"mysql2": "^2.3.3"`);
|
|
73
73
|
dependencies.push(`"pg": "^8.7.3"`);
|
|
74
74
|
dependencies.push(`"pg-hstore": "^2.3.4"`);
|
|
@@ -77,13 +77,13 @@ class AppGenerator extends Generator {
|
|
|
77
77
|
|
|
78
78
|
switch (dbDialect) {
|
|
79
79
|
case 'sqlite':
|
|
80
|
-
if (!
|
|
80
|
+
if (!allDbDialect) {
|
|
81
81
|
dependencies.push(`"sqlite3": "^5.0.8"`);
|
|
82
82
|
}
|
|
83
83
|
envs.push(`DB_STORAGE=${env.DB_STORAGE || 'storages/db/nocobase.sqlite'}`);
|
|
84
84
|
break;
|
|
85
85
|
case 'mysql':
|
|
86
|
-
if (!
|
|
86
|
+
if (!allDbDialect) {
|
|
87
87
|
dependencies.push(`"mysql2": "^2.3.3"`);
|
|
88
88
|
}
|
|
89
89
|
envs.push(`DB_HOST=${env.DB_HOST || 'localhost'}`);
|
|
@@ -93,7 +93,7 @@ class AppGenerator extends Generator {
|
|
|
93
93
|
envs.push(`DB_PASSWORD=${env.DB_PASSWORD || ''}`);
|
|
94
94
|
break;
|
|
95
95
|
case 'postgres':
|
|
96
|
-
if (!
|
|
96
|
+
if (!allDbDialect) {
|
|
97
97
|
dependencies.push(`"pg": "^8.7.3"`);
|
|
98
98
|
dependencies.push(`"pg-hstore": "^2.3.4"`);
|
|
99
99
|
}
|
|
@@ -125,7 +125,7 @@ class AppGenerator extends Generator {
|
|
|
125
125
|
const serverPackageDir = resolve(this.cwd, 'packages/app/server');
|
|
126
126
|
await downloadPackageFromNpm('@nocobase/app-server', serverPackageDir);
|
|
127
127
|
await updateJsonFile(resolve(serverPackageDir, 'package.json'), (data) => {
|
|
128
|
-
data['name'] = `@${name}/server`;
|
|
128
|
+
data['name'] = `@${name}/app-server`;
|
|
129
129
|
data['version'] = '0.1.0';
|
|
130
130
|
return data;
|
|
131
131
|
});
|
|
@@ -137,7 +137,7 @@ class AppGenerator extends Generator {
|
|
|
137
137
|
const clientPackageDir = resolve(this.cwd, 'packages/app/client');
|
|
138
138
|
await downloadPackageFromNpm('@nocobase/app-client', clientPackageDir);
|
|
139
139
|
await updateJsonFile(resolve(clientPackageDir, 'package.json'), (data) => {
|
|
140
|
-
data['name'] = `@${name}/client`;
|
|
140
|
+
data['name'] = `@${name}/app-client`;
|
|
141
141
|
data['version'] = '0.1.0';
|
|
142
142
|
return data;
|
|
143
143
|
});
|