-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from avallete/8-refactor-script
8 refactor script
- Loading branch information
Showing
66 changed files
with
22,369 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
const unitTestsExtends = ['plugin:ava/recommended'] | ||
const cypressTestsExtends = ['plugin:cypress/recommended', 'eslint-config-sinon', 'plugin:chai-friendly/recommended'] | ||
const commonExtends = ['plugin:prettier/recommended', 'plugin:unicorn/recommended', 'plugin:radar/recommended'] | ||
const tsExtends = ['airbnb-typescript/base', ...commonExtends] | ||
const jsExtends = ['airbnb-base', ...commonExtends] | ||
|
||
// Override some rules that we abuse into our tests | ||
const UNIT_TESTS_TS_OVERRIDE = { | ||
files: ['test/**/*.ts', 'test/**/*.tsx'], | ||
extends: [...unitTestsExtends, ...tsExtends], | ||
rules: { | ||
'radar/no-duplicate-string': 'off', | ||
'no-unused-expressions': 'off', | ||
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'], | ||
}, | ||
} | ||
const UNIT_TESTS_JS_OVERRIDE = { | ||
files: ['test/**/*.js'], | ||
extends: [...unitTestsExtends, ...jsExtends], | ||
rules: { | ||
'radar/no-duplicate-string': 'off', | ||
'no-unused-expressions': 'off', | ||
}, | ||
} | ||
const CYPRESS_TS_OVERRIDE = { | ||
files: ['cypress/**/*.ts'], | ||
extends: [...cypressTestsExtends, ...tsExtends], | ||
rules: { | ||
'radar/no-duplicate-string': 'off', | ||
'no-unused-expressions': 'off', | ||
}, | ||
} | ||
const CYPRESS_JS_OVERRIDE = { | ||
files: ['cypress/**/*.js'], | ||
extends: [...cypressTestsExtends, ...jsExtends], | ||
parserOptions: { | ||
ecmaVersion: 2020, | ||
}, | ||
rules: { | ||
'radar/no-duplicate-string': 'off', | ||
'no-unused-expressions': 'off', | ||
quotes: 'off', | ||
semi: 'off', | ||
}, | ||
} | ||
const TS_OVERRIDE = { | ||
rules: { | ||
// disable for event handlers, use preact naming convention for scoped ignore rules | ||
// allow us to du currentTarget.value = 'something' into event handlers | ||
'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: ['currentTarget'] }], | ||
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'], | ||
// DOM .append unavailable in typescript types definitions | ||
'unicorn/prefer-dom-node-append': 'off', | ||
// Since our final script is bundled, devDependencies and dependencies are just useful | ||
// for semantic separation. Only include in dependencies the packages who the code actually | ||
// end up into your final bundled file | ||
'import/no-extraneous-dependencies': ['error', { devDependencies: true }], | ||
}, | ||
files: ['**/*.ts', '**/*.tsx'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: './tsconfig.eslint.json', | ||
tsconfigRootDir: __dirname, | ||
}, | ||
plugins: ['@typescript-eslint'], | ||
extends: [...tsExtends], | ||
settings: { | ||
'import/resolver': { | ||
typescript: {}, | ||
}, | ||
}, | ||
overrides: [UNIT_TESTS_TS_OVERRIDE, CYPRESS_TS_OVERRIDE], | ||
} | ||
|
||
module.exports = { | ||
extends: jsExtends, | ||
overrides: [UNIT_TESTS_JS_OVERRIDE, CYPRESS_JS_OVERRIDE, TS_OVERRIDE], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: " \U0001F41B Bug Report" | ||
about: Got a bug! File it using this template! | ||
title: '[BUG]' | ||
labels: bug | ||
assignees: '' | ||
--- | ||
|
||
**Steps to reproduce**: | ||
|
||
**Expected results**: | ||
|
||
**Actual results**: | ||
|
||
**Notes**: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
name: " \U0001F680 Feature Request" | ||
about: Suggest an idea for this project | ||
title: '[FEAT]' | ||
labels: feature | ||
assignees: '' | ||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
Please describe the problem you are trying to solve. | ||
|
||
**Describe the solution you'd like** | ||
Please describe the desired behavior. | ||
|
||
**Describe alternatives you've considered** | ||
Please describe alternative solutions or features you have considered. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
blank_issues_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!--- Provide a general summary of your changes in the Title above --> | ||
|
||
## Description | ||
|
||
<!--- Describe your changes in detail --> | ||
|
||
## Related Issue | ||
|
||
<!--- This project only accepts pull requests related to open issues --> | ||
<!--- If suggesting a new feature or change, please discuss it in an issue first --> | ||
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> | ||
<!--- Please link to the issue here: --> | ||
|
||
## Motivation and Context | ||
|
||
<!--- Why is this change required? What problem does it solve? --> | ||
|
||
## How Has This Been Tested? | ||
|
||
<!--- Please describe in detail how you tested your changes. --> | ||
<!--- Include details of your testing environment, and the tests you ran to --> | ||
<!--- see how your change affects other areas of the code, etc. --> | ||
|
||
## Screenshots (if appropriate): | ||
|
||
## Types of changes | ||
|
||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> | ||
|
||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to change) | ||
|
||
## Checklist: | ||
|
||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. --> | ||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> | ||
|
||
- [ ] My code follows the code style of this project. | ||
- [ ] My change requires a change to the documentation. | ||
- [ ] I have updated the documentation accordingly. | ||
- [ ] I have added tests to cover my changes. | ||
- [ ] All new and existing tests passed. | ||
|
||
## Closing issues | ||
|
||
Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: CD | ||
|
||
on: | ||
# Use semantic-release to publish the updated package.json to master branch with a new release and tag | ||
# deploy-gh-pages is responsible to build production version and publish it to gh-pages branch | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 14 | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
- name: Lint | ||
run: | | ||
npm run lint | ||
- name: Coverage | ||
# Could be replaced with coverage-all if you want to ensure new files are tested as well | ||
run: | | ||
npm run coverage | ||
npm run coverage:report | ||
env: | ||
NODE_ENV: test | ||
- name: E2E-tests | ||
uses: cypress-io/github-action@v2 | ||
with: | ||
build: npm run build | ||
env: | ||
NODE_ENV: test | ||
# Will update the package.json file with semantic-release and push it to master with a new tag | ||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v2 | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_SEMANTIC_RELEASE_TOKEN }} | ||
GIT_AUTHOR_NAME: github-actions | ||
GIT_AUTHOR_EMAIL: 44210433+github-actions@users.noreply.github.com | ||
GIT_COMMITTER_NAME: github-actions | ||
GIT_COMMITTER_EMAIL: 44210433+github-actions@users.noreply.github.com | ||
- name: Upload coverage to CodeCov | ||
uses: codecov/codecov-action@v1 | ||
continue-on-error: true | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | ||
directory: coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CI | ||
|
||
on: | ||
# CD workflow is responsible for building and release on push to master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 14 | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
- name: Lint | ||
run: | | ||
npm run lint | ||
- name: Coverage | ||
# Could be replaced with coverage-all if you want to ensure new files are tested as well | ||
run: | | ||
npm run coverage | ||
npm run coverage:report | ||
env: | ||
NODE_ENV: test | ||
- name: E2E-tests | ||
uses: cypress-io/github-action@v2 | ||
with: | ||
build: npm run build | ||
env: | ||
NODE_ENV: test | ||
- name: Upload coverage to CodeCov | ||
uses: codecov/codecov-action@v1 | ||
continue-on-error: true | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | ||
directory: coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Deploy to Github Pages | ||
|
||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 14 | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
- name: Lint | ||
env: | ||
USERSCRIPTER_MODE: production | ||
NODE_ENV: production | ||
run: | | ||
npm run build | ||
- name: Deploy | ||
uses: JamesIves/github-pages-deploy-action@releases/v4 | ||
with: | ||
BRANCH: gh-pages | ||
FOLDER: dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Mark stale issues and pull requests | ||
|
||
on: | ||
schedule: | ||
- cron: '21 4 * * *' | ||
|
||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/stale@v3 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
stale-issue-message: 'This issue has become stale and will be closed automatically within a period of time. Sorry about that.' | ||
stale-pr-message: 'This pull request has become stale and will be closed automatically within a period of time. Sorry about that.' | ||
stale-issue-label: 'no-issue-activity' | ||
stale-pr-label: 'no-pr-activity' | ||
days-before-stale: 90 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
.awcache | ||
.idea | ||
node_modules/ | ||
dist/ | ||
.userscripter-temp/ | ||
.eslintcache | ||
.nyc_output/ | ||
coverage/ | ||
cypress/videos/ | ||
cypress/screenshots/ | ||
.vscode | ||
.dccache | ||
# is generated at build time, should not be commited | ||
metadata-config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
*.log | ||
.babelrc | ||
.awcache | ||
dist/ | ||
.userscripter-temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"extends": "@istanbuljs/nyc-config-typescript", | ||
"check-coverage": true, | ||
"include": [ | ||
"src/**", | ||
"metadata.ts" | ||
], | ||
"exclude": [ | ||
"dist/**", | ||
"cypress/**", | ||
"test/**" | ||
], | ||
"reporter": [ | ||
"text" | ||
], | ||
"lines": 70, | ||
"branches": 70, | ||
"statements": 70 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"jsxSingleQuote": true, | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.