Skip to content

Commit bd29de2

Browse files
Added check to check for exist for copy static/*
* Moved shelljs out of global scope * Small cleanup of code
1 parent 16520e0 commit bd29de2

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

template/.eslintrc.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,22 @@
1818
],
1919
"no-trailing-spaces": [
2020
"error",
21-
{ "skipBlankLines": true }
21+
{
22+
"skipBlankLines": true
23+
}
2224
],
2325
"no-empty-label": "off",
2426
"keyword-spacing": "error",
2527
"no-mixed-spaces-and-tabs": "error",
2628
"no-unused-vars": "off",
2729
"arrow-body-style": [
28-
"error",
29-
"as-needed", {
30-
"requireReturnForObjectLiteral": true
30+
"error",
31+
"as-needed", {
32+
"requireReturnForObjectLiteral": true
3133
}
3234
],
3335
"arrow-parens": [
34-
"error",
36+
"error",
3537
"as-needed"
3638
],
3739
"linebreak-style": "off",

template/build/build.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// https://github.com/shelljs/shelljs
22
require('./check-versions')()
3-
require('shelljs/global')
3+
var shell = require('shelljs')
44
env.NODE_ENV = 'production'
55

66
var path = require('path')
@@ -19,9 +19,12 @@ var spinner = ora('building for production...')
1919
spinner.start()
2020

2121
var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
22-
rm('-rf', assetsPath)
23-
mkdir('-p', assetsPath)
24-
cp('-R', 'static/*', assetsPath)
22+
shell.rm('-rf', assetsPath)
23+
shell.mkdir('-p', assetsPath)
24+
25+
if (shell.test("-e", "static") && shell.test("-d", "static")) {
26+
shell.cp('-R', 'static/*', assetsPath)
27+
}
2528

2629
webpack(webpackConfig, function (err, stats) {
2730
spinner.stop()

template/build/webpack.base.conf.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
1212
var cssSourceMapProd = (env === 'production' && config.build.productionSourceMap)
1313
var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
1414

15-
1615
module.exports = {
1716
entry: {
1817
app: './src/main.ts'
@@ -23,8 +22,7 @@ module.exports = {
2322
filename: './[name].[hash].js'
2423
},
2524
resolve: {
26-
extensions: ['.js', '.vue', '.ts', '.tsx', '.css', '.scss'],
27-
//fallback: [path.join(__dirname, '../node_modules')],
25+
extensions: ['.js', '.vue', '.ts', '.css', '.scss'],
2826
alias: {
2927
'vue$': 'vue/dist/vue.common.js',
3028
'src': path.resolve(__dirname, '../src'),

template/build/webpack.dev.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = merge(baseWebpackConfig, {
4646
}]
4747
},
4848
// eval-source-map is faster for development
49-
devtool: '#eval-source-map',
49+
devtool: 'eval-source-map',
5050
plugins: [
5151
new webpack.DefinePlugin({
5252
'process.env': config.dev.env

0 commit comments

Comments
 (0)