mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
chore: update lint scripts
This commit is contained in:
parent
9d95313d03
commit
7a6485d1ab
@ -133,10 +133,10 @@
|
||||
"deploy": "rm -rf node_modules && node scripts/install.js && npm run just-deploy",
|
||||
"just-deploy": "npm run site && node scripts/deploy.js",
|
||||
"lint": "npm run srclint && npm run demolint && npm run lesshint",
|
||||
"srclint": "ANTD=SRC eslint components test site index.js --ext '.js,.jsx'",
|
||||
"srclint": "ANTD=SRC eslint components test site scripts ./*.js --ext '.js,.jsx'",
|
||||
"demolint": "ANTD=DEMO eslint components/*/demo/*.md --ext '.md'",
|
||||
"lesshint": "lesshint style/ -e 'style/+(core|mixins)/+(base|iconfont|normalize|layouts|compatibility|grid).less'",
|
||||
"eslint-fix": "eslint --fix components test site index.js --ext '.js,.jsx' && eslint-tinker ./components/*/demo/*.md",
|
||||
"eslint-fix": "eslint --fix components test site scripts ./*.js --ext '.js,.jsx' && eslint-tinker ./components/*/demo/*.md",
|
||||
"test": "npm run lint && atool-build && npm run jest",
|
||||
"jest": "jest",
|
||||
"pub": "sh ./scripts/publish.sh",
|
||||
|
@ -1,8 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const R = require('ramda');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = function buildCommon(dirs, outputFile) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const R = require('ramda');
|
||||
@ -23,10 +21,10 @@ module.exports = function buildDemosList(dirs, outputPath) {
|
||||
Object.keys(groupedDemos).forEach((key) => {
|
||||
content += `\n '${key}': [`;
|
||||
groupedDemos[key].forEach((fileName) => {
|
||||
const requirePath = path.relative(path.dirname(outputPath), fileName)
|
||||
const requirePath = path.relative(path.dirname(outputPath), fileName);
|
||||
content += `\n require('${requirePath}'),`;
|
||||
});
|
||||
content += '\n ],'
|
||||
content += '\n ],';
|
||||
});
|
||||
content += '\n};\n';
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
#! /usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
// Ensure that data directory exist.
|
||||
require('mkdirp').sync('./_data');
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
var ghPages = require('gh-pages');
|
||||
var path = require('path');
|
||||
const ghPages = require('gh-pages');
|
||||
const path = require('path');
|
||||
ghPages.publish(path.join(process.cwd(), '_site'), {
|
||||
depth: 1,
|
||||
logger: function (message) {
|
||||
logger(message) {
|
||||
console.log(message);
|
||||
}
|
||||
}, function (err) {
|
||||
}, (err) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
@ -1,23 +1,23 @@
|
||||
function runCmd(cmd, args, fn) {
|
||||
args = args || [];
|
||||
var runner = require('child_process').spawn(cmd, args, {
|
||||
const runner = require('child_process').spawn(cmd, args, {
|
||||
// keep color
|
||||
stdio: "inherit"
|
||||
stdio: 'inherit'
|
||||
});
|
||||
runner.on('close', function (code) {
|
||||
runner.on('close', (code) => {
|
||||
if (fn) {
|
||||
fn(code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
runCmd('which', ['tnpm'], function (code) {
|
||||
var npm = 'npm';
|
||||
runCmd('which', ['tnpm'], (code) => {
|
||||
let npm = 'npm';
|
||||
if (!code) {
|
||||
npm = 'tnpm';
|
||||
}
|
||||
console.log(npm + ' installing');
|
||||
runCmd(npm, ['install'], function () {
|
||||
console.log(npm + ' install end');
|
||||
console.log(`${npm} installing`);
|
||||
runCmd(npm, ['install'], () => {
|
||||
console.log(`${npm} install end`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,11 +1,11 @@
|
||||
var fs = require('fs');
|
||||
var cwd = process.cwd();
|
||||
var path = require('path');
|
||||
var originalIndex = fs.readFileSync(path.join(cwd, 'lib/index.js'), 'utf-8');
|
||||
var newIndex = originalIndex
|
||||
const fs = require('fs');
|
||||
const cwd = process.cwd();
|
||||
const path = require('path');
|
||||
const originalIndex = fs.readFileSync(path.join(cwd, 'lib/index.js'), 'utf-8');
|
||||
const newIndex = originalIndex
|
||||
.replace(/\/components\//g, '/');
|
||||
fs.writeFileSync(path.join(cwd, 'lib/index.js'), newIndex, 'utf-8');
|
||||
var antdCss = path.join(cwd, 'dist/antd.css');
|
||||
const antdCss = path.join(cwd, 'dist/antd.css');
|
||||
fs.createReadStream(antdCss)
|
||||
.pipe(fs.createWriteStream(path.join(cwd, 'lib/index.css')));
|
||||
console.log('prenpm done');
|
||||
|
@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const R = require('ramda');
|
||||
|
||||
function noop() {}
|
||||
|
||||
const isMDFile = R.compose(R.equals('.md'), path.extname);
|
||||
exports.findMDFile = function findMDFile(fileName, shallow) {
|
||||
const filePaths = Array.isArray(fileName) ? fileName : [fileName];
|
||||
@ -19,7 +19,7 @@ exports.findMDFile = function findMDFile(fileName, shallow) {
|
||||
let hasIndexFile = false;
|
||||
try {
|
||||
hasIndexFile = fs.statSync(indexFile).isFile();
|
||||
} catch (e) {}
|
||||
} catch (e) { noop(); }
|
||||
|
||||
if (shallow && hasIndexFile) {
|
||||
mds.push(indexFile);
|
||||
@ -34,6 +34,7 @@ exports.findMDFile = function findMDFile(fileName, shallow) {
|
||||
return mds;
|
||||
};
|
||||
|
||||
/* eslint prefer-template: 0 */
|
||||
exports.stringify = function stringify(data, d) {
|
||||
const depth = d || 1;
|
||||
const indent = ' '.repeat(depth);
|
||||
|
@ -1,6 +1,6 @@
|
||||
const webpack = require('atool-build/lib/webpack');
|
||||
|
||||
module.exports = function(webpackConfig) {
|
||||
module.exports = function (webpackConfig) {
|
||||
// remove common.js
|
||||
webpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
|
||||
return !(plugin instanceof webpack.optimize.CommonsChunkPlugin);
|
||||
@ -38,7 +38,7 @@ module.exports = function(webpackConfig) {
|
||||
webpackConfig.module.loaders.push({
|
||||
test: /\.md$/,
|
||||
exclude: [/node_modules/, componentRegExp],
|
||||
loader: `babel!antd-md`,
|
||||
loader: 'babel!antd-md',
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ module.exports = function(webpackConfig) {
|
||||
'antd.min': entry,
|
||||
};
|
||||
webpackConfig.externals = {
|
||||
'react': {
|
||||
react: {
|
||||
root: 'React',
|
||||
commonjs2: 'react',
|
||||
commonjs: 'react',
|
||||
|
Loading…
Reference in New Issue
Block a user