Skip to content

Commit

Permalink
init: basic env
Browse files Browse the repository at this point in the history
  • Loading branch information
warmhug committed Jun 4, 2018
1 parent 47066c0 commit c53cd4f
Show file tree
Hide file tree
Showing 24 changed files with 817 additions and 5 deletions.
46 changes: 46 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"env": {
"development": {
"presets": [
"react-native"
],
"plugins": [
[
"import",
{
"libraryName": "antd-mobile",
"libraryDirectory": "components"
}
]
]
},
"production": {
"presets": [
"react-native"
],
"plugins": [
[
"import",
{
"libraryName": "antd-mobile",
"libraryDirectory": "components"
}
]
]
},
"test": {
"presets": [
"react-native"
],
"plugins": [
[
"import",
{
"libraryName": "antd-mobile",
"libraryDirectory": "components"
}
]
]
}
}
}
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
components/**/*.js
components/**/*.jsx
components/*/__tests__/type.tsx
!.eslintrc.js
!components/*/__tests__/**/*.js
!components/*/demo/*
77 changes: 77 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const eslintrc = {
extends: ['eslint-config-airbnb'],
env: {
browser: true,
node: true,
mocha: true,
jest: true,
es6: true,
},
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 6,
ecmaFeatures: {
jsx: true,
experimentalObjectRestSpread: true,
},
},
plugins: [
'markdown',
'react',
'babel',
'jsx-a11y',
],
rules: {
'class-methods-use-this': 0,
'func-names': 0,
'react/sort-comp': 0,
'react/prop-types': 0,
'react/jsx-first-prop-new-line': 0,
'no-param-reassign': 0,
'no-return-assign': 0,
'max-len': 0,
'react/no-multi-comp': 0,
'array-callback-return': 0,
'import/no-unresolved': 0,
'jsx-a11y/img-has-alt': 0,
'import/extensions': 0,
'import/no-extraneous-dependencies': 0,
'react/no-string-refs': 0,
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.tsx', '.md'] }],
'react/no-array-index-key': 0,
'react/no-find-dom-node': 0,
'react/require-extension': 0,
'jsx-a11y/anchor-has-content': 0,
'jsx-a11y/href-no-hash': 0,
'jsx-a11y/no-static-element-interactions': 0,
'jsx-a11y/click-events-have-key-events': 0,
'prefer-destructuring': 0,
'jsx-a11y/anchor-is-valid': 0,
'react/jsx-no-comment-textnodes': 0,
'object-curly-newline': 0,
},
};

if (process.env.RUN_ENV === 'DEMO') {
eslintrc.globals = {
React: true,
ReactDOM: true,
mountNode: true,
AlipayJSBridge: true,
$: true,
dd: true,
process: true,
};

Object.assign(eslintrc.rules, {
'no-console': 0,
'no-alert': 0,
'no-plusplus': 0,
'import/no-webpack-loader-syntax': 0,
'eol-last': 0,
'prefer-rest-params': 0,
'react/no-multi-comp': 0,
});
}

module.exports = eslintrc;
56 changes: 56 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Contributing to Ant Design Mobile

The following is a set of guidelines for contributing to Ant Design Mobile. Please spend several minutes in reading these guidelines before you create an issue or pull request.

Anyway, these are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request.


## Do your homework before asking a question

It's a great idea to read Eric Steven Raymond's [How To Ask Questions The Smart Way](http://www.catb.org/esr/faqs/smart-questions.html) twice before asking a question. But if you are busy now, I recommend to read [Don't post homework questions](http://www.catb.org/esr/faqs/smart-questions.html#homework) first.

The following guidelines are about *How to avoid Homework Questions*.

### 1. Read the documentation.

It sad but true that someone just glance(not read) [Ant Design Mobile's documentation](http://mobile.ant.design/). Please read the documentation closely.

Tips: choose the corresponding documentation with versions selector which in the bottom-right corner.

### 2. Make sure that your question is about Ant Design Mobile, not React

Someone may think all of the questions that he/she meets in developing are about Ant Design Mobile, but it's not true. So, please read [React's documentaion](http://facebook.github.io/react/docs/getting-started.html) or just Google(not Baidu, seriously) your questions with keywork *React* first. If you are sure that your question is about Ant Design Mobile, go ahead.

### 3. Read the FAQ and search the issues list of Ant Design Mobile

Your questions may be asked and solved by others. So please spend several minutes on searching. Remember [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), both code and questions.

P.S.

1. [FAQ](https://github.com/ant-design/ant-design-mobile-rn/wiki/FAQ)
1. [Issues list](https://github.com/ant-design/ant-design-mobile-rn/issues)

## Close your issue if it's solved

It is a good habit which will save maintainers' time. Thank you!

## Providing a demo while reporting a bug

It would be helpful to provide a demo which can re-produce the bug 100%. Please give us the steps in detail that can help us re-producing the bug you met. Then, create an issue. The most important thing is: double check before claiming that you have found a bug.


## Tips about Feature Request

If you believe that Ant Design Mobile should provide some features, but it does not. You could create an issue to discuss. However, Ant Design Mobile is not Swiss Army Knife, there are some features which Ant Design Mobile will not support:

1. Request or operate data


## Tips about Pull Request

It's welcomed to pull request. And there are some tips about that:

1. It is a good habit to create a feature request issue to disscuss whether the feature is necessary before you implement it. However, it's unnecessary to create an issue to claim that you found a typo or improved the readability of documentaion, just create a pull request.
1. Run `npm run lint` and fix those errors before committing in order to keep consistent code style.
1. Rebase before creating a PR to keep commit history clear.
1. Add some descriptions and refer relative issues for you PR.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--
IMPORTANT: Please use the following link to create a new issue:
http://new-issue.ant.design?repo=ant-design-mobile-rn
If your issue was not created using the app above, it will be closed immediately.
-->

<!--
注意:请使用下面的链接来新建 issue:
http://new-issue.ant.design?repo=ant-design-mobile-rn
不是用上面的链接创建的 issue 会被立即关闭。
-->
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
First of all, thank you for your contribution! :-)

Please makes sure that these checkboxes are checked before submitting your PR, thank you!

* [ ] 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.

Extra checklist:

**if** *isBugFix* **:**

* [ ] Make sure that you add at least one unit test for the bug which you had fixed.

**elif** *isNewFeature* **:**

* [ ] Update API docs for the component.
* [ ] Update/Add demo to demonstrate new feature.
* [ ] Update TypeScript definition for the component.
* [ ] Add unit tests for the feature.
14 changes: 14 additions & 0 deletions .github/lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Configuration for lock-threads - https://github.com/dessant/lock-threads

# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 510
# Comment to post before locking. Set to `false` to disable
lockComment: >
This thread has been automatically locked because it has not had recent
activity. Please open a new issue for related bugs and link to relevant
comments in this thread.
# Issues or pull requests with these labels will not be locked
# exemptLabels:
# - no-locking
# Limit to only `issues` or `pulls`
only: issues
50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
*.iml
.idea/
.ipr
.iws
*~
~*
*.diff
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
*.swo
*.log
node_modules/
.buildpath
.settings
npm-debug.log
nohup.out
_site
/dist
lib
elasticsearch-*
config/base.yaml
_data
rn-kitchen-sink/ios/build
rn-kitchen-sink/ios/bundle
rn-kitchen-sink/android/bundle
rn-kitchen-sink/android/.gradle
rn-kitchen-sink/android/app/build
rn-kitchen-sink/android/build
rn-kitchen-sink/android/local.properties
rn-kitchen-sink/android/app/src/main/res/drawable*
rn-kitchen-sink/app/*.ipa
rn-kitchen-sink/app/*.apk
xcuserdata
components/**/*.jsx
components/**/*.js
my-release-key.keystore
.vscode
yarn.lock
npm-debug.log*
!components/**/__tests__/*.js
coverage
/es/
package-lock.json
.cdnkey
46 changes: 46 additions & 0 deletions .jest.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const libDir = process.env.LIB_DIR;

const transformPackages = [
'react-native',
'react-native-menu',
'react-native-tab-view',
'react-native-collapsible',
'react-native-swipeout',
'react-native-camera-roll-picker',
]

module.exports = {
preset: 'react-native',
setupFiles: [
'./tests/setup.native.js'
],
moduleFileExtensions: [
'native.ts',
'native.tsx',
'native.js',
'native.jsx',
'ts',
'tsx',
'js',
'jsx',
'json',
],
testPathIgnorePatterns: [
'/node_modules/',
'_site',
'site',
],
transform: {
'\\.tsx?$': './node_modules/antd-tools/lib/jest/codePreprocessor',
'\\.js$': './node_modules/antd-tools/lib/jest/codePreprocessor',
'\\.png': '<rootDir>/tests/imageStub.js',
},
testRegex: libDir === 'dist' ? 'demo\\.test\\.native\\.js$' : '.*\\.test\\.native\\.js$',
collectCoverageFrom: [
'components/**/*.native.{ts,tsx}',
'!components/*/style/*.{ts,tsx}',
],
transformIgnorePatterns: [
`node_modules/(?!(${transformPackages.join('|')})/)`,
],
};
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/**/demo/*.*
45 changes: 45 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
sudo: false

git:
submodules: false

language: node_js

notifications:
email:
- hust2012jiangkai@gmail.com
- hualei5280@gmail.com
- zhang740@qq.com
- rjmuqiang@gmail.com

node_js:
- "8"

env:
matrix:
- TEST_TYPE=lint
- TEST_TYPE=dist
- TEST_TYPE=compile
- TEST_TYPE=test:web
- TEST_TYPE=test:rn

script:
- |
if [ "$TEST_TYPE" = lint ]; then
npm run lint
elif [ "$TEST_TYPE" = dist ]; then
npm run dist && \
LIB_DIR=dist npm run test:web -- -w 2
elif [ "$TEST_TYPE" = compile ]; then
npm run compile && \
LIB_DIR=lib npm run test:web -- -w 2 && \
LIB_DIR=lib npm run test:rn -- -w 2 && \
LIB_DIR=es npm run test:web -- -w 2
LIB_DIR=es npm run test:rn -- -w 2
elif [ "$TEST_TYPE" = test:web ]; then
npm run test:web -- -w 2 --coverage && \
bash <(curl -s https://codecov.io/bash) -cF web
elif [ "$TEST_TYPE" = test:rn ]; then
npm run test:rn -- -w 2 --coverage && \
bash <(curl -s https://codecov.io/bash) -cF rn
fi
Loading

0 comments on commit c53cd4f

Please sign in to comment.