Skip to content

Commit 06f6164

Browse files
author
Nick Hess
authored
Merge pull request #6 from bigspaceship/feature/kenburns-refactor
Feature/kenburns refactor
2 parents fdecc82 + d157314 commit 06f6164

34 files changed

+753
-753
lines changed

template/.babelrc

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
2-
"presets": ["es2015", "stage-2"],
3-
"plugins": ["transform-runtime"],
2+
"presets": [
3+
["babel-preset-env", {
4+
"targets": {
5+
"browsers": ["last 2 versions", "safari >= 7"]
6+
}
7+
}]
8+
],
9+
"plugins": ["transform-runtime", "syntax-dynamic-import"],
410
"comments": false
511
}

template/.eslintrc.js

+26-21
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@ module.exports = {
44
parserOptions: {
55
sourceType: 'module'
66
},
7-
{{#if_eq lintConfig "standard"}}
8-
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
9-
extends: 'standard',
10-
{{/if_eq}}
11-
{{#if_eq lintConfig "airbnb"}}
12-
extends: 'airbnb-base',
13-
{{/if_eq}}
7+
env: {
8+
browser: true
9+
}
10+
extends: ['airbnb-base', 'prettier'],
1411
// required to lint *.vue files
1512
plugins: [
16-
'html'
13+
'html',
14+
'prettier'
1715
],
18-
{{#if_eq lintConfig "airbnb"}}
1916
// check if imports actually resolve
2017
'settings': {
2118
'import/resolver': {
@@ -24,23 +21,31 @@ module.exports = {
2421
}
2522
}
2623
},
27-
{{/if_eq}}
2824
// add your custom rules here
29-
'rules': {
30-
{{#if_eq lintConfig "standard"}}
31-
// allow paren-less arrow functions
32-
'arrow-parens': 0,
33-
// allow async-await
34-
'generator-star-spacing': 0,
35-
{{/if_eq}}
36-
{{#if_eq lintConfig "airbnb"}}
25+
rules: {
26+
'import/no-unresolved': 0,
27+
'no-param-reassign': 0,
28+
'arrow-body-style': 0,
29+
'no-lonely-if': 0,
30+
'no-prototype-builtins': 0,
31+
'prefer-default-export': 0,
32+
'consistent-return': 0,
33+
'import/prefer-default-export': 0,
3734
// don't require .vue extension when importing
3835
'import/extensions': ['error', 'always', {
3936
'js': 'never',
4037
'vue': 'never'
4138
}],
42-
{{/if_eq}}
4339
// allow debugger during development
44-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
40+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
41+
'prettier/prettier': [
42+
'error',
43+
{
44+
semi: true,
45+
trailingComma: 'es5',
46+
singleQuote: true,
47+
printWidth: 100
48+
}
49+
]
4550
}
46-
}
51+
};

template/build/build.js

+40-34
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
11
// https://github.com/shelljs/shelljs
22
require('./check-versions')()
3-
require('shelljs/global')
4-
env.NODE_ENV = 'production'
5-
6-
var path = require('path')
7-
var config = require('../config')
8-
var ora = require('ora')
9-
var webpack = require('webpack')
10-
var webpackConfig = require('./webpack.prod.conf')
11-
12-
console.log(
13-
' Tip:\n' +
14-
' Built files are meant to be served over an HTTP server.\n' +
15-
' Opening index.html over file:// won\'t work.\n'
16-
)
17-
18-
var spinner = ora('building for production...')
19-
spinner.start()
20-
21-
var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
22-
rm('-rf', assetsPath)
23-
mkdir('-p', assetsPath)
24-
cp('-R', 'static/*', assetsPath)
25-
26-
webpack(webpackConfig, function (err, stats) {
27-
spinner.stop()
28-
if (err) throw err
29-
process.stdout.write(stats.toString({
30-
colors: true,
31-
modules: false,
32-
children: false,
33-
chunks: false,
34-
chunkModules: false
35-
}) + '\n')
36-
})
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 clientConfig = require('./webpack.client.config');
13+
const serverConfig = require('./webpack.server.config');
14+
15+
const spinner = ora('building for production...');
16+
spinner.start();
17+
18+
rm (config.build.path, err => {
19+
if (err) throw err;
20+
21+
function build(err, state) {
22+
};
23+
24+
webpack([clientConfig, serverConfig], (err, stats) => {
25+
spinner.stop();
26+
if (err) throw err;
27+
process.stdout.write(stats.toString({
28+
colors: true,
29+
modules: false,
30+
children: true,
31+
chunks: false,
32+
chunkModules: false,
33+
}) + '\n\n');
34+
35+
if (stats.hasErrors()) {
36+
console.log(chalk.red(' Build failed with errors.\n'));
37+
process.exit(1);
38+
}
39+
40+
console.log(chalk.cyan(' Build complete.\n'));
41+
});
42+
});

template/build/check-versions.js

+20-13
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
1-
var semver = require('semver')
2-
var chalk = require('chalk')
3-
var packageConfig = require('../package.json')
4-
var exec = function (cmd) {
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+
7+
function exec (cmd) {
58
return require('child_process')
69
.execSync(cmd).toString().trim()
710
}
811

9-
var versionRequirements = [
12+
const versionRequirements = [
1013
{
1114
name: 'node',
1215
currentVersion: semver.clean(process.version),
1316
versionRequirement: packageConfig.engines.node
14-
},
15-
{
17+
}
18+
]
19+
20+
if (shell.which('npm')) {
21+
versionRequirements.push({
1622
name: 'npm',
1723
currentVersion: exec('npm --version'),
1824
versionRequirement: packageConfig.engines.npm
19-
}
20-
]
25+
});
26+
}
2127

2228
module.exports = function () {
2329
var warnings = []
24-
for (var i = 0; i < versionRequirements.length; i++) {
25-
var mod = versionRequirements[i]
30+
for (let i = 0; i < versionRequirements.length; i++) {
31+
const mod = versionRequirements[i];
32+
2633
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
2734
warnings.push(mod.name + ': ' +
2835
chalk.red(mod.currentVersion) + ' should be ' +
@@ -35,8 +42,8 @@ module.exports = function () {
3542
console.log('')
3643
console.log(chalk.yellow('To use this template, you must update following to modules:'))
3744
console.log()
38-
for (var i = 0; i < warnings.length; i++) {
39-
var warning = warnings[i]
45+
for (let i = 0; i < warnings.length; i++) {
46+
const warning = warnings[i]
4047
console.log(' ' + warning)
4148
}
4249
console.log()

template/build/dev-client.js

-9
This file was deleted.

template/build/dev-server.js

-77
This file was deleted.

0 commit comments

Comments
 (0)