From ecc31a29b28d6ac5d2d5c16f433decfbfa74b066 Mon Sep 17 00:00:00 2001 From: chenos Date: Sat, 19 Mar 2022 20:50:22 +0800 Subject: [PATCH] chore: add build scripts --- package.json | 1 + packages/api/src/index.ts | 2 ++ packages/plugin-client/package.json | 5 +++++ packages/plugin-client/tsconfig.build.json | 9 +++++++++ packages/plugin-client/tsconfig.json | 5 +++++ packages/plugin-collection-manager/package.json | 5 +++++ packages/plugin-collection-manager/tsconfig.build.json | 9 +++++++++ packages/plugin-collection-manager/tsconfig.json | 5 +++++ packages/plugin-ui-routes-storage/package.json | 5 +++++ packages/plugin-ui-routes-storage/tsconfig.build.json | 9 +++++++++ packages/plugin-ui-routes-storage/tsconfig.json | 5 +++++ 11 files changed, 60 insertions(+) create mode 100644 packages/plugin-client/tsconfig.build.json create mode 100644 packages/plugin-client/tsconfig.json create mode 100644 packages/plugin-collection-manager/tsconfig.build.json create mode 100644 packages/plugin-collection-manager/tsconfig.json create mode 100644 packages/plugin-ui-routes-storage/tsconfig.build.json create mode 100644 packages/plugin-ui-routes-storage/tsconfig.json diff --git a/package.json b/package.json index da8b651aa..6696e8687 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ ], "scripts": { "start": "concurrently \"npm run start-server\" \"npm run start-client\"", + "start-pm2": "yarn pm2-runtime start packages/api/lib/index.js", "start-docs": "dumi dev", "bootstrap": "lerna bootstrap", "clean": "rimraf -rf packages/*/{lib,esm,dist} && lerna clean", diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index b963ba172..a652e2a0e 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -1,6 +1,8 @@ import { Application } from '@nocobase/server'; import { resolve } from 'path'; +require('dotenv').config({ path: resolve(process.cwd(), '.env') }); + const start = Date.now(); const api = new Application({ diff --git a/packages/plugin-client/package.json b/packages/plugin-client/package.json index 4efbbcc10..ed11c5707 100644 --- a/packages/plugin-client/package.json +++ b/packages/plugin-client/package.json @@ -3,6 +3,11 @@ "version": "0.6.0-alpha.0", "main": "lib/index.js", "license": "MIT", + "scripts": { + "build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --project tsconfig.build.json", + "build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm" + }, "dependencies": { "@nocobase/server": "^0.6.0-alpha.0" }, diff --git a/packages/plugin-client/tsconfig.build.json b/packages/plugin-client/tsconfig.build.json new file mode 100644 index 000000000..8d3db734b --- /dev/null +++ b/packages/plugin-client/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "outDir": "./lib", + "declaration": true + }, + "include": ["./src/**/*.ts", "./src/**/*.tsx"], + "exclude": ["./src/__tests__/*", "./esm/*", "./lib/*"] +} \ No newline at end of file diff --git a/packages/plugin-client/tsconfig.json b/packages/plugin-client/tsconfig.json new file mode 100644 index 000000000..e10a5305a --- /dev/null +++ b/packages/plugin-client/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../../tsconfig.json", + "include": ["./src/**/*.ts", "./src/**/*.tsx"], + "exclude": ["./esm/*", "./lib/*"] +} \ No newline at end of file diff --git a/packages/plugin-collection-manager/package.json b/packages/plugin-collection-manager/package.json index 4ce6ff891..5f0c1536c 100644 --- a/packages/plugin-collection-manager/package.json +++ b/packages/plugin-collection-manager/package.json @@ -3,6 +3,11 @@ "version": "0.6.0-alpha.0", "main": "lib/index.js", "license": "MIT", + "scripts": { + "build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --project tsconfig.build.json", + "build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm" + }, "dependencies": {}, "devDependencies": { "@nocobase/test": "^0.6.0-alpha.0" diff --git a/packages/plugin-collection-manager/tsconfig.build.json b/packages/plugin-collection-manager/tsconfig.build.json new file mode 100644 index 000000000..8d3db734b --- /dev/null +++ b/packages/plugin-collection-manager/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "outDir": "./lib", + "declaration": true + }, + "include": ["./src/**/*.ts", "./src/**/*.tsx"], + "exclude": ["./src/__tests__/*", "./esm/*", "./lib/*"] +} \ No newline at end of file diff --git a/packages/plugin-collection-manager/tsconfig.json b/packages/plugin-collection-manager/tsconfig.json new file mode 100644 index 000000000..e10a5305a --- /dev/null +++ b/packages/plugin-collection-manager/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../../tsconfig.json", + "include": ["./src/**/*.ts", "./src/**/*.tsx"], + "exclude": ["./esm/*", "./lib/*"] +} \ No newline at end of file diff --git a/packages/plugin-ui-routes-storage/package.json b/packages/plugin-ui-routes-storage/package.json index bcacd7a8b..c3cbc6b46 100644 --- a/packages/plugin-ui-routes-storage/package.json +++ b/packages/plugin-ui-routes-storage/package.json @@ -3,6 +3,11 @@ "version": "0.5.0-alpha.38", "main": "lib/index.js", "license": "MIT", + "scripts": { + "build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --project tsconfig.build.json", + "build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm" + }, "dependencies": { "flat-to-nested": "^1.1.1" }, diff --git a/packages/plugin-ui-routes-storage/tsconfig.build.json b/packages/plugin-ui-routes-storage/tsconfig.build.json new file mode 100644 index 000000000..8d3db734b --- /dev/null +++ b/packages/plugin-ui-routes-storage/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "outDir": "./lib", + "declaration": true + }, + "include": ["./src/**/*.ts", "./src/**/*.tsx"], + "exclude": ["./src/__tests__/*", "./esm/*", "./lib/*"] +} \ No newline at end of file diff --git a/packages/plugin-ui-routes-storage/tsconfig.json b/packages/plugin-ui-routes-storage/tsconfig.json new file mode 100644 index 000000000..e10a5305a --- /dev/null +++ b/packages/plugin-ui-routes-storage/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../../tsconfig.json", + "include": ["./src/**/*.ts", "./src/**/*.tsx"], + "exclude": ["./esm/*", "./lib/*"] +} \ No newline at end of file