Skip to content
This repository has been archived by the owner on Aug 1, 2020. It is now read-only.

Commit

Permalink
build: update config
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Oct 12, 2019
1 parent ee1b4ac commit fbdecf6
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 38 deletions.
10 changes: 0 additions & 10 deletions .babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions .commitlintrc

This file was deleted.

19 changes: 18 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,28 @@
"env": {
"browser": true
},
"root": true,
"rules": {
"import/no-extraneous-dependencies": "off",
"no-param-reassign": "off",
"no-restricted-properties": "off",
"valid-jsdoc": ["error", {
"requireReturn": false
}]
}
},
"overrides": [
{
"files": "test/**/*.js",
"env": {
"jquery": true,
"mocha": true
},
"globals": {
"expect": true
},
"rules": {
"no-unused-expressions": "off"
}
}
]
}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
*.local
*.map
_*
coverage
node_modules
10 changes: 10 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-order"
],
"rules": {
"no-descending-specificity": null,
"order/properties-alphabetical-order": true
}
}
17 changes: 17 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
modules: false,
},
],
],
env: {
test: {
plugins: [
'istanbul',
],
},
},
};
11 changes: 9 additions & 2 deletions postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ const rollupConfig = require('./rollup.config');
module.exports = {
plugins: {
'postcss-import': {},
'postcss-cssnext': {},
'postcss-preset-env': {
stage: 3,
features: {
'nesting-rules': true,
},
},
'postcss-url': {
url: 'inline',
},
'postcss-header': {
header: rollupConfig.output[0].banner,
},
stylefmt: {},
stylelint: {
fix: true,
},
},
};
36 changes: 16 additions & 20 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
const babel = require('rollup-plugin-babel');
const commonjs = require('rollup-plugin-commonjs');
const nodeResolve = require('rollup-plugin-node-resolve');
const changeCase = require('change-case');
const createBanner = require('create-banner');
const pkg = require('./package');

const now = new Date();
const banner = `/*!
* Cropper v${pkg.version}
* https://github.com/${pkg.repository}
*
* Copyright (c) 2014-${now.getFullYear()} ${pkg.author.name}
* Released under the ${pkg.license} license
*
* Date: ${now.toISOString()}
*/
`;
const name = changeCase.pascalCase(pkg.name);
const banner = createBanner({
data: {
name,
year: '2014-present',
},
});

module.exports = {
input: 'src/index.js',
output: [
{
banner,
file: 'dist/cropper.js',
name,
file: `dist/${pkg.name}.js`,
format: 'umd',
name: 'Cropper',
globals: {
jquery: 'jQuery',
},
},
{
banner,
file: 'dist/cropper.common.js',
file: `dist/${pkg.name}.common.js`,
format: 'cjs',
},
{
banner,
file: 'dist/cropper.esm.js',
file: `dist/${pkg.name}.esm.js`,
format: 'es',
},
{
banner,
file: 'docs/js/cropper.js',
name,
file: `docs/js/${pkg.name}.js`,
format: 'umd',
name: 'Cropper',
globals: {
jquery: 'jQuery',
},
Expand All @@ -51,8 +49,6 @@ module.exports = {
plugins: [
nodeResolve(),
commonjs(),
babel({
plugins: ['external-helpers'],
}),
babel(),
],
};

0 comments on commit fbdecf6

Please sign in to comment.