@stechquick/symphony-cli 0.2.271

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/README.md +378 -0
  2. package/bin/run +5 -0
  3. package/bin/run.cmd +3 -0
  4. package/lib/commands/mui-create.d.ts +14 -0
  5. package/lib/commands/mui-create.js +39 -0
  6. package/lib/commands/nc-addcomp.d.ts +11 -0
  7. package/lib/commands/nc-addcomp.js +22 -0
  8. package/lib/commands/nc-build.d.ts +9 -0
  9. package/lib/commands/nc-build.js +20 -0
  10. package/lib/commands/nc-create.d.ts +14 -0
  11. package/lib/commands/nc-create.js +38 -0
  12. package/lib/commands/qui-build.d.ts +6 -0
  13. package/lib/commands/qui-build.js +16 -0
  14. package/lib/commands/qui-create.d.ts +14 -0
  15. package/lib/commands/qui-create.js +39 -0
  16. package/lib/commands/qui-start.d.ts +9 -0
  17. package/lib/commands/qui-start.js +30 -0
  18. package/lib/commands/quick-serve.d.ts +17 -0
  19. package/lib/commands/quick-serve.js +73 -0
  20. package/lib/commands/sym-addfunc.d.ts +12 -0
  21. package/lib/commands/sym-addfunc.js +21 -0
  22. package/lib/commands/sym-build.d.ts +12 -0
  23. package/lib/commands/sym-build.js +56 -0
  24. package/lib/commands/sym-create-module.d.ts +14 -0
  25. package/lib/commands/sym-create-module.js +39 -0
  26. package/lib/commands/sym-create.d.ts +14 -0
  27. package/lib/commands/sym-create.js +39 -0
  28. package/lib/commands/sym-fn-deploy.d.ts +24 -0
  29. package/lib/commands/sym-fn-deploy.js +152 -0
  30. package/lib/commands/sym-nano-deploy.d.ts +11 -0
  31. package/lib/commands/sym-nano-deploy.js +50 -0
  32. package/lib/commands/sym-start.d.ts +14 -0
  33. package/lib/commands/sym-start.js +28 -0
  34. package/lib/commands/sym-test.d.ts +6 -0
  35. package/lib/commands/sym-test.js +12 -0
  36. package/lib/helpers/deploy/fnDeployHelper.d.ts +28 -0
  37. package/lib/helpers/deploy/fnDeployHelper.js +196 -0
  38. package/lib/helpers/deploy/nanoDeployHelper.d.ts +20 -0
  39. package/lib/helpers/deploy/nanoDeployHelper.js +83 -0
  40. package/lib/helpers/fnDownloadHelper.d.ts +11 -0
  41. package/lib/helpers/fnDownloadHelper.js +64 -0
  42. package/lib/helpers/initHelper.d.ts +22 -0
  43. package/lib/helpers/initHelper.js +78 -0
  44. package/lib/helpers/microUIHelper.d.ts +10 -0
  45. package/lib/helpers/microUIHelper.js +33 -0
  46. package/lib/helpers/namedComponent/ncHelper.d.ts +15 -0
  47. package/lib/helpers/namedComponent/ncHelper.js +60 -0
  48. package/lib/helpers/npmHelper.d.ts +23 -0
  49. package/lib/helpers/npmHelper.js +79 -0
  50. package/lib/helpers/packageHelper.d.ts +14 -0
  51. package/lib/helpers/packageHelper.js +32 -0
  52. package/lib/helpers/shellHelper.d.ts +25 -0
  53. package/lib/helpers/shellHelper.js +52 -0
  54. package/lib/helpers/socketServer/socketServerHelper.d.ts +14 -0
  55. package/lib/helpers/socketServer/socketServerHelper.js +106 -0
  56. package/lib/helpers/typeHelper.d.ts +3 -0
  57. package/lib/helpers/typeHelper.js +22 -0
  58. package/lib/helpers/ui/createuiHelper.d.ts +10 -0
  59. package/lib/helpers/ui/createuiHelper.js +33 -0
  60. package/lib/helpers/ui/quiBuilder.d.ts +13 -0
  61. package/lib/helpers/ui/quiBuilder.js +163 -0
  62. package/lib/helpers/utils.d.ts +8 -0
  63. package/lib/helpers/utils.js +20 -0
  64. package/lib/index.d.ts +1 -0
  65. package/lib/index.js +4 -0
  66. package/lib/pathFinder.d.ts +4 -0
  67. package/lib/pathFinder.js +13 -0
  68. package/lib/predeploy/src/fn/fnPostdeploy.d.ts +5 -0
  69. package/lib/predeploy/src/fn/fnPostdeploy.js +49 -0
  70. package/lib/predeploy/src/fn/fnPredeploy.d.ts +4 -0
  71. package/lib/predeploy/src/fn/fnPredeploy.js +30 -0
  72. package/lib/predeploy/src/nano/nanoPostdeploy.d.ts +5 -0
  73. package/lib/predeploy/src/nano/nanoPostdeploy.js +41 -0
  74. package/lib/predeploy/src/nano/nanoPredeploy.d.ts +4 -0
  75. package/lib/predeploy/src/nano/nanoPredeploy.js +25 -0
  76. package/lib/predeploy/src/paramReplacer.d.ts +7 -0
  77. package/lib/predeploy/src/paramReplacer.js +14 -0
  78. package/lib/predeploy/src/predeployCommon.d.ts +15 -0
  79. package/lib/predeploy/src/predeployCommon.js +83 -0
  80. package/oclif.manifest.json +1 -0
  81. package/package.json +76 -0
  82. package/templates/addModule/{{ModuleName}}/.jenkins/dev.yaml +43 -0
  83. package/templates/addModule/{{ModuleName}}/README.md +2 -0
  84. package/templates/addModule/{{ModuleName}}/index.ts +1 -0
  85. package/templates/addModule/{{ModuleName}}/src/implementation/object.ts +16 -0
  86. package/templates/addModule/{{ModuleName}}/src/module.ts +9 -0
  87. package/templates/addModule/{{ModuleName}}/tsconfig.json +66 -0
  88. package/templates/addModule/{{ModuleName}}/webpack.config.js +41 -0
  89. package/templates/addModule/{{ModuleName}}/{{remove}}.gitignore +6 -0
  90. package/templates/addModule/{{ModuleName}}/{{remove}}package.json +33 -0
  91. package/templates/addfunc/functions/{{FuncName}}/config.yaml +25 -0
  92. package/templates/addfunc/functions/{{FuncName}}/func.yaml +9 -0
  93. package/templates/addfunc/functions/{{FuncName}}/{{FuncName}}.ts +8 -0
  94. package/templates/addfunc/unitTest/{{FuncName}}.test.ts +18 -0
  95. package/templates/createmicroui/{{MicroUIName}}-ui/.babelrc +17 -0
  96. package/templates/createmicroui/{{MicroUIName}}-ui/.editorconfig +9 -0
  97. package/templates/createmicroui/{{MicroUIName}}-ui/.postcssrc.js +8 -0
  98. package/templates/createmicroui/{{MicroUIName}}-ui/README.md +45 -0
  99. package/templates/createmicroui/{{MicroUIName}}-ui/build/build.js +41 -0
  100. package/templates/createmicroui/{{MicroUIName}}-ui/build/check-versions.js +49 -0
  101. package/templates/createmicroui/{{MicroUIName}}-ui/build/dev-client.js +10 -0
  102. package/templates/createmicroui/{{MicroUIName}}-ui/build/dev-server.js +107 -0
  103. package/templates/createmicroui/{{MicroUIName}}-ui/build/utils.js +73 -0
  104. package/templates/createmicroui/{{MicroUIName}}-ui/build/vue-loader.conf.js +19 -0
  105. package/templates/createmicroui/{{MicroUIName}}-ui/build/webpack.base.conf.js +76 -0
  106. package/templates/createmicroui/{{MicroUIName}}-ui/build/webpack.dev.conf.js +39 -0
  107. package/templates/createmicroui/{{MicroUIName}}-ui/build/webpack.prod.conf.js +128 -0
  108. package/templates/createmicroui/{{MicroUIName}}-ui/build/webpack.test.conf.js +32 -0
  109. package/templates/createmicroui/{{MicroUIName}}-ui/build.gradle +251 -0
  110. package/templates/createmicroui/{{MicroUIName}}-ui/config/dev.env.js +7 -0
  111. package/templates/createmicroui/{{MicroUIName}}-ui/config/index.js +50 -0
  112. package/templates/createmicroui/{{MicroUIName}}-ui/config/prod.env.js +4 -0
  113. package/templates/createmicroui/{{MicroUIName}}-ui/config/test.env.js +7 -0
  114. package/templates/createmicroui/{{MicroUIName}}-ui/copyBundle.js +3 -0
  115. package/templates/createmicroui/{{MicroUIName}}-ui/gradle/base/repos.gradle +48 -0
  116. package/templates/createmicroui/{{MicroUIName}}-ui/gradle/wrapper/gradle-wrapper.jar +0 -0
  117. package/templates/createmicroui/{{MicroUIName}}-ui/gradle/wrapper/gradle-wrapper.properties +6 -0
  118. package/templates/createmicroui/{{MicroUIName}}-ui/gradlew +172 -0
  119. package/templates/createmicroui/{{MicroUIName}}-ui/index.html +11 -0
  120. package/templates/createmicroui/{{MicroUIName}}-ui/index.js +18 -0
  121. package/templates/createmicroui/{{MicroUIName}}-ui/indexCompNames.js +14 -0
  122. package/templates/createmicroui/{{MicroUIName}}-ui/indexInitial.js +8 -0
  123. package/templates/createmicroui/{{MicroUIName}}-ui/indexModuleName.js +1 -0
  124. package/templates/createmicroui/{{MicroUIName}}-ui/indexVCompNames.json +50 -0
  125. package/templates/createmicroui/{{MicroUIName}}-ui/package.json +84 -0
  126. package/templates/createmicroui/{{MicroUIName}}-ui/removeDist.js +2 -0
  127. package/templates/createmicroui/{{MicroUIName}}-ui/src/App.vue +54 -0
  128. package/templates/createmicroui/{{MicroUIName}}-ui/src/api/index.js +5 -0
  129. package/templates/createmicroui/{{MicroUIName}}-ui/src/components/index.js +6 -0
  130. package/templates/createmicroui/{{MicroUIName}}-ui/src/docker/nginx.conf +39 -0
  131. package/templates/createmicroui/{{MicroUIName}}-ui/src/localization/en/default.json +3 -0
  132. package/templates/createmicroui/{{MicroUIName}}-ui/src/localization/tr/default.json +3 -0
  133. package/templates/createmicroui/{{MicroUIName}}-ui/src/main.js +15 -0
  134. package/templates/createmicroui/{{MicroUIName}}-ui/src/mockserver/handlers/health.js +8 -0
  135. package/templates/createmicroui/{{MicroUIName}}-ui/src/mockserver/index.js +8 -0
  136. package/templates/createmicroui/{{MicroUIName}}-ui/src/mockserver/server.js +45 -0
  137. package/templates/createmicroui/{{MicroUIName}}-ui/src/pages/index.js +6 -0
  138. package/templates/createmicroui/{{MicroUIName}}-ui/src/router/index.js +5 -0
  139. package/templates/createmicroui/{{MicroUIName}}-ui/src/service/serviceConstants.js +1 -0
  140. package/templates/createmicroui/{{MicroUIName}}-ui/src/store/index.js +14 -0
  141. package/templates/createmicroui/{{MicroUIName}}-ui/src/worker/a9e657cbf4abb977edda.worker.js +60638 -0
  142. package/templates/createmicroui/{{MicroUIName}}-ui/static/.gitkeep +0 -0
  143. package/templates/createmicroui/{{MicroUIName}}-ui/webpack.config.js +257 -0
  144. package/templates/createui/{{UIName}}/Jenkinsfile +20 -0
  145. package/templates/createui/{{UIName}}/build.gradle +266 -0
  146. package/templates/createui/{{UIName}}/gradle/base/repos.gradle +93 -0
  147. package/templates/createui/{{UIName}}/gradle/wrapper/gradle-wrapper.jar +0 -0
  148. package/templates/createui/{{UIName}}/gradle/wrapper/gradle-wrapper.properties +6 -0
  149. package/templates/createui/{{UIName}}/gradlew +172 -0
  150. package/templates/createui/{{UIName}}/gradlew.bat +90 -0
  151. package/templates/createui/{{UIName}}/settings/globalLocalization.qjson +29 -0
  152. package/templates/createui/{{UIName}}/settings/localProxy.yaml +25 -0
  153. package/templates/createui/{{UIName}}/settings/qjson/alert.qjson +920 -0
  154. package/templates/createui/{{UIName}}/settings/qjson/loading.qjson +1486 -0
  155. package/templates/createui/{{UIName}}/settings/qjson/logHandler.qjson +65 -0
  156. package/templates/createui/{{UIName}}/settings/qjson/pipeline.qjson +116 -0
  157. package/templates/createui/{{UIName}}/settings/settings-proxy.js +120 -0
  158. package/templates/createui/{{UIName}}/settings/settings.yaml +85 -0
  159. package/templates/createui/{{UIName}}/settings.gradle +1 -0
  160. package/templates/createui/{{UIName}}/static/components/yourNamedCompHere.js +0 -0
  161. package/templates/createui/{{UIName}}/static/css/main.css +36 -0
  162. package/templates/createui/{{UIName}}/static/css/myDarkTheme.css +143 -0
  163. package/templates/createui/{{UIName}}/static/css/myHappyTheme1.css +140 -0
  164. package/templates/createui/{{UIName}}/static/css/myHappyTheme2.css +140 -0
  165. package/templates/createui/{{UIName}}/static/images/ahelogo.png +0 -0
  166. package/templates/createui/{{UIName}}/static/images/avatar.png +0 -0
  167. package/templates/createui/{{UIName}}/static/images/profile.png +0 -0
  168. package/templates/createui/{{UIName}}/static/images/profile2.png +0 -0
  169. package/templates/createui/{{UIName}}/static/images/yourImagesHere.png +0 -0
  170. package/templates/createui/{{UIName}}/static/js/componentList.ts +4452 -0
  171. package/templates/createui/{{UIName}}/static/qjsons/VDatatableConditionalRowColoring.qjson +158 -0
  172. package/templates/createui/{{UIName}}/static/qjsons/alertSamplePage.qjson +772 -0
  173. package/templates/createui/{{UIName}}/static/qjsons/complicatedSamplePage.qjson +10448 -0
  174. package/templates/createui/{{UIName}}/static/qjsons/customComponentSample.qjson +803 -0
  175. package/templates/createui/{{UIName}}/static/qjsons/customerInfoCustomComp.qjson +1451 -0
  176. package/templates/createui/{{UIName}}/static/qjsons/first.qjson +2180 -0
  177. package/templates/createui/{{UIName}}/static/qjsons/formatterSample.qjson +877 -0
  178. package/templates/createui/{{UIName}}/static/qjsons/localizationSample.qjson +1845 -0
  179. package/templates/createui/{{UIName}}/static/qjsons/pipelineSample.qjson +913 -0
  180. package/templates/createui/{{UIName}}/static/qjsons/validationSample.qjson +2371 -0
  181. package/templates/createui/{{UIName}}/static/qjsons/webDashboardSample.qjson +2993 -0
  182. package/templates/createui/{{UIName}}/{{remove}}.gitignore +3 -0
  183. package/templates/createui/{{UIName}}/{{remove}}package.json +22 -0
  184. package/templates/fnPredeploy/Dockerfile +22 -0
  185. package/templates/init/{{AppName}}/.vscode/launch.json +24 -0
  186. package/templates/init/{{AppName}}/Jenkinsfile +36 -0
  187. package/templates/init/{{AppName}}/app.yaml +1 -0
  188. package/templates/init/{{AppName}}/functions/qjsonfunc/func.yaml +9 -0
  189. package/templates/init/{{AppName}}/functions/qjsonfunc/qjsonfunc.ts +3 -0
  190. package/templates/init/{{AppName}}/functions/qjsonfunc/qjsons/test.qjson +180 -0
  191. package/templates/init/{{AppName}}/functions/samplefunc/config.yaml +46 -0
  192. package/templates/init/{{AppName}}/functions/samplefunc/func.yaml +9 -0
  193. package/templates/init/{{AppName}}/functions/samplefunc/samplefunc.ts +27 -0
  194. package/templates/init/{{AppName}}/jest.config.js +8 -0
  195. package/templates/init/{{AppName}}/local.ts +6 -0
  196. package/templates/init/{{AppName}}/sym-engine/config.yaml +7 -0
  197. package/templates/init/{{AppName}}/sym-engine/localization.yaml +5 -0
  198. package/templates/init/{{AppName}}/sym-engine/pipeline.ts +64 -0
  199. package/templates/init/{{AppName}}/test/qjson.http +29 -0
  200. package/templates/init/{{AppName}}/test/sample.http +24 -0
  201. package/templates/init/{{AppName}}/tsconfig.json +66 -0
  202. package/templates/init/{{AppName}}/unitTest/samplefunc.test.ts +55 -0
  203. package/templates/init/{{AppName}}/{{remove}}.gitignore +6 -0
  204. package/templates/init/{{AppName}}/{{remove}}package.json +40 -0
  205. package/templates/nanoPredeploy/Dockerfile +27 -0
  206. package/templates/nc-addComp/{{ComponentName}}.vue +29 -0
  207. package/templates/nc-create/{{ProjectName}}/shims/shims-vue.d.ts +4 -0
  208. package/templates/nc-create/{{ProjectName}}/src/namedComps/{{ProjectName}}.vue +29 -0
  209. package/templates/nc-create/{{ProjectName}}/tsconfig.json +66 -0
  210. package/templates/nc-create/{{ProjectName}}/webpack.config.js +2 -0
  211. package/templates/nc-create/{{ProjectName}}/{{remove}}.gitignore +3 -0
  212. package/templates/nc-create/{{ProjectName}}/{{remove}}package.json +28 -0
@@ -0,0 +1,25 @@
1
+ # this level is rezerved for environments
2
+ # uses default environment where none is supplied
3
+ default:
4
+ # PLEASE DELETE EVERTHING BELOW THIS LINE (THESE ARE JUST SAMPLES) AND WRITE YOUR OWN
5
+ # this level is for your config keys
6
+ log:
7
+ minlevel: "log" # none | error | warn | trace | log | info | debug
8
+ path: # "C:/Logs/Symphony"
9
+ disk: false
10
+ sampleKey:
11
+ url: "this is a sample value"
12
+ timeout: 2000
13
+ log:
14
+ body: false # false | 100 |
15
+ header: false
16
+ request: false
17
+ response: false
18
+ sessionBag:
19
+ environment: none #none | memory | hazelcast
20
+ bag:
21
+ environment: memory #memory | hazelcast
22
+ hazelcastClusterMembers: [
23
+ "127.0.0.1:5701",
24
+ "127.0.0.2:5701"
25
+ ]
@@ -0,0 +1,9 @@
1
+ schema_version: 20180708
2
+ name: {{FuncName}}
3
+ version: 0.0.0
4
+ runtime: docker
5
+ entrypoint: node ./dist/{{FuncName}}.js
6
+ triggers:
7
+ - name: {{FuncName}}
8
+ type: http
9
+ source: /{{FuncName}}
@@ -0,0 +1,8 @@
1
+ import { symphony } from "plateau-symphony";
2
+
3
+
4
+ symphony.registerFunc({
5
+ funcName: "{{FuncName}}", keepBag: false, requireFunc: require, func: async (sym) => {
6
+ //write your code here
7
+ }
8
+ });
@@ -0,0 +1,18 @@
1
+ import { symphony, IRestResponse } from "plateau-symphony";
2
+
3
+ let func = symphony.retrieveFunction(() => require("../functions/{{FuncName}}/{{FuncName}}"));
4
+
5
+ // it equals just a test case
6
+ it('should get receive an error', async () => {
7
+ const sym = symphony.createMock();
8
+
9
+ //write function input mock
10
+ sym.request.body = {};
11
+
12
+ //write rest, soap, etc..., and service input validation
13
+
14
+ //execute function
15
+ const response = await func(sym);
16
+
17
+ //response validations
18
+ });
@@ -0,0 +1,17 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "debug": false,
7
+ "targets": {
8
+ "browsers": [
9
+ "> 1%",
10
+ "last 2 versions",
11
+ "not ie <= 8"
12
+ ]
13
+ }
14
+ }
15
+ ]
16
+ ]
17
+ }
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
@@ -0,0 +1,8 @@
1
+ // https://github.com/michael-ciniawsky/postcss-load-config
2
+
3
+ module.exports = {
4
+ "plugins": {
5
+ // to edit target browsers: use "browserslist" field in package.json
6
+ "autoprefixer": {}
7
+ }
8
+ }
@@ -0,0 +1,45 @@
1
+ # Rally MicroService UI
2
+
3
+ Application structure is based on webpack framework and Vue.
4
+ Project depends on Sprinkle and provides ui components specific to this microservice.
5
+ It is included by ui chasis as a module in real deployments.
6
+
7
+ ## Build Setup
8
+
9
+ # install concurrently (used by npm run stack)
10
+ npm install concurrently -g
11
+
12
+ # install dependencies
13
+ $ npm install
14
+
15
+ # serve with hot reload at localhost:3000
16
+ $ npm run dev
17
+
18
+ # run dev server & mockserver (at localhost:2000)
19
+ # go to http://localhost:3000/
20
+ $ npm run stack
21
+
22
+ # build for production and launch server
23
+ $ npm run build
24
+ $ npm start
25
+
26
+ # generate static project
27
+ $ npm run generate
28
+
29
+ ## Project Layout
30
+ Project follows standard Nuxt webpack project layout with a few defaults.
31
+
32
+ ### index.js
33
+ This is the entry point when this project is included as a module by ui chasis. All the required exports of this module should be in index.js. Since the parent chasis ui assumes the exported project has certain structure and properties, structure of exported entity should not be changed.
34
+
35
+ ### src
36
+ - **main.js & App.vue** : Those files serve as entry points when the project is developed or tested as a standalone ui. Those files provide a basic ui chasis similar to the actual ui chasis.
37
+ - **components** : Project specific ui components or mixins should be here and exported by index.js
38
+ - **pages** : Actual web pages provided by this project should be here and exported by index.js
39
+ - **router** : Static rotue definitions of this project should be defined in index.js as a route list
40
+ - **store** : Custom vuex store modules should be defined and exported in index.js
41
+
42
+ ### mockserver
43
+ mock implementations of some common backed services to ease local testing or development.
44
+ `index.js` & `setup.js` files configure and run a regular express server; **handlers** directory contains actual mock endpoints.
45
+ by default it uses port 2000
@@ -0,0 +1,41 @@
1
+ 'use strict'
2
+ require('./check-versions')()
3
+
4
+ process.env.NODE_ENV = 'production'
5
+
6
+ const ora = require('ora')
7
+ const rm = require('rimraf')
8
+ const path = require('path')
9
+ const chalk = require('chalk')
10
+ const webpack = require('webpack')
11
+ const config = require('../config')
12
+ const webpackConfig = require('./webpack.prod.conf')
13
+
14
+ const spinner = ora('building for production...')
15
+ spinner.start()
16
+
17
+ rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18
+ if (err) throw err
19
+ webpack(webpackConfig, function (err, stats) {
20
+ spinner.stop()
21
+ if (err) throw err
22
+ process.stdout.write(stats.toString({
23
+ colors: true,
24
+ modules: false,
25
+ children: false,
26
+ chunks: false,
27
+ chunkModules: false
28
+ }) + '\n\n')
29
+
30
+ if (stats.hasErrors()) {
31
+ console.log(chalk.red(' Build failed with errors.\n'))
32
+ process.exit(1)
33
+ }
34
+
35
+ console.log(chalk.cyan(' Build complete.\n'))
36
+ console.log(chalk.yellow(
37
+ ' Tip: built files are meant to be served over an HTTP server.\n' +
38
+ ' Opening index.html over file:// won\'t work.\n'
39
+ ))
40
+ })
41
+ })
@@ -0,0 +1,49 @@
1
+ 'use strict'
2
+ const chalk = require('chalk')
3
+ const semver = require('semver')
4
+ const packageConfig = require('../package.json')
5
+ const shell = require('shelljs')
6
+ function exec (cmd) {
7
+ return require('child_process').execSync(cmd).toString().trim()
8
+ }
9
+
10
+ const versionRequirements = [
11
+ {
12
+ name: 'node',
13
+ currentVersion: semver.clean(process.version),
14
+ versionRequirement: packageConfig.engines.node
15
+ }
16
+ ]
17
+
18
+ if (shell.which('npm')) {
19
+ versionRequirements.push({
20
+ name: 'npm',
21
+ currentVersion: exec('npm --version'),
22
+ versionRequirement: packageConfig.engines.npm
23
+ })
24
+ }
25
+
26
+ module.exports = function () {
27
+ const warnings = []
28
+ for (let i = 0; i < versionRequirements.length; i++) {
29
+ const mod = versionRequirements[i]
30
+ if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
31
+ warnings.push(mod.name + ': ' +
32
+ chalk.red(mod.currentVersion) + ' should be ' +
33
+ chalk.green(mod.versionRequirement)
34
+ )
35
+ }
36
+ }
37
+
38
+ if (warnings.length) {
39
+ console.log('')
40
+ console.log(chalk.yellow('To use this template, you must update following to modules:'))
41
+ console.log()
42
+ for (let i = 0; i < warnings.length; i++) {
43
+ const warning = warnings[i]
44
+ console.log(' ' + warning)
45
+ }
46
+ console.log()
47
+ process.exit(1)
48
+ }
49
+ }
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ 'use strict'
3
+ require('eventsource-polyfill')
4
+ var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
5
+
6
+ hotClient.subscribe(function (event) {
7
+ if (event.action === 'reload') {
8
+ window.location.reload()
9
+ }
10
+ })
@@ -0,0 +1,107 @@
1
+ 'use strict'
2
+ require('./check-versions')()
3
+
4
+ const config = require('../config')
5
+ if (!process.env.NODE_ENV) {
6
+ process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
7
+ }
8
+
9
+ const opn = require('opn')
10
+ const path = require('path')
11
+ const express = require('express')
12
+ const webpack = require('webpack')
13
+ const proxyMiddleware = require('http-proxy-middleware')
14
+ const webpackConfig = (process.env.NODE_ENV === 'testing' || process.env.NODE_ENV === 'production')
15
+ ? require('./webpack.prod.conf')
16
+ : require('./webpack.dev.conf')
17
+
18
+ // default port where dev server listens for incoming traffic
19
+ const port = process.env.PORT || config.dev.port
20
+ // automatically open browser, if not set will be false
21
+ const autoOpenBrowser = !!config.dev.autoOpenBrowser
22
+ // Define HTTP proxies to your custom API backend
23
+ // https://github.com/chimurai/http-proxy-middleware
24
+ const proxyTable = config.dev.proxyTable
25
+
26
+ const app = express()
27
+ const compiler = webpack(webpackConfig)
28
+
29
+ const devMiddleware = require('webpack-dev-middleware')(compiler, {
30
+ publicPath: webpackConfig.output.publicPath,
31
+ quiet: true
32
+ })
33
+
34
+ const hotMiddleware = require('webpack-hot-middleware')(compiler, {
35
+ log: false,
36
+ heartbeat: 2000
37
+ })
38
+ // force page reload when html-webpack-plugin template changes
39
+ // currently disabled until this is resolved:
40
+ // https://github.com/jantimon/html-webpack-plugin/issues/680
41
+ // compiler.plugin('compilation', function (compilation) {
42
+ // compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
43
+ // hotMiddleware.publish({ action: 'reload' })
44
+ // cb()
45
+ // })
46
+ // })
47
+
48
+ // enable hot-reload and state-preserving
49
+ // compilation error display
50
+ app.use(hotMiddleware)
51
+
52
+ // proxy api requests
53
+ Object.keys(proxyTable).forEach(function (context) {
54
+ let options = proxyTable[context]
55
+ if (typeof options === 'string') {
56
+ options = { target: options }
57
+ }
58
+ app.use(proxyMiddleware(options.filter || context, options))
59
+ })
60
+
61
+ // handle fallback for HTML5 history API
62
+ app.use(require('connect-history-api-fallback')())
63
+
64
+ // serve webpack bundle output
65
+ app.use(devMiddleware)
66
+
67
+ // serve pure static assets
68
+ const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
69
+ app.use(staticPath, express.static('./static'))
70
+
71
+ const uri = 'http://localhost:' + port
72
+
73
+ var _resolve
74
+ var _reject
75
+ var readyPromise = new Promise((resolve, reject) => {
76
+ _resolve = resolve
77
+ _reject = reject
78
+ })
79
+
80
+ var server
81
+ var portfinder = require('portfinder')
82
+ portfinder.basePort = port
83
+
84
+ console.log('> Starting dev server...')
85
+ devMiddleware.waitUntilValid(() => {
86
+ portfinder.getPort((err, port) => {
87
+ if (err) {
88
+ _reject(err)
89
+ }
90
+ process.env.PORT = port
91
+ var uri = 'http://localhost:' + port
92
+ console.log('> Listening at ' + uri + '\n')
93
+ // when env is testing, don't need open it
94
+ if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
95
+ opn(uri)
96
+ }
97
+ server = app.listen(port)
98
+ _resolve()
99
+ })
100
+ })
101
+
102
+ module.exports = {
103
+ ready: readyPromise,
104
+ close: () => {
105
+ server.close()
106
+ }
107
+ }
@@ -0,0 +1,73 @@
1
+ 'use strict'
2
+ const path = require('path')
3
+ const config = require('../config')
4
+ const ExtractTextPlugin = require('extract-text-webpack-plugin')
5
+
6
+ exports.assetsPath = function (_path) {
7
+ const assetsSubDirectory = process.env.NODE_ENV === 'production'
8
+ ? config.build.assetsSubDirectory
9
+ : config.dev.assetsSubDirectory
10
+ console.log(path.posix.join(assetsSubDirectory, _path));
11
+ return path.posix.join(assetsSubDirectory, _path)
12
+ }
13
+
14
+ exports.cssLoaders = function (options) {
15
+ options = options || {}
16
+
17
+ const cssLoader = {
18
+ loader: 'css-loader',
19
+ options: {
20
+ minimize: process.env.NODE_ENV === 'production',
21
+ sourceMap: options.sourceMap
22
+ }
23
+ }
24
+
25
+ // generate loader string to be used with extract text plugin
26
+ function generateLoaders (loader, loaderOptions) {
27
+ const loaders = [cssLoader]
28
+ if (loader) {
29
+ loaders.push({
30
+ loader: loader + '-loader',
31
+ options: Object.assign({}, loaderOptions, {
32
+ sourceMap: options.sourceMap
33
+ })
34
+ })
35
+ }
36
+
37
+ // Extract CSS when that option is specified
38
+ // (which is the case during production build)
39
+ if (options.extract) {
40
+ return ExtractTextPlugin.extract({
41
+ use: loaders,
42
+ fallback: 'vue-style-loader'
43
+ })
44
+ } else {
45
+ return ['vue-style-loader'].concat(loaders)
46
+ }
47
+ }
48
+
49
+ // https://vue-loader.vuejs.org/en/configurations/extract-css.html
50
+ return {
51
+ css: generateLoaders(),
52
+ postcss: generateLoaders(),
53
+ less: generateLoaders('less'),
54
+ sass: generateLoaders('sass', { indentedSyntax: true }),
55
+ scss: generateLoaders('sass'),
56
+ stylus: generateLoaders('stylus'),
57
+ styl: generateLoaders('stylus')
58
+ }
59
+ }
60
+
61
+ // Generate loaders for standalone style files (outside of .vue)
62
+ exports.styleLoaders = function (options) {
63
+ const output = []
64
+ const loaders = exports.cssLoaders(options)
65
+ for (const extension in loaders) {
66
+ const loader = loaders[extension]
67
+ output.push({
68
+ test: new RegExp('\\.' + extension + '$'),
69
+ use: loader
70
+ })
71
+ }
72
+ return output
73
+ }
@@ -0,0 +1,19 @@
1
+ 'use strict'
2
+ const utils = require('./utils')
3
+ const config = require('../config')
4
+ const isProduction = process.env.NODE_ENV === 'production'
5
+
6
+ module.exports = {
7
+ loaders: utils.cssLoaders({
8
+ sourceMap: isProduction
9
+ ? config.build.productionSourceMap
10
+ : config.dev.cssSourceMap,
11
+ extract: isProduction
12
+ }),
13
+ transformToRequire: {
14
+ video: 'src',
15
+ source: 'src',
16
+ img: 'src',
17
+ image: 'xlink:href'
18
+ }
19
+ }
@@ -0,0 +1,76 @@
1
+ 'use strict'
2
+ const path = require('path')
3
+ const utils = require('./utils')
4
+ const config = require('../config')
5
+ const vueLoaderConfig = require('./vue-loader.conf')
6
+
7
+ function resolve (dir) {
8
+ return path.join(__dirname, '..', dir)
9
+ }
10
+
11
+ module.exports = {
12
+ entry: {
13
+ app: './index.js'
14
+ },
15
+ output: {
16
+ path: config.build.assetsRoot,
17
+ filename: '[name].js',
18
+ publicPath: process.env.NODE_ENV === 'production'
19
+ ? config.build.assetsPublicPath
20
+ : config.dev.assetsPublicPath
21
+ },
22
+ resolve: {
23
+ extensions: ['.js', '.vue', '.json'],
24
+ alias: {
25
+ 'vue$': 'vue/dist/vue.esm.js',
26
+ '@': resolve('src'),
27
+ }
28
+ },
29
+ module: {
30
+ rules: [
31
+ /*{
32
+ test: /\.(js|vue)$/,
33
+ loader: 'eslint-loader',
34
+ enforce: 'pre',
35
+ include: [resolve('src'), resolve('test')],
36
+ options: {
37
+ formatter: require('eslint-friendly-formatter')
38
+ }
39
+ },*/
40
+ {
41
+ test: /\.vue$/,
42
+ loader: 'vue-loader',
43
+ options: vueLoaderConfig
44
+ },
45
+ {
46
+ test: /\.js$/,
47
+ loader: 'babel-loader',
48
+ include: [resolve('src'), resolve('test')]
49
+ },
50
+ {
51
+ test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
52
+ loader: 'url-loader',
53
+ options: {
54
+ limit: 10000,
55
+ name: utils.assetsPath('img/[name].[hash:7].[ext]')
56
+ }
57
+ },
58
+ {
59
+ test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
60
+ loader: 'url-loader',
61
+ options: {
62
+ limit: 10000,
63
+ name: utils.assetsPath('media/[name].[hash:7].[ext]')
64
+ }
65
+ },
66
+ {
67
+ test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
68
+ loader: 'url-loader',
69
+ options: {
70
+ limit: 10000,
71
+ name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
72
+ }
73
+ }
74
+ ]
75
+ }
76
+ }
@@ -0,0 +1,39 @@
1
+ 'use strict'
2
+ const utils = require('./utils')
3
+ const webpack = require('webpack')
4
+ const config = require('../config')
5
+ const merge = require('webpack-merge')
6
+ const baseWebpackConfig = require('./webpack.base.conf')
7
+ const HtmlWebpackPlugin = require('html-webpack-plugin')
8
+ const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
9
+
10
+ // add hot-reload related code to entry chunks
11
+ Object.keys(baseWebpackConfig.entry).forEach(function (name) {
12
+ baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
13
+ })
14
+
15
+ module.exports = merge(baseWebpackConfig, {
16
+ entry: {
17
+ app: './src/main.js'
18
+ },
19
+ module: {
20
+ rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
21
+ },
22
+ // cheap-module-eval-source-map is faster for development
23
+ devtool: '#cheap-module-eval-source-map',
24
+ plugins: [
25
+ new webpack.DefinePlugin({
26
+ 'process.env': config.dev.env
27
+ }),
28
+ // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
29
+ new webpack.HotModuleReplacementPlugin(),
30
+ new webpack.NoEmitOnErrorsPlugin(),
31
+ // https://github.com/ampedandwired/html-webpack-plugin
32
+ new HtmlWebpackPlugin({
33
+ filename: 'index.html',
34
+ template: 'index.html',
35
+ inject: true
36
+ }),
37
+ new FriendlyErrorsPlugin()
38
+ ]
39
+ })