forked from kiwiirc/kiwiirc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02cbf67
commit ac952a9
Showing
26 changed files
with
4,806 additions
and
4,323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
> 1% | ||
last 2 versions | ||
not ie <= 8 | ||
not dead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
build/*.js | ||
config/*.js | ||
tests/unit/coverage/ | ||
/dist/ | ||
/tests/coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
printWidth: 120, | ||
printWidth: 100, | ||
quoteProps: 'consistent', | ||
semi: true, | ||
singleQuote: true, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,47 @@ | ||
module.exports = { | ||
extends: ['stylelint-config-standard', 'stylelint-config-recommended-vue'], | ||
extends: ['stylelint-config-standard', 'stylelint-config-standard-scss', 'stylelint-config-recess-order'], | ||
overrides: [ | ||
{ | ||
files: ['**/*.html'], | ||
files: ['**/*.vue', '**/*.html'], | ||
customSyntax: 'postcss-html', | ||
}, | ||
], | ||
rules: { | ||
'alpha-value-notation': null, | ||
'color-function-notation': null, | ||
'declaration-block-no-redundant-longhand-properties': null, | ||
'declaration-no-important': true, | ||
'indentation': 4, | ||
'media-feature-range-notation': null, | ||
'no-descending-specificity': null, | ||
'no-empty-first-line': null, | ||
'number-max-precision': null, | ||
'order/properties-order': null, | ||
'property-no-vendor-prefix': null, | ||
'scss/at-rule-no-unknown': [ | ||
true, | ||
{ | ||
ignoreAtRules: [ | ||
'each', | ||
'else', | ||
'extends', | ||
'for', | ||
'function', | ||
'if', | ||
'ignores', | ||
'include', | ||
'media', | ||
'mixin', | ||
'return', | ||
'use', | ||
|
||
// Font Awesome 4 | ||
'fa-font-path', | ||
], | ||
}, | ||
], | ||
'scss/double-slash-comment-empty-line-before': null, | ||
'scss/double-slash-comment-whitespace-inside': null, | ||
'selector-class-pattern': null, | ||
'shorthand-property-no-redundant-values': null, | ||
'string-quotes': 'single', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
const webpack = require('webpack'); | ||
const minimist = require('minimist'); | ||
const ora = require('ora'); | ||
const chalk = require('chalk'); | ||
const cliui = require('cliui'); | ||
const { rimraf } = require('rimraf'); | ||
|
||
const utils = require('../utils'); | ||
const webpackConfigFunc = require('../../webpack.config'); | ||
|
||
const argv = minimist(process.argv.slice(2)); | ||
const webpackConfig = webpackConfigFunc({}, argv); | ||
const spinner = ora(); | ||
|
||
console.log(); | ||
spinner.text = `Building for ${webpackConfig.mode}...`; | ||
spinner.start(); | ||
|
||
rimraf(utils.pathResolve('dist')).then(() => { | ||
webpack(webpackConfig, (wpErr, stats) => { | ||
spinner.stop(); | ||
console.log(); | ||
|
||
if (wpErr) { | ||
console.error(wpErr); | ||
console.log(); | ||
process.exit(1); | ||
} | ||
|
||
if (stats.hasErrors()) { | ||
process.exit(1); | ||
} | ||
|
||
const getCompressedAsset = (asset, type) => { | ||
if (!Array.isArray(asset.related)) { | ||
return undefined; | ||
} | ||
return asset.related.find((relAsset) => relAsset.type === type); | ||
}; | ||
|
||
const isJS = (val) => /\.js$/.test(val); | ||
const isCSS = (val) => /\.css$/.test(val); | ||
const assetSorter = (a, b) => { | ||
if (isJS(a.name) && isCSS(b.name)) { | ||
return -1; | ||
} | ||
if (isCSS(a.name) && isJS(b.name)) { | ||
return 1; | ||
} | ||
return b.size - a.size; | ||
}; | ||
|
||
const data = stats.toJson(); | ||
const files = Object.values(data.assetsByChunkName).flat(); | ||
|
||
const out = [ | ||
// Column headers | ||
['File', 'Size', 'Gzip', 'Brotli'], | ||
]; | ||
const totals = { | ||
size: 0, | ||
gzip: 0, | ||
brotli: 0, | ||
}; | ||
|
||
data.assets.sort(assetSorter).forEach((asset) => { | ||
if (!asset.emitted) { | ||
return; | ||
} | ||
|
||
const gzipAsset = getCompressedAsset(asset, 'gzipped'); | ||
const brotliAsset = getCompressedAsset(asset, 'brotliCompressed'); | ||
|
||
totals.size += asset.size; | ||
totals.gzip += gzipAsset ? gzipAsset.size : asset.size; | ||
totals.brotli += brotliAsset ? brotliAsset.size : asset.size; | ||
|
||
if (files.includes(asset.name)) { | ||
out.push([ | ||
asset.name, | ||
utils.formatSize(asset.size), | ||
gzipAsset ? utils.formatSize(gzipAsset.size) : '', | ||
brotliAsset ? utils.formatSize(brotliAsset.size) : '', | ||
]); | ||
} | ||
}); | ||
|
||
out.push([ | ||
'Totals (including assets)', | ||
utils.formatSize(totals.size), | ||
utils.formatSize(totals.gzip), | ||
utils.formatSize(totals.brotli), | ||
]); | ||
|
||
const colWidths = out.reduce((acc, row) => { | ||
row.forEach((col, idx) => { | ||
acc[idx] = Math.max(acc[idx] || 0, col.length + 4); | ||
}); | ||
return acc; | ||
}, []); | ||
|
||
const table = cliui(); | ||
out.forEach((row, rowIdx) => { | ||
table.div( | ||
...row.map((col, colIdx) => ({ | ||
text: (rowIdx === 0 || (rowIdx === out.length - 1 && colIdx === 0)) | ||
? chalk.cyan.bold(col) | ||
: col, | ||
width: colWidths[colIdx], | ||
padding: (rowIdx === 0 || rowIdx === out.length - 2) | ||
? [0, 0, 1, 3] | ||
: [0, 0, 0, 3], | ||
})) | ||
); | ||
}); | ||
|
||
console.log(table.toString()); | ||
console.log(); | ||
console.log(); | ||
console.log( | ||
chalk.bgGreen.black(' DONE '), | ||
`Build Complete. The ${chalk.cyan('dist')} directory is ready to be deployed` | ||
); | ||
console.log(); | ||
}); | ||
}).catch((rmErr) => { | ||
spinner.stop(); | ||
console.log(); | ||
console.error(rmErr); | ||
console.log(); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.