⚙️ upgrade code style

This commit is contained in:
afc163 2018-11-28 12:39:10 +08:00
parent feac59da34
commit 647ba193cd
No known key found for this signature in database
GPG Key ID: 738F973FCE5C6B48
5 changed files with 18 additions and 17 deletions

View File

@ -1,5 +1,5 @@
<!-- <!--
⚠️ ⚠️ ⚠️ IMPORTANT: Please use the following link to create a new issue: ⚠️ ⚠️ ⚠️ IMPORTANT: Please use the following link to create a new issue: ⚠️ ⚠️ ⚠️
http://new-issue.ant.design http://new-issue.ant.design
@ -7,7 +7,7 @@ If your issue was not created using the app above, it will be closed immediately
--> -->
<!-- <!--
⚠️ ⚠️ ⚠️ 注意:请使用下面的链接来新建 issue ⚠️ ⚠️ ⚠️ 注意:请使用下面的链接来新建 issue ⚠️ ⚠️ ⚠️
http://new-issue.ant.design http://new-issue.ant.design

View File

@ -1,12 +1,12 @@
First of all, thank you for your contribution! :-) First of all, thank you for your contribution! :-)
Please makes sure that these checkboxes are checked before submitting your PR, thank you! Please makes sure that these checkboxes are checked before submitting your pull request, thank you!
* [ ] Make sure that you propose PR to right branch: bugfix for `master`, feature for branch `feature`. * [ ] Make sure that you propose pull request to right branch: bugfix for `master`, feature for branch `feature`.
* [ ] Make sure that you follow antd's [code convention](https://github.com/ant-design/ant-design/wiki/Code-convention-for-antd). * [ ] Make sure that you follow antd's [code convention](https://github.com/ant-design/ant-design/wiki/Code-convention-for-antd).
* [ ] Run `npm run lint` and fix those errors before submitting in order to keep consistent code style. * [ ] Run `npm run lint` and fix those errors before submitting in order to keep consistent code style.
* [ ] Rebase before creating a PR to keep commit history clear. * [ ] Rebase before creating a pull request to keep commit history clear.
* [ ] Add some descriptions and refer relative issues for you PR. * [ ] Add some descriptions and refer relative issues for you pull request.
Extra checklist: Extra checklist:

View File

@ -1,8 +1,5 @@
#!/usr/bin/env node #!/usr/bin/env node
/* eslint-disable */
'use strict';
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const packageInfo = require('../package.json'); const packageInfo = require('../package.json');
@ -14,8 +11,9 @@ if (fs.existsSync(path.join(__dirname, '../lib'))) {
const versionFileContent = fs.readFileSync(versionFilePath).toString(); const versionFileContent = fs.readFileSync(versionFilePath).toString();
fs.writeFileSync( fs.writeFileSync(
versionFilePath, versionFilePath,
versionFileContent.replace(`require('../../package.json')`, `{ version: '${packageInfo.version}' }`) versionFileContent.replace("require('../../package.json')", `{ version: '${packageInfo.version}' }`)
); );
// eslint-disable-next-line
console.log('Wrote version into lib/version/index.js'); console.log('Wrote version into lib/version/index.js');
// Build package.json version to lib/version/index.d.ts // Build package.json version to lib/version/index.d.ts
@ -25,6 +23,7 @@ if (fs.existsSync(path.join(__dirname, '../lib'))) {
versionDefPath, versionDefPath,
`declare var _default: "${packageInfo.version}";\nexport default _default;\n` `declare var _default: "${packageInfo.version}";\nexport default _default;\n`
); );
// eslint-disable-next-line
console.log('Wrote version into lib/version/index.d.ts'); console.log('Wrote version into lib/version/index.d.ts');
} }
@ -34,10 +33,10 @@ if (fs.existsSync(path.join(__dirname, '../dist'))) {
let componentsLessContent = ''; let componentsLessContent = '';
// Build components in one file: lib/style/components.less // Build components in one file: lib/style/components.less
fs.readdir(componentsPath, function (err, files) { fs.readdir(componentsPath, (err, files) => {
files.forEach(function (file) { files.forEach((file) => {
if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) { if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) {
componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n` componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n`;
} }
}); });
fs.writeFileSync(path.join(process.cwd(), 'lib', 'style', 'components.less'), componentsLessContent); fs.writeFileSync(path.join(process.cwd(), 'lib', 'style', 'components.less'), componentsLessContent);
@ -48,5 +47,6 @@ if (fs.existsSync(path.join(__dirname, '../dist'))) {
'@import "../lib/style/index.less";\n@import "../lib/style/components.less";' '@import "../lib/style/index.less";\n@import "../lib/style/components.less";'
); );
}); });
// eslint-disable-next-line
console.log('Built a entry less file to dist/antd.less'); console.log('Built a entry less file to dist/antd.less');
} }

View File

@ -1,3 +1,4 @@
/* eslint-disable global-require */
import pkg from '../package.json'; import pkg from '../package.json';
const testDist = process.env.LIB_DIR === 'dist'; const testDist = process.env.LIB_DIR === 'dist';
@ -6,7 +7,7 @@ describe('antd dist files', () => {
// https://github.com/ant-design/ant-design/issues/1638 // https://github.com/ant-design/ant-design/issues/1638
// https://github.com/ant-design/ant-design/issues/1968 // https://github.com/ant-design/ant-design/issues/1968
it('exports modules correctly', () => { it('exports modules correctly', () => {
const antd = testDist ? require('../dist/antd') : require('../components'); // eslint-disable-line global-require const antd = testDist ? require('../dist/antd') : require('../components');
expect(Object.keys(antd)).toMatchSnapshot(); expect(Object.keys(antd)).toMatchSnapshot();
}); });
@ -14,7 +15,7 @@ describe('antd dist files', () => {
// https://github.com/ant-design/ant-design/issues/1804 // https://github.com/ant-design/ant-design/issues/1804
if (testDist) { if (testDist) {
it('should have antd.version', () => { it('should have antd.version', () => {
const antd = require('../dist/antd'); // eslint-disable-line global-require const antd = require('../dist/antd');
expect(antd.version).toBe(pkg.version); expect(antd.version).toBe(pkg.version);
}); });
} }

View File

@ -95,10 +95,10 @@ declare module "lodash/debounce";
declare module "lodash/uniqBy"; declare module "lodash/uniqBy";
declare module 'intersperse';
declare module "raf"; declare module "raf";
declare module 'intersperse';
declare module "react-lifecycles-compat"; declare module "react-lifecycles-compat";
declare module "react-copy-to-clipboard"; declare module "react-copy-to-clipboard";