Skip to content

Commit

Permalink
✨ remote add templateSuffix config
Browse files Browse the repository at this point in the history
  • Loading branch information
zttonly committed Jan 10, 2023
1 parent 3926b4c commit fcebc4e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/san-cli-build/getWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ module.exports = function getNormalizeWebpackConfig(api, projectConfigs, argv) {
if (remote) {
const DeployPlugin = require('deploy-files/webpack-plugin');
// 从 env 文件中读取 remote 配置,这样可以将 env.local 加到 .gitignore 中防止提交
// 详细配置:https://github.com/jinzhan/deploy-files
// 详细配置:https://github.com/wanwu/deploy-files
// host: 'http://YOUR_HOST'
// receiver: 'http://YOUR_HOST/receiver',
// templatePath: '/home/work/nginx_static/html/test/template',
// templateSuffix: '.html',
// staticPath: '//home/work/nginx_static/html/test/static',
// staticDomain: 'http://test.com:8888'
// baseUrl: 'https://s.bdstatic.com/'
const upperRemote = remote.toUpperCase();
const requiredParam = ['templatePath', 'staticPath', 'staticDomain', 'baseUrl'];
const requiredParam = ['templatePath', 'staticPath', 'staticDomain', 'baseUrl', 'templateSuffix'];
const remoteObj = {
// 1. 默认取false;
// 2. process.env读取的内容为string,需转boolean
Expand All @@ -83,7 +84,7 @@ module.exports = function getNormalizeWebpackConfig(api, projectConfigs, argv) {
// templatePath → TEMPLATE_PATH
const upperKey = key.replace(/[A-Z]/g, $1 => `_${$1}`).toUpperCase();
const val = process.env[`SAN_REMOTE_${upperRemote}_${upperKey}`];
if (!val) {
if (key !== 'templateSuffix' && !val) {
error(
/* eslint-disable max-len */
`Use --remote ${remote} to upload files, but donot get ${chalk.red(
Expand Down

0 comments on commit fcebc4e

Please sign in to comment.