add scripts : start-dev

用于开发测试,防止template project被改坏
This commit is contained in:
baozhoutao 2021-11-06 18:18:08 +08:00
parent d108fbb7b6
commit df6fc44d9a
3 changed files with 50 additions and 1 deletions

2
.gitignore vendored
View File

@ -62,3 +62,5 @@ packages/cli/dist/**
docker-volumes
packages/node-red-app-template/yarn.lock
steedos-projects/project-dev/**

View File

@ -0,0 +1,45 @@
const cpy = require('cpy');
const path = require('path');
const fs = require('fs');
if (fs.existsSync(path.join(process.cwd(), 'steedos-projects', 'project-dev'))) {
return;
}
cpy([
'**',
'.steedos/**',
'!.steedos/node_modules/**',
'.vscode/**',
'!**/node_modules/**',
'!logs/**',
'.env.local',
'!steedos-config-k8s.yml',
'!storage/**',
'.gitignore',
'!init_home.sh',
'.env',
], '../../steedos-projects/project-dev', {
parents: true,
flat: false,
cwd: path.join(process.cwd(), 'steedos-projects', 'project-template'),
rename: (name) => {
switch (name) {
// case '.env':
// return 'env'
// case '.gitignore': {
// return 'gitignore'
// }
// case 'package.json': {
// return '_package.json'
// }
default: {
return name
}
}
}
}).then(() => {
console.log(`Create a development project: steedos-projects/project-dev`);
}).catch((result) => {
console.log(`error`, result);
})

View File

@ -28,7 +28,9 @@
"update-yarn": "curl --compressed -o- -L https://yarnpkg.com/install.sh | bash",
"sync-to-taobao": "node .scripts/sync_to_taobao.js",
"build_image": "node build_image.js",
"build_creator": "cd creator && yarn run build"
"build_creator": "cd creator && yarn run build",
"create_dev_project": "node .scripts/create_dev_project.js",
"start-dev": "yarn create_dev_project && cd steedos-projects && cd project-dev && yarn start"
},
"resolutions": {
"**/lodash": "^4.17.15",