瀏覽代碼

测试环境配置

yingp 7 年之前
父節點
當前提交
348cab848a

+ 41 - 0
frontend/saas-portal-web/build/build-dev.js

@@ -0,0 +1,41 @@
+'use strict'
+require('./check-versions')()
+
+process.env.NODE_ENV = 'development'
+
+const ora = require('ora')
+const rm = require('rimraf')
+const path = require('path')
+const chalk = require('chalk')
+const webpack = require('webpack')
+const config = require('../config')
+const webpackConfig = require('./webpack.prod.conf')
+
+const spinner = ora('building for development...')
+spinner.start()
+
+rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
+  if (err) throw err
+  webpack(webpackConfig, (err, stats) => {
+    spinner.stop()
+    if (err) throw err
+    process.stdout.write(stats.toString({
+      colors: true,
+      modules: false,
+      children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
+      chunks: false,
+      chunkModules: false
+    }) + '\n\n')
+
+    if (stats.hasErrors()) {
+      console.log(chalk.red('  Build failed with errors.\n'))
+      process.exit(1)
+    }
+
+    console.log(chalk.cyan('  Build complete.\n'))
+    console.log(chalk.yellow(
+      '  Tip: built files are meant to be served over an HTTP server.\n' +
+      '  Opening index.html over file:// won\'t work.\n'
+    ))
+  })
+})

+ 4 - 2
frontend/saas-portal-web/build/webpack.prod.conf.js

@@ -13,7 +13,9 @@ const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
 
 const env = process.env.NODE_ENV === 'testing'
   ? require('../config/test.env')
-  : require('../config/prod.env')
+  : (process.env.NODE_ENV === 'development'
+    ? require('../config/dev.env')
+    : require('../config/prod.env'))
 
 const webpackConfig = merge(baseWebpackConfig, {
   module: {
@@ -48,7 +50,7 @@ const webpackConfig = merge(baseWebpackConfig, {
       filename: utils.assetsPath('css/[name].[contenthash].css'),
       // Setting the following option to `false` will not extract CSS from codesplit chunks.
       // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
-      // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, 
+      // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
       // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
       allChunks: true,
     }),

+ 3 - 4
frontend/saas-portal-web/config/dev.env.js

@@ -6,11 +6,10 @@ module.exports = merge(prodEnv, {
   NODE_ENV: '"development"',
   BASE_URL: {
     // 前端地址
-    web: '"http://192.168.0.181"',
+    web: '"https://trade-dev.usoftchina.com:5443"',
     // 后端接口网关
-    api: '"http://192.168.0.181:8560"',
-    // api:'"http://192.168.253.31:8560"',
+    api: '"https://saas-api-dev.usoftchina.com:5443"',
     // 账户中心接口
-    sso: '"http://192.168.253.12:32323"'
+    sso: '"https://sso-dev.usoftchina.com:5443"'
   }
 })

+ 2 - 2
frontend/saas-portal-web/config/test.env.js

@@ -6,9 +6,9 @@ module.exports = merge(devEnv, {
   NODE_ENV: '"testing"',
   BASE_URL: {
     // 前端地址
-    web: '"https://trade-dev.usoftchina.com:5443"',
+    web: '"https://trade-test.usoftchina.com:5443"',
     // 后端接口网关
-    api: '"https://saas-api-dev.usoftchina.com:5443"',
+    api: '"https://saas-api-test.usoftchina.com:5443"',
     // 账户中心接口
     sso: '"https://sso-dev.usoftchina.com:5443"'
   }

+ 2 - 1
frontend/saas-portal-web/package.json

@@ -11,7 +11,8 @@
     "e2e": "node test/e2e/runner.js",
     "test": "npm run unit && npm run e2e",
     "build": "node build/build.js",
-    "build-test": "node build/build-test.js"
+    "build-test": "node build/build-test.js",
+    "build-dev": "node build/build-dev.js"
   },
   "dependencies": {
     "axios": "^0.18.0",

+ 19 - 4
frontend/saas-web/app.json

@@ -306,12 +306,27 @@
      * Settings specific to testing builds.
      */
     "testing": {
+        "output": {
+            "appCache": {
+                "enable": true,
+                "path": "cache.appcache"
+            }
+        },
+        "loader": {
+            "cache": "${build.timestamp}"
+        },
+        "cache": {
+            "enable": true
+        },
+        "compressor": {
+            "type": "yui"
+        },
         "server": {
-            "accountCenter":"http://192.168.0.181:8000",
-            "accountEnterprise":"http://192.168.0.181:8000/#/enterprise",
+            "accountCenter": "https://saas-test.usoftchina.com:5443",
+            "accountEnterprise": "https://saas-test.usoftchina.com:5443/#/enterprise",
             "basePath": {
-                "https": "https://saas-api-dev.usoftchina.com:5443",
-                "http": "http://192.168.0.181:8560"
+                "https": "https://saas-api-test.usoftchina.com:5443",
+                "http": "http://192.168.0.181:8575"
             },
             "urlPattern": "^\/api\/"
         }

+ 2 - 1
frontend/saas-web/package.json

@@ -6,8 +6,9 @@
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1",
     "dev": "sencha app watch",
+    "build-dev": "sencha app build --development",
     "build-test": "sencha app build --testing",
-    "build": "sencha app build"
+    "build": "sencha app build --production"
   },
   "keywords": [
     "saas"