create-nocobase-app 0.7.0-alpha.3 → 0.7.0-alpha.32
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 +3 -2
- package/src/create-app.js +13 -1
- package/src/resources/files/storage/db/.gitignore +2 -0
- package/src/resources/files/storage/uploads/.gitignore +2 -0
- package/src/resources/files/tsconfig.jest.json +1 -3
- package/src/resources/files/tsconfig.json +1 -3
- package/src/resources/templates/client.package.json.js +16 -0
- package/src/resources/templates/env.js +1 -1
- package/src/resources/templates/env.template +8 -3
- package/src/resources/templates/load-src-from-npm.js +4 -4
- package/src/resources/templates/package.json.js +10 -5
- package/src/resources/templates/server.package.json.js +1 -1
- package/src/resources/files/packages/app/client/.gitkeep +0 -0
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.32",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"licenses": [
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"commander": "^8.2.0",
|
|
17
17
|
"execa": "5",
|
|
18
18
|
"fs-extra": "^10.0.1",
|
|
19
|
+
"lodash": "^4.17.21",
|
|
19
20
|
"ora": "^5.4.1",
|
|
20
21
|
"tar": "^6.1.11"
|
|
21
22
|
},
|
|
@@ -25,5 +26,5 @@
|
|
|
25
26
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
26
27
|
"directory": "packages/core/create-nocobase-app"
|
|
27
28
|
},
|
|
28
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "fbe14de5c02aeaa460d143245abf317c4ff2e3a9"
|
|
29
30
|
}
|
package/src/create-app.js
CHANGED
|
@@ -9,6 +9,7 @@ const { join, resolve } = require('path');
|
|
|
9
9
|
const createEnvFile = require('./resources/templates/env');
|
|
10
10
|
const createPackageJson = require('./resources/templates/package.json.js');
|
|
11
11
|
const createServerPackageJson = require('./resources/templates/server.package.json.js');
|
|
12
|
+
const createClientPackageJson = require('./resources/templates/client.package.json.js');
|
|
12
13
|
const loadSrcFromNpm = require('./resources/templates/load-src-from-npm');
|
|
13
14
|
|
|
14
15
|
let envs = undefined;
|
|
@@ -53,7 +54,7 @@ const getDatabaseOptionsFromCommandOptions = (commandOptions) => {
|
|
|
53
54
|
if (!commandOptions.dbDialect || commandOptions.dbDialect === 'sqlite' || envs['DB_STORAGE']) {
|
|
54
55
|
return {
|
|
55
56
|
dialect: 'sqlite',
|
|
56
|
-
storage: envs['DB_STORAGE'] || 'db.sqlite',
|
|
57
|
+
storage: envs['DB_STORAGE'] || 'storage/db/nocobase.sqlite',
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -135,6 +136,17 @@ async function createApp(directory, options) {
|
|
|
135
136
|
},
|
|
136
137
|
);
|
|
137
138
|
|
|
139
|
+
// write client package.json
|
|
140
|
+
await fse.writeJson(
|
|
141
|
+
join(projectPath, 'packages/app/client/package.json'),
|
|
142
|
+
createClientPackageJson({
|
|
143
|
+
projectPath,
|
|
144
|
+
}),
|
|
145
|
+
{
|
|
146
|
+
spaces: 2,
|
|
147
|
+
},
|
|
148
|
+
);
|
|
149
|
+
|
|
138
150
|
// run install command
|
|
139
151
|
console.log('finished');
|
|
140
152
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
module.exports = (opts) => {
|
|
4
|
+
const { projectPath } = opts;
|
|
5
|
+
const templateJsonPath = path.join(projectPath, 'packages/app/client/package.json');
|
|
6
|
+
const templateJson = require(templateJsonPath);
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
...templateJson,
|
|
10
|
+
name: 'app-client',
|
|
11
|
+
version: '0.1.0',
|
|
12
|
+
dependencies: {
|
|
13
|
+
...templateJson.dependencies,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -22,7 +22,7 @@ module.exports = (options) => {
|
|
|
22
22
|
|
|
23
23
|
for (const env of Object.entries(envs)) {
|
|
24
24
|
const [key, value] = env;
|
|
25
|
-
const re = new RegExp(
|
|
25
|
+
const re = new RegExp(`^${key}=(.+)`, 'm');
|
|
26
26
|
if (envContent.match(re)) {
|
|
27
27
|
envContent = envContent.replace(re, `${key}=${value}`);
|
|
28
28
|
} else {
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
+
################# NOCOBASE APPLICATION #################
|
|
2
|
+
|
|
1
3
|
NOCOBASE_ENV=development
|
|
4
|
+
JWT_SECRET=<%= jwtSecret %>
|
|
2
5
|
|
|
3
6
|
SERVER_HOST=0.0.0.0
|
|
4
7
|
SERVER_PORT=3000
|
|
5
8
|
|
|
6
|
-
JWT_SECRET=<%= jwtSecret %>
|
|
7
|
-
|
|
8
9
|
# api base path endpoint for app(web)
|
|
9
10
|
SERVER_BASE_PATH=/api/
|
|
10
11
|
|
|
11
12
|
# api server access point for app(web when build)
|
|
12
13
|
SERVER_BASE_URL=
|
|
13
14
|
|
|
15
|
+
################# DATABASE #################
|
|
16
|
+
|
|
14
17
|
DB_LOG_SQL=off
|
|
15
18
|
<%= dbEnvs %>
|
|
16
19
|
|
|
20
|
+
################# STORAGE (Initialization only) #################
|
|
21
|
+
|
|
17
22
|
# local or ali-oss
|
|
18
23
|
DEFAULT_STORAGE_TYPE=local
|
|
19
|
-
STORAGE_TYPE=local
|
|
20
24
|
|
|
21
25
|
# LOCAL STORAGE
|
|
22
26
|
LOCAL_STORAGE_USE_STATIC_SERVER=true
|
|
23
27
|
LOCAL_STORAGE_BASE_URL=
|
|
28
|
+
LOCAL_STORAGE_DEST=storage/uploads
|
|
24
29
|
|
|
25
30
|
# ALI OSS STORAGE
|
|
26
31
|
ALI_OSS_STORAGE_BASE_URL=
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const execa = require('execa');
|
|
2
2
|
const axios = require('axios');
|
|
3
3
|
const fs = require('fs');
|
|
4
|
-
const fsP = require('fs
|
|
4
|
+
const fsP = require('fs').promises;
|
|
5
5
|
const tar = require('tar');
|
|
6
6
|
const { join } = require('path');
|
|
7
7
|
const crypto = require('crypto');
|
|
@@ -40,9 +40,9 @@ module.exports = async (packageName, target) => {
|
|
|
40
40
|
cwd: target,
|
|
41
41
|
strip: 1,
|
|
42
42
|
k: true,
|
|
43
|
-
filter(path, entry) {
|
|
44
|
-
|
|
45
|
-
},
|
|
43
|
+
// filter(path, entry) {
|
|
44
|
+
// return !(path.startsWith('package/lib') || path.startsWith('package/esm') || path.startsWith('package/dist'));
|
|
45
|
+
// },
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
await fsP.unlink(tarballFile);
|
|
@@ -7,13 +7,15 @@ module.exports = (opts) => {
|
|
|
7
7
|
workspaces: ['packages/app/*', 'packages/plugins/*'],
|
|
8
8
|
license: 'MIT',
|
|
9
9
|
scripts: {
|
|
10
|
-
start: 'concurrently --kill-others "
|
|
10
|
+
start: 'concurrently --kill-others "yarn start-server -s" "yarn start-client"',
|
|
11
11
|
bootstrap: 'lerna bootstrap',
|
|
12
12
|
clean: 'rimraf -rf packages/{app,plugins}/*/{lib,esm,dist} && lerna clean',
|
|
13
13
|
nocobase:
|
|
14
14
|
'cross-env DOTENV_CONFIG_PATH=.env ts-node-dev -r dotenv/config -r tsconfig-paths/register ./packages/app/server/src/index.ts',
|
|
15
|
-
'
|
|
16
|
-
'start-
|
|
15
|
+
'nocobase-prod': 'cross-env DOTENV_CONFIG_PATH=.env node -r dotenv/config packages/app/server/lib/index.js',
|
|
16
|
+
'start-client': 'cd packages/app/client && yarn start',
|
|
17
|
+
'start-server': 'yarn nocobase start',
|
|
18
|
+
'start-pm2': 'pm2-runtime start --node-args="-r dotenv/config" packages/app/server/lib/index.js -- start',
|
|
17
19
|
build: 'lerna run build',
|
|
18
20
|
'build-docs': 'dumi build',
|
|
19
21
|
test: 'node ./jest.cli.js -i',
|
|
@@ -23,6 +25,11 @@ module.exports = (opts) => {
|
|
|
23
25
|
'@types/react': '^17.0.0',
|
|
24
26
|
'@types/react-dom': '^17.0.0',
|
|
25
27
|
},
|
|
28
|
+
dependencies: {
|
|
29
|
+
'cross-env': '^7.0.3',
|
|
30
|
+
dotenv: '^10.0.0',
|
|
31
|
+
pm2: '^5.2.0',
|
|
32
|
+
},
|
|
26
33
|
devDependencies: {
|
|
27
34
|
'@testing-library/react': '^12.1.2',
|
|
28
35
|
'@types/jest': '^26.0.0',
|
|
@@ -32,8 +39,6 @@ module.exports = (opts) => {
|
|
|
32
39
|
'@typescript-eslint/eslint-plugin': '^4.9.1',
|
|
33
40
|
'@typescript-eslint/parser': '^4.8.2',
|
|
34
41
|
concurrently: '^7.0.0',
|
|
35
|
-
'cross-env': '^7.0.3',
|
|
36
|
-
dotenv: '^10.0.0',
|
|
37
42
|
eslint: '^7.14.0',
|
|
38
43
|
'eslint-config-prettier': '^7.0.0',
|
|
39
44
|
'eslint-plugin-import': '^2.13.0',
|
|
File without changes
|