Skip to content

Commit

Permalink
first commit for open source
Browse files Browse the repository at this point in the history
  • Loading branch information
PengJiyuan committed Oct 25, 2021
0 parents commit 845dee2
Show file tree
Hide file tree
Showing 3,028 changed files with 301,621 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 6 additions & 0 deletions .config/docgen.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = (config) => {
config.languages = ['zh-CN', 'en-US'];
config.template = '__template__/index.[language].md';
config.outputFileName = 'README.[language].md';
config.tsParseTool = ['ts-document'];
};
27 changes: 27 additions & 0 deletions .config/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 自定义 Jest 配置
exports.node = (config) => {
config.moduleNameMapper = {
'^@arco-design/web-react/(.+)$': '<rootDir>/$1',
'^@arco-design/web-react$': '<rootDir>',
};
};
exports.client = (config) => {
config.collectCoverageFrom = [
'components/**/*.{ts,tsx}',
'!components/**/style/*',
'!components/**/api/*',
];
config.coveragePathIgnorePatterns = [
'/node_modules/',
'/lib/',
'/es/',
'/dist/',
'/icon/',
'/components/index.tsx',
'/components/locale/',
];
config.moduleNameMapper = {
'^@arco-design/web-react/(.+)$': '<rootDir>/$1',
'^@arco-design/web-react$': '<rootDir>',
};
};
13 changes: 13 additions & 0 deletions .config/style.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = function StyleConfig(config) {
config.less.cssJsEntry = ['components/**/style/index.ts'];
config.less.output.dist.cssFileName = 'arco.css';
config.less.watch = [
'components/**/*.{less,woff,woff2,png,jpg}',
'components/style/theme/color/*.js',
];
config.less.watchBase = {
['components/**/*.{less,woff,woff2,png,jpg}']: 'components',
['components/style/theme/color/*.js']: 'components',
};
config.jsEntry.autoInjectArcoDep = false;
};
90 changes: 90 additions & 0 deletions .config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// 自定义 webpack 构建配置
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const { version } = require('../package.json');

// 组件 dist 打包
exports.component = (config) => {
config.entry = path.resolve(__dirname, '../components/index.tsx');
config.plugins.pop();
config.plugins.push(
new webpack.BannerPlugin({
banner: `ArcoDesign v${version}\n\nCopyright 2019-present, Bytedance, Inc.\nAll rights reserved.\n`,
})
);
};

// 图标 dist 打包
exports.icon = (config) => {
config.plugins.pop();
config.plugins.push(
new webpack.BannerPlugin({
banner: `ArcoDesign v${version}\n\nCopyright 2019-present, Bytedance, Inc.\nAll rights reserved.\n`,
})
);
};

// 官网
exports.site = (config, env) => {
if (env === 'prod') {
config.output.publicPath = '/';
}

config.entry = {
react: path.resolve(__dirname, '../site/src/index.js'),
'react-en': path.resolve(__dirname, '../site/src/index-en.js'),
};

config.module.rules[1].use[1].options.demoDir = '__demo__';

config.module.rules[1].use[1].options.autoHelmet = {
formatTitle: (value) => `${value} | ArcoDesign`,
};

// esbuild
config.module.rules[0].loader = 'esbuild-loader';
config.module.rules[0].options = {
loader: 'tsx',
target: 'es2015',
};
config.module.rules[1].use[0].loader = 'esbuild-loader';
config.module.rules[1].use[0].options = {
loader: 'tsx',
target: 'es2015',
};

config.plugins[0] = new HtmlWebpackPlugin({
template: path.resolve(__dirname, '../site/public/index.ejs'),
templateParameters: {
title: 'Arco Design - 企业级产品的完整设计和开发解决方案',
lang: 'zh',
},
chunks: ['react'],
});

config.plugins.push(
new HtmlWebpackPlugin({
filename: 'index-en.html',
template: path.resolve(__dirname, '../site/public/index.ejs'),
templateParameters: {
title:
'Arco Design - Complete design and development solutions for enterprise-level products',
lang: 'en',
},
chunks: ['react-en'],
})
);

config.resolve.alias['@arco-design/web-react'] = path.resolve(__dirname, '..');
// config.resolve.alias['dayjs$'] = 'moment-timezone';

if (env === 'dev') {
config.devServer.historyApiFallback = {
rewrites: [
{ from: /^(\/(react|docs|showcase)){0,1}\/en-US/, to: '/index-en.html' },
{ from: /^\/$/, to: '/index.html' },
],
};
}
};
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
max_line_length = 100
trim_trailing_whitespace = true
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
icon/index.js
icon/index.es.js
icon/demo.js
icon/index.d.ts
stories/**/*.jsx
*.json
react-icon/
react-icon-cjs/
131 changes: 131 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"root": true,
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"extends": [
"airbnb",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:react-hooks/recommended",
],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": ["react", "babel", "@typescript-eslint/eslint-plugin", "eslint-plugin-tsdoc"],
"globals": {
"ActiveXObject": false,
"describe": false,
"it": false,
"expect": false,
"jest": false,
"$": false,
"afterEach": false,
"beforeEach": false
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"rules": {
"@typescript-eslint/no-unused-vars": [2, { "args": "none" }],
"@typescript-eslint/no-use-before-define": [2, { "functions": false, "classes": false }]
}
}
],
"rules": {
"prettier/prettier": ["error", { "trailingComma": "es5", "printWidth": 100 }],
"linebreak-style": ["error", "unix"],
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-case-declarations": 0,
"no-param-reassign": 0,
"no-underscore-dangle": 0,
"no-useless-constructor": 0,
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
"no-restricted-syntax": 0,
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
"no-plusplus": 0,
"no-return-assign": 0,
"no-script-url": 0,
"no-extend-native": 0,
"no-restricted-globals": 0,
"no-nested-ternary": 0,
"no-empty": 0,
"no-void": 0,
"no-useless-escape": 0,
"no-bitwise": 0,
"no-mixed-operators": 0,
"consistent-return": 0,
"one-var": 0,
"prefer-promise-reject-errors": 0,
"prefer-destructuring": 0,
"global-require": 0,
"guard-for-in": 0,
"func-names": 0,
"strict": 0,
"radix": 0,
"no-prototype-builtins": 0,
"class-methods-use-this": 0,
"import/no-dynamic-require": 0,
"import/no-unresolved": 0,
"import/extensions": 0,
"import/no-extraneous-dependencies": 0,
"import/prefer-default-export": 0,
"react/no-danger": 0,
"react/forbid-prop-types": 0,
"react/prop-types": 0,
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", "ts", "tsx"] }],
"react/sort-comp": 0,
"react/no-did-update-set-state": 0,
"react/prefer-stateless-function": 0,
"react/jsx-closing-tag-location": 0,
"react/jsx-no-bind": 0,
"react/no-array-index-key": 0,
"react/no-children-prop": 0,
"react/no-did-mount-set-state": 0,
"react/no-find-dom-node": 0,
"react/default-props-match-prop-types": 0,
"react/jsx-one-expression-per-line": 0,
"jsx-a11y/anchor-is-valid": 0,
"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/click-events-have-key-events": 0,
"jsx-a11y/no-noninteractive-element-interactions": 0,
"jsx-a11y/alt-text": 0,
"jsx-a11y/label-has-for": 0,
"jsx-a11y/label-has-associated-control": 0,
"jsx-a11y/no-noninteractive-tabindex": 0,
"jsx-a11y/tabindex-no-positive": 0,
"react/jsx-indent": 0,
"react/display-name": 0,
"react/no-multi-comp": 0,
"react/destructuring-assignment": 0,
"react/no-access-state-in-setstate": 0,
"react/button-has-type": 0,
"react/require-default-props": 0,
"react/jsx-wrap-multilines": 0,
"react/no-render-return-value": 0,
"array-callback-return": 0,
"no-cond-assign": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"no-use-before-define": 0,
"@typescript-eslint/no-use-before-define": 2,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-empty-function": 0,
"no-shadow": 0,
"no-continue": 0,
"no-loop-func": 0,
"prefer-spread": 0,
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"tsdoc/syntax": "warn",
"no-undef": 0
}
}
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Create new issue
url: https://arco.design/issue-helper?repo=arco-design
about: Please use the following link to create a new issue.
52 changes: 52 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!--
Thanks so much for your PR and contribution.
Before submitting, please make sure to follow the Pull Request Guidelines: https://github.com/arco-design/arco-design/blob/master/CONTRIBUTING.md
-->

<!-- Put an `x` in "[ ]" to check a box) -->

## Types of changes

<!-- What types of changes does this PR introduce -->
- [ ] New feature
- [ ] Bug fix
- [ ] Documentation change
- [ ] Coding style change
- [ ] Component style change
- [ ] Refactoring
- [ ] Performance improvement
- [ ] Test cases
- [ ] Continuous integration
- [ ] Typescript definition change
- [ ] Breaking change

## Background and context

<!-- Explain what problem does the PR solve -->
<!-- Link to related open issues if applicable -->

## Solution

<!-- Describe how the problem is fixed in detail -->

## How is the change tested?

<!-- Unit tests should be added/updated for bug fixes and new features, if applicable -->
<!-- Please describe how you tested the change. E.g. Creating/updating unit tests or attaching a screenshot of how it works with your change -->

## Changelog

| Component | Changelog(CN) | Changelog(EN) | Related issues |
| --------- | ------------- | ------------- | -------------- |
| | | | |

## Checklist:

- [ ] Test suite passes (`npm run test`)
- [ ] Provide changelog for relevant changes (e.g. bug fixes and new features) if applicable.
- [ ] Changes are submitted to the appropriate branch (e.g. features should be submitted to `feature` branch and others should be submitted to `master` branch)

## Other information

<!-- Please describe what other information that should be taken care of. E.g. describe the impact if introduce a breaking change -->
Loading

0 comments on commit 845dee2

Please sign in to comment.