소스 검색

chore: add quasar config capabilities

Nicolas Giard 2 년 전
부모
커밋
3aafe116ac
2개의 변경된 파일24개의 추가작업 그리고 5개의 파일을 삭제
  1. 9 0
      config.sample.yml
  2. 15 5
      ux/quasar.config.js

+ 9 - 0
config.sample.yml

@@ -131,3 +131,12 @@ scheduler:
   # Maximum number of workers to run background cpu-intensive jobs.
   # Maximum number of workers to run background cpu-intensive jobs.
   # Leave 'auto' to use number of CPU cores as maximum.
   # Leave 'auto' to use number of CPU cores as maximum.
   workers: auto
   workers: auto
+
+# ---------------------------------------------------------------------
+# Dev Mode
+# ---------------------------------------------------------------------
+# Settings when running in dev mode only
+
+dev:
+  port: 3001
+  hmrClientPort: 3001

+ 15 - 5
ux/quasar.config.js

@@ -10,8 +10,15 @@
 
 
 const { configure } = require('quasar/wrappers')
 const { configure } = require('quasar/wrappers')
 const path = require('path')
 const path = require('path')
+const yaml = require('js-yaml')
+const fs = require('fs')
 
 
 module.exports = configure(function (/* ctx */) {
 module.exports = configure(function (/* ctx */) {
+  const userConfig = {
+    dev: { port: 3001, hmrClientPort: 3001 },
+    ...yaml.load(fs.readFileSync(path.resolve(__dirname, '../config.yml'), 'utf8'))
+  }
+
   return {
   return {
     eslint: {
     eslint: {
       fix: true,
       fix: true,
@@ -102,12 +109,15 @@ module.exports = configure(function (/* ctx */) {
     devServer: {
     devServer: {
       // https: true
       // https: true
       open: false, // opens browser window automatically
       open: false, // opens browser window automatically
-      port: 3001,
+      port: userConfig.dev.port,
       proxy: {
       proxy: {
-        '/_graphql': 'http://127.0.0.1:3000/_graphql',
-        '/_site': 'http://127.0.0.1:3000',
-        '/_thumb': 'http://127.0.0.1:3000',
-        '/_user': 'http://127.0.0.1:3000'
+        '/_graphql': `http://127.0.0.1:${userConfig.port}/_graphql`,
+        '/_site': `http://127.0.0.1:${userConfig.port}`,
+        '/_thumb': `http://127.0.0.1:${userConfig.port}`,
+        '/_user': `http://127.0.0.1:${userConfig.port}`
+      },
+      hmr: {
+        clientPort: userConfig.dev.hmrClientPort
       }
       }
     },
     },