create-pandora-app
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -10,2 +10,3 @@ import * as Generator from 'yeoman-generator'; | ||
answers: IAnswers; | ||
appViews: string[]; | ||
prompting(): Promise<void>; | ||
@@ -12,0 +13,0 @@ writing(): void; |
@@ -6,2 +6,6 @@ "use strict"; | ||
class default_1 extends Generator { | ||
constructor() { | ||
super(...arguments); | ||
this.appViews = []; | ||
} | ||
async prompting() { | ||
@@ -23,3 +27,4 @@ this.log(yosay(`您将创建 Pandora 平台基础应用模板`, { maxLength: 22 })); | ||
name: 'appViews', | ||
message: 'Views (comma separated)' | ||
message: 'Views (comma separated)', | ||
default: 'demo' | ||
} | ||
@@ -29,5 +34,6 @@ ]; | ||
this.answers.appName = this.options.appName; | ||
this.appViews = this.answers.appViews.split(','); | ||
} | ||
writing() { | ||
const { appName, appViews } = this.answers; | ||
const { appName } = this.answers; | ||
this.fs.copyTpl(this.templatePath('normal/app.json.ejs'), this.destinationPath(`${appName}/app.json`), this.answers); | ||
@@ -37,7 +43,11 @@ this.fs.copy(this.templatePath('normal/static/icon.png'), this.destinationPath(`${appName}/static/icon.png`)); | ||
this.fs.copy(this.templatePath('normal/resources/sourcetypes/.gitkeep'), this.destinationPath(`${appName}/resources/sourcetypes/.gitkeep`)); | ||
this.fs.copyTpl(this.templatePath('normal/default/nav.xml.ejs'), this.destinationPath(`${appName}/default/nav.xml`), this.answers); | ||
const views = (appViews || appName || 'demo').split(','); | ||
views.forEach(view => { | ||
this.fs.write(`${appName}/default/views/${view.trim()}.xml`, '<html>hello pandora</html>'); | ||
this.fs.copyTpl(this.templatePath('normal/default/nav.xml.ejs'), this.destinationPath(`${appName}/default/nav.xml`), { | ||
appViews: this.appViews | ||
}); | ||
this.appViews.forEach(view => { | ||
this.fs.write(`${appName}/default/views/${view.trim()}.xml`, `<root> | ||
<text>Hello Pandora!</text> | ||
</root> | ||
`); | ||
}); | ||
} | ||
@@ -44,0 +54,0 @@ end() { |
@@ -7,3 +7,3 @@ # <%= appName %> | ||
- develop 开发目录,用于自定义组件逻辑开发与调试 | ||
- webapp 开发目录,用于自定义组件逻辑开发与调试 | ||
@@ -20,9 +20,9 @@ - src 目录为自定义组件源码,直接在 index 文件中进行开发即可 | ||
- 进入 develop 目录 | ||
- 在 develop 执行 `<%= pkg %> run setup` | ||
- 在 develop 执行 `<%= pkg %> run start` | ||
- 进入 webapp 目录 | ||
- 在 webapp 执行 `<%= pkg %> run setup` | ||
- 在 webapp 执行 `<%= pkg %> run start` | ||
### 打包 | ||
- 开发完成后,在 develop 目录执行 `<%= pkg %> run package`', 编译最终代码并打包 | ||
- 开发完成后,在 webapp 目录执行 `<%= pkg %> run package`', 编译最终代码并打包 | ||
- 上传可视化应用`<%= name %>.tar.gz`至 Pandora 平台 |
@@ -7,3 +7,3 @@ # <%= name %> | ||
- develop 开发目录,用于页面逻辑开发与调试 | ||
- webapp 开发目录,用于页面逻辑开发与调试 | ||
@@ -16,12 +16,12 @@ - 其他目录,APP 组成的相关目录组织结构 | ||
- 进入 develop 目录 | ||
- 进入 webapp 目录 | ||
- 修改 package.json 文件 | ||
- proxy 字段为当前 pandora 服务 URL | ||
- account 字段中填写对应服务的用户名和密码 | ||
- 在 develop 执行 `<%= pkg %> install` | ||
- 在 develop 执行 `<%= pkg %> run start` | ||
- 在 webapp 执行 `<%= pkg %> install` | ||
- 在 webapp 执行 `<%= pkg %> run start` | ||
### 打包 | ||
- 开发完成后,在 develop 目录执行 `<%= pkg %> run package`', 编译最终代码并打包 | ||
- 开发完成后,在 webapp 目录执行 `<%= pkg %> run package`', 编译最终代码并打包 | ||
- 上传可视化应用`<%= name %>.tar.gz`至 Pandora 平台 |
@@ -7,3 +7,3 @@ # <%= name %> | ||
- develop 开发目录,用于可视化图表逻辑开发与调试 | ||
- webapp 开发目录,用于可视化图表逻辑开发与调试 | ||
@@ -20,12 +20,12 @@ - src 目录为自定义可视化图表源码,直接在 index 文件中进行开发即可 | ||
- 进入 develop 目录 | ||
- 进入 webapp 目录 | ||
- 修改 platform 目录 package.json 文件 | ||
- proxy 字段为当前 pandora 服务 URL | ||
- account 字段中填写对应服务的用户名和密码 | ||
- 在 develop 执行 `<%= pkg %> run setup` | ||
- 在 develop 执行 `<%= pkg %> run start` | ||
- 在 webapp 执行 `<%= pkg %> run setup` | ||
- 在 webapp 执行 `<%= pkg %> run start` | ||
### 打包 | ||
- 开发完成后,在 develop 目录执行 `<%= pkg %> run package`', 编译最终代码并打包 | ||
- 开发完成后,在 webapp 目录执行 `<%= pkg %> run package`', 编译最终代码并打包 | ||
- 上传可视化应用`<%= name %>.tar.gz`至 Pandora 平台 |
@@ -44,4 +44,4 @@ "use strict"; | ||
choices: [ | ||
{ name: 'npm', value: 'npm' }, | ||
{ name: 'yarn', value: 'yarn' } | ||
{ name: 'yarn', value: 'yarn' }, | ||
{ name: 'npm', value: 'npm' } | ||
], | ||
@@ -59,11 +59,11 @@ default: () => (this.options.yarn ? 1 : 0) | ||
name: 'build', | ||
message: '选择用途', | ||
message: 'Select your purpose', | ||
choices: [ | ||
{ | ||
value: EBuildType.component, | ||
name: '纯组件(将src/modules下的每个文件夹作为入口,每个文件夹都会打包出一个js)' | ||
name: '纯组件:将src/modules下的每个文件夹作为入口,每个文件夹都会打包出一个js' | ||
}, | ||
{ | ||
value: EBuildType.singlePage, | ||
name: '单页应用(将src/app.tsx作为入口,只会打包出一个js,通常用来构造含有路由的完整的单页应用)' | ||
name: '单页应用:将src/app.tsx作为入口,只会打包出一个js,通常用来构造含有路由的完整的单页应用' | ||
} | ||
@@ -81,5 +81,5 @@ ] | ||
const { name, typescript, build } = this.answers; | ||
const pathTarget = `${name}/develop`; | ||
const pathTarget = `${name}/webapp`; | ||
const pathScaffold = `page-scaffold`; | ||
const pathDevelopApp = 'react-app/develop'; | ||
const pathWebappApp = 'react-app/webapp'; | ||
const pathApp = 'react-app'; | ||
@@ -90,19 +90,19 @@ const fileType = typescript ? 'tsx' : 'jsx'; | ||
this.fs.copyTpl(this.templatePath(`${pathScaffold}/README.md`), this.destinationPath(`${name}/README.md`), this.answers); | ||
this.fs.copyTpl(this.templatePath(`${pathDevelopApp}/package.json.ejs`), this.destinationPath(`${pathTarget}/package.json`), this.answers); | ||
this.fs.copyTpl(this.templatePath(`${pathWebappApp}/package.json.ejs`), this.destinationPath(`${pathTarget}/package.json`), this.answers); | ||
this.fs.copy(this.templatePath(`${pathScaffold}/.prettierrc`), this.destinationPath(`${pathTarget}/.prettierrc`)); | ||
this.fs.copy(this.templatePath(`${pathScaffold}/.gitignore.ejs`), this.destinationPath(`${pathTarget}/.gitignore`)); | ||
this.fs.copy(this.templatePath(`${pathScaffold}/tsconfig.json`), this.destinationPath(`${pathTarget}/tsconfig.json`)); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/types/index.d.ts`), this.destinationPath(`${pathTarget}/types/index.d.ts`)); | ||
this.fs.copyTpl(this.templatePath(`${pathDevelopApp}/bin/package`), this.destinationPath(`${pathTarget}/bin/package`), this.answers); | ||
this.fs.copyTpl(this.templatePath(`${pathDevelopApp}/configs/env.js.ejs`), this.destinationPath(`${pathTarget}/configs/env.js`), this.answers); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/configs/paths.js`), this.destinationPath(`${pathTarget}/configs/paths.js`)); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/configs/webpack.common.conf.js`), this.destinationPath(`${pathTarget}/configs/webpack.common.conf.js`)); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/configs/webpack.dev.conf.js`), this.destinationPath(`${pathTarget}/configs/webpack.dev.conf.js`)); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/configs/webpack.dll.conf.js`), this.destinationPath(`${pathTarget}/configs/webpack.dll.conf.js`)); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/configs${multi}/webpack.prod.conf.js`), this.destinationPath(`${pathTarget}/configs/webpack.prod.conf.js`)); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/src/global/styles/style.less`), this.destinationPath(`${pathTarget}/src/global/styles/style.less`)); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/src/modules/Dashboard${multi}/index.${fileType}`), this.destinationPath(`${pathTarget}/src/modules/Dashboard/index.${fileType}`)); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/src/modules/Overview${multi}/index.${fileType}`), this.destinationPath(`${pathTarget}/src/modules/Overview/index.${fileType}`)); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/src/app.${fileType}`), this.destinationPath(`${pathTarget}/src/app.${fileType}`)); | ||
this.fs.copy(this.templatePath(`${pathDevelopApp}/src/platform.${fileType}`), this.destinationPath(`${pathTarget}/src/platform.${fileType}`)); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/types/index.d.ts`), this.destinationPath(`${pathTarget}/types/index.d.ts`)); | ||
this.fs.copyTpl(this.templatePath(`${pathWebappApp}/bin/package`), this.destinationPath(`${pathTarget}/bin/package`), this.answers); | ||
this.fs.copyTpl(this.templatePath(`${pathWebappApp}/configs/env.js.ejs`), this.destinationPath(`${pathTarget}/configs/env.js`), this.answers); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/configs/paths.js`), this.destinationPath(`${pathTarget}/configs/paths.js`)); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/configs/webpack.common.conf.js`), this.destinationPath(`${pathTarget}/configs/webpack.common.conf.js`)); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/configs/webpack.dev.conf.js`), this.destinationPath(`${pathTarget}/configs/webpack.dev.conf.js`)); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/configs/webpack.dll.conf.js`), this.destinationPath(`${pathTarget}/configs/webpack.dll.conf.js`)); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/configs${multi}/webpack.prod.conf.js`), this.destinationPath(`${pathTarget}/configs/webpack.prod.conf.js`)); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/src/global/styles/style.less`), this.destinationPath(`${pathTarget}/src/global/styles/style.less`)); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/src/modules/Dashboard${multi}/index.${fileType}`), this.destinationPath(`${pathTarget}/src/modules/Dashboard/index.${fileType}`)); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/src/modules/Overview${multi}/index.${fileType}`), this.destinationPath(`${pathTarget}/src/modules/Overview/index.${fileType}`)); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/src/app.${fileType}`), this.destinationPath(`${pathTarget}/src/app.${fileType}`)); | ||
this.fs.copy(this.templatePath(`${pathWebappApp}/src/platform.${fileType}`), this.destinationPath(`${pathTarget}/src/platform.${fileType}`)); | ||
this.fs.copyTpl(this.templatePath('normal/app.json.ejs'), this.destinationPath(`${name}/app.json`), Object.assign(Object.assign({}, this.answers), { appViews: '' })); | ||
@@ -125,5 +125,5 @@ this.fs.copy(this.templatePath('normal/static/icon.png'), this.destinationPath(`${name}/static/icon.png`)); | ||
const { pkg } = this.answers; | ||
console.log(`\n应用 ${this.answers.name} 创建成功,进入 ${this.answers.name}/develop 目录执行 \`${pkg} install && ${pkg} start\` 开发应用`); | ||
console.log(`\n应用 ${this.answers.name} 创建成功,进入 ${this.answers.name}/webapp 目录执行 \`${pkg} install && ${pkg} start\` 开发应用`); | ||
} | ||
} | ||
exports.default = default_1; |
@@ -41,4 +41,4 @@ "use strict"; | ||
choices: [ | ||
{ name: 'npm', value: 'npm' }, | ||
{ name: 'yarn', value: 'yarn' } | ||
{ name: 'yarn', value: 'yarn' }, | ||
{ name: 'npm', value: 'npm' } | ||
], | ||
@@ -68,3 +68,3 @@ default: () => (this.options.yarn ? 1 : 0) | ||
: 'component/normal/js'; | ||
const path_target = `${appName}/develop`; | ||
const path_target = `${appName}/webapp`; | ||
this.fs.copyTpl(this.templatePath(`${componentCommonPath}/README.md`), this.destinationPath(`${appName}/README.md`), this.answers); | ||
@@ -111,5 +111,5 @@ this.fs.copy(this.templatePath(`${libraryPath}/rollup.config.js`), this.destinationPath(`${path_target}/rollup.config.js`)); | ||
const { pkg } = this.answers; | ||
console.log(`\n应用 ${this.answers.appName} 创建成功,进入 ${this.answers.appName}/develop 目录执行 \`${pkg} run setup && ${pkg} run start\` 开发应用`); | ||
console.log(`\n应用 ${this.answers.appName} 创建成功,进入 ${this.answers.appName}/webapp 目录执行 \`${pkg} run setup && ${pkg} run start\` 开发应用`); | ||
} | ||
} | ||
exports.default = default_1; |
@@ -12,3 +12,4 @@ "use strict"; | ||
name: 'appTitle', | ||
message: 'Title' | ||
message: 'Title', | ||
default: () => this.options.appName | ||
}, | ||
@@ -29,3 +30,4 @@ { | ||
name: 'visualizationLabel', | ||
message: 'custom chart label' | ||
message: 'custom chart label', | ||
default: () => this.options.visualizationName || this.options.appName | ||
}, | ||
@@ -52,4 +54,4 @@ { | ||
choices: [ | ||
{ name: 'npm', value: 'npm' }, | ||
{ name: 'yarn', value: 'yarn' } | ||
{ name: 'yarn', value: 'yarn' }, | ||
{ name: 'npm', value: 'npm' } | ||
], | ||
@@ -77,3 +79,3 @@ default: () => (this.options.yarn ? 1 : 0) | ||
: 'visualization-scaffold/js'; | ||
const path_target = `${name}/develop`; | ||
const path_target = `${name}/webapp`; | ||
const fileType = typescript ? 'tsx' : 'js'; | ||
@@ -118,3 +120,3 @@ // Main | ||
this.fs.copy(this.templatePath('visualization/default/nav.xml'), this.destinationPath(`${name}/default/nav.xml`)); | ||
this.fs.copyTpl(this.templatePath('visualization/default/visualization.json.ejs'), this.destinationPath(`${name}/default/visualization.json`), this.answers); | ||
this.fs.copyTpl(this.templatePath('visualization/resources/visualizations/visualization.json.ejs'), this.destinationPath(`${name}/resources/visualizations/visualization.json`), this.answers); | ||
this.fs.copy(this.templatePath('visualization/appserver/static/visualizations/custom/form.xml'), this.destinationPath(`${name}/appserver/static/visualizations/${visualizationName}/form.xml`)); | ||
@@ -125,5 +127,5 @@ this.fs.copy(this.templatePath('visualization/appserver/static/visualizations/custom/icon.png'), this.destinationPath(`${name}/appserver/static/visualizations/${visualizationName}/icon.png`)); | ||
const { pkg } = this.answers; | ||
console.log(`\n应用 ${this.answers.name} 创建成功,进入 ${this.answers.name}/develop 目录执行 \`${pkg} run setup && ${pkg} run start\` 开发应用`); | ||
console.log(`\n应用 ${this.answers.name} 创建成功,进入 ${this.answers.name}/webapp 目录执行 \`${pkg} run setup && ${pkg} run start\` 开发应用`); | ||
} | ||
} | ||
exports.default = default_1; |
{ | ||
"name": "create-pandora-app", | ||
"description": "pandora 应用模板生成工具", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"author": "pandora", | ||
@@ -56,3 +56,3 @@ "bin": { | ||
"types": "lib/index.d.ts", | ||
"gitHead": "6e5f3dbb3914d6720db422efdf179f1887a1fbd1" | ||
"gitHead": "e51c1182bd7348df09a0aece2e490203e3e407f5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
146337
2160