Browse Source

⚙️ upgrade code style

pull/13325/head
afc163 6 years ago
parent
commit
647ba193cd
No known key found for this signature in database GPG Key ID: 738F973FCE5C6B48
  1. 4
      .github/ISSUE_TEMPLATE.md
  2. 8
      .github/PULL_REQUEST_TEMPLATE.md
  3. 14
      scripts/prepub.js
  4. 5
      tests/index.test.js
  5. 4
      typings/custom-typings.d.ts

4
.github/ISSUE_TEMPLATE.md

@ -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
@ -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

8
.github/PULL_REQUEST_TEMPLATE.md

@ -1,12 +1,12 @@
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).
* [ ] 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.
* [ ] Add some descriptions and refer relative issues for you PR.
* [ ] Rebase before creating a pull request to keep commit history clear.
* [ ] Add some descriptions and refer relative issues for you pull request.
Extra checklist:

14
scripts/prepub.js

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

5
tests/index.test.js

@ -1,3 +1,4 @@
/* eslint-disable global-require */
import pkg from '../package.json';
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/1968
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();
});
@ -14,7 +15,7 @@ describe('antd dist files', () => {
// https://github.com/ant-design/ant-design/issues/1804
if (testDist) {
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);
});
}

4
typings/custom-typings.d.ts

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

Loading…
Cancel
Save