fix: create-nocobase-app client package version (#321)

* fix: create-nocobase-app client package version

* chore: create-nocobase-app package name

* feat: nocobase-prod script

* chore: npm registry

Co-authored-by: chenos <chenlinxh@gmail.com>
This commit is contained in:
ChengLei Shao 2022-04-25 22:05:05 +08:00 committed by GitHub
parent 0bda80e323
commit 219dbee467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 11 deletions

View File

@ -98,8 +98,8 @@ yarn create nocobase-app my-nocobase-app -d postgres \
# 2. 切换目录 # 2. 切换目录
cd my-nocobase-app cd my-nocobase-app
# 3. 安装依赖 # 3. 安装依赖(使用阿里云镜像)
yarn install yarn install --registry=https://registry.npmmirror.com
# 4. 安装 NocoBase # 4. 安装 NocoBase
yarn nocobase install --lang=zh-CN yarn nocobase install --lang=zh-CN

View File

@ -4,8 +4,8 @@ WORKDIR /app
# COPY . /app # COPY . /app
RUN ls -a RUN ls -a
RUN npm config set registry https://registry.npm.taobao.org RUN npm config set registry https://registry.npmmirror.com
RUN yarn config set registry https://registry.npm.taobao.org RUN yarn config set registry https://registry.npmmirror.com
# RUN npm install # RUN npm install
# RUN npm run bootstrap # RUN npm run bootstrap

View File

@ -9,6 +9,7 @@ const { join, resolve } = require('path');
const createEnvFile = require('./resources/templates/env'); const createEnvFile = require('./resources/templates/env');
const createPackageJson = require('./resources/templates/package.json.js'); const createPackageJson = require('./resources/templates/package.json.js');
const createServerPackageJson = require('./resources/templates/server.package.json.js'); const createServerPackageJson = require('./resources/templates/server.package.json.js');
const createClientPackageJson = require('./resources/templates/client.package.json.js');
const loadSrcFromNpm = require('./resources/templates/load-src-from-npm'); const loadSrcFromNpm = require('./resources/templates/load-src-from-npm');
let envs = undefined; let envs = undefined;
@ -135,6 +136,17 @@ async function createApp(directory, options) {
}, },
); );
// write client package.json
await fse.writeJson(
join(projectPath, 'packages/app/client/package.json'),
createClientPackageJson({
projectPath,
}),
{
spaces: 2,
},
);
// run install command // run install command
console.log('finished'); console.log('finished');
} }

View File

@ -8,9 +8,7 @@
"allowJs": true, "allowJs": true,
"module": "commonjs", "module": "commonjs",
"target": "es6", "target": "es6",
"paths": { "paths": {}
"@nocobase/*": ["./packages/*/src"]
}
}, },
"exclude": ["./packages/*/esm", "./packages/*/lib"] "exclude": ["./packages/*/esm", "./packages/*/lib"]
} }

View File

@ -16,8 +16,6 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"downlevelIteration": true, "downlevelIteration": true,
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {}
"@nocobase/*": ["packages/*/src"]
}
} }
} }

View File

@ -0,0 +1,16 @@
const path = require('path');
module.exports = (opts) => {
const { projectPath } = opts;
const templateJsonPath = path.join(projectPath, 'packages/app/client/package.json');
const templateJson = require(templateJsonPath);
return {
...templateJson,
name: 'app-client',
version: '0.1.0',
dependencies: {
...templateJson.dependencies,
},
};
};

View File

@ -12,6 +12,7 @@ module.exports = (opts) => {
clean: 'rimraf -rf packages/{app,plugins}/*/{lib,esm,dist} && lerna clean', clean: 'rimraf -rf packages/{app,plugins}/*/{lib,esm,dist} && lerna clean',
nocobase: nocobase:
'cross-env DOTENV_CONFIG_PATH=.env ts-node-dev -r dotenv/config -r tsconfig-paths/register ./packages/app/server/src/index.ts', 'cross-env DOTENV_CONFIG_PATH=.env ts-node-dev -r dotenv/config -r tsconfig-paths/register ./packages/app/server/src/index.ts',
'nocobase-prod': 'cross-env DOTENV_CONFIG_PATH=.env node -r dotenv/config packages/app/server/lib/index.js',
'start-client': 'cd packages/app/client && npm run start', 'start-client': 'cd packages/app/client && npm run start',
'start-server': 'npm run nocobase start', 'start-server': 'npm run nocobase start',
build: 'lerna run build', build: 'lerna run build',

View File

@ -27,7 +27,7 @@ module.exports = (opts) => {
return { return {
...templateJson, ...templateJson,
name: 'server', name: 'app-server',
version: '0.1.0', version: '0.1.0',
main: 'index.js', main: 'index.js',
dependencies: { dependencies: {