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. 切换目录
cd my-nocobase-app
# 3. 安装依赖
yarn install
# 3. 安装依赖(使用阿里云镜像)
yarn install --registry=https://registry.npmmirror.com
# 4. 安装 NocoBase
yarn nocobase install --lang=zh-CN

View File

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

View File

@ -9,6 +9,7 @@ const { join, resolve } = require('path');
const createEnvFile = require('./resources/templates/env');
const createPackageJson = require('./resources/templates/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');
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
console.log('finished');
}

View File

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

View File

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

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',
nocobase:
'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-server': 'npm run nocobase start',
build: 'lerna run build',

View File

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