-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 Clean up repo, update utilities (#1)
* 📝 Repository cleanup * ⚡ Upgrade to NPM * 🎨 TSLint --> ESLint * 🎨 TSLint --> ESLint * 🎨 TSLint --> ESLint * ✅ Fix tests * ✅ Update legacy tests * ✅ Update legacy tests * ✅ Update legacy tests We will always use webpack 5+, remove version check for stub to avoid crazy workaround hack Co-authored-by: legitatx <[email protected]>
- Loading branch information
1 parent
bb752c3
commit 3154edd
Showing
38 changed files
with
15,318 additions
and
3,817 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,4 @@ | ||
node_modules/ | ||
dist/ | ||
sample/ | ||
.github/ |
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,66 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
es6: true, | ||
}, | ||
globals: { | ||
window: "readonly", | ||
}, | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
parser: "@babel/eslint-parser", | ||
ecmaVersion: 6, | ||
sourceType: "module", | ||
}, | ||
extends: [ | ||
"airbnb", | ||
"plugin:react/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:jsx-a11y/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
], | ||
settings: { | ||
"import/resolver": { | ||
node: { | ||
paths: [".", "src"], | ||
extensions: [".js", ".ts"], | ||
}, | ||
}, | ||
}, | ||
plugins: [ | ||
"prettier", | ||
"react", | ||
"jsx-a11y", | ||
"react-hooks", | ||
"@typescript-eslint", | ||
], | ||
rules: { | ||
"import/extensions": "off", | ||
"import/prefer-default-export": "off", | ||
"import/no-webpack-loader-syntax": "off", | ||
"import/no-unresolved": "off", | ||
"import/no-extraneous-dependencies": "off", | ||
"no-use-before-define": "off", | ||
"no-console": "off", | ||
"no-extend-native": "off", | ||
"no-param-reassign": "off", | ||
"class-methods-use-this": "off", | ||
"node/no-unpublished-require": "off", | ||
"node/no-missing-import": "off", | ||
"node/no-unpublished-import": "off", | ||
"dot-notation": ["error", { allowKeywords: true }], | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-var-requires": "off", | ||
"func-names": "off", | ||
"no-underscore-dangle": "off", | ||
camelcase: "warn", | ||
"no-plusplus": "off", | ||
"no-nested-ternary": "off", | ||
"@typescript-eslint/ban-types": "warn", | ||
"no-unused-expressions": "off", | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,66 +1,73 @@ | ||
# How to Contribute | ||
|
||
## Important checks | ||
- Before create any pull requests, please open a issue explaining the situation | ||
- Be sure to follow the tslint rules and run the prettier | ||
- Be sure **before open the pull request**, to test the existent code and/or create tests if you made a new feature or | ||
Before create any pull requests, please open a issue explaining the situation | ||
|
||
- Be sure to follow the eslint rules and run the prettier | ||
- Be sure **before open the pull request**, to test the existent code and/or create tests if you made a new feature or | ||
changed a already existing one. | ||
|
||
# Issues | ||
## Issues | ||
|
||
Should be in the format: | ||
|
||
```text | ||
**Type:** | ||
- [x] bug | ||
- [x] bug | ||
- [ ] feature | ||
- [ ] enhancement | ||
- [ ] question | ||
**Environment:** | ||
- OS: Windows 10 | ||
- Version: 0.6.0 | ||
- Version: 0.6.0 | ||
**Going to open a PR:** | ||
- [x] yes | ||
- [ ] no | ||
**Description:** | ||
**Description:** | ||
The messages aren't showing on the console | ||
``` | ||
|
||
# Pull Requests | ||
## Pull Requests | ||
|
||
- On the description of the pull request set the issue id for closing it: | ||
|
||
```text | ||
Now the messages are showing. Closes #41 | ||
``` | ||
|
||
## Following the guideline | ||
|
||
Please follow the above rules, so the repo can stay consistent and easy for everyone find questions and | ||
already resolved stuff. Be aware that your PR can be denied if you don't follow then :cry: | ||
|
||
# Running this project locally | ||
## Running this project locally | ||
|
||
### Building and Testing | ||
|
||
## Building and Testing | ||
Inside this repository have an example plugin, so you can test and see it working | ||
After cloning the repository, run: | ||
``` | ||
After cloning the repository, run: | ||
|
||
```bash | ||
yarn build | ||
``` | ||
|
||
And then run: | ||
``` | ||
And then run: | ||
|
||
```bash | ||
yarn start:sample | ||
``` | ||
|
||
This will make the webpack run in watch mode for the sample plugin source and output the built files on the "dist" | ||
directory. | ||
Load the extension **(the files in "sample/dist" directory)** using the "load unpacked extension", open a | ||
new tab in any site and open the developer panel on it. Watch the dev. tools console tab, and do some changes on | ||
Load the extension **(the files in "sample/dist" directory)** using the "load unpacked extension", open a | ||
new tab in any site and open the developer panel on it. Watch the dev. tools console tab, and do some changes on | ||
the background or content script. Voila! | ||
|
||
**Note:** | ||
You must have both background and content scripts for this plugin to work, and they must be specified in separate `entry` chunks | ||
in your webpack config. | ||
|
||
The reloading script will be injected only on the main entries chunks (in background and content script). Any other | ||
chunks will be ignored. | ||
chunks will be ignored. |
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 |
---|---|---|
@@ -1,25 +1,38 @@ | ||
name: audit-and-lint | ||
|
||
on: [push] | ||
|
||
jobs: | ||
install-audit-lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Cache NPM dependencies | ||
id: npm-cache | ||
uses: actions/cache@v1 | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14.x" | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/yarn | ||
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} | ||
path: node_modules | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- name: Install dependencies | ||
run: yarn | ||
run: npm ci | ||
env: | ||
CI: TRUE | ||
|
||
- name: Package auditory | ||
run: yarn audit | ||
run: npm audit | ||
|
||
- name: Lint the source | ||
run: yarn lint | ||
run: npm run lint | ||
env: | ||
CI: TRUE |
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 |
---|---|---|
@@ -1,34 +1,48 @@ | ||
name: publish | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Cache NPM dependencies | ||
id: npm-cache | ||
uses: actions/cache@v1 | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14.x" | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/yarn | ||
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} | ||
path: node_modules | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
env: | ||
CI: TRUE | ||
|
||
- name: Install and build | ||
run: | ||
- yarn | ||
- yarn build | ||
- name: Build plugin | ||
run: npm run build | ||
env: | ||
CI: TRUE | ||
|
||
- name: Publish package | ||
run: | | ||
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} | ||
npm publish --ignore-scripts | ||
env: | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
CI: true | ||
run: | ||
- echo "//registry.yarnpkg.com/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc | ||
- yarn publish | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
CI: TRUE |
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 |
---|---|---|
@@ -1,25 +1,38 @@ | ||
name: tests | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Cache NPM dependencies | ||
id: npm-cache | ||
uses: actions/cache@v1 | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14.x" | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/yarn | ||
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} | ||
path: node_modules | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- name: Install dependencies | ||
run: yarn | ||
run: npm ci | ||
env: | ||
CI: TRUE | ||
|
||
- name: Build plugin | ||
run: yarn build | ||
run: npm run build | ||
|
||
- name: Run the tests | ||
run: yarn test | ||
run: npm run test | ||
env: | ||
CI: TRUE |
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -8,6 +8,5 @@ dist/tests.js.map | |
.babelrc | ||
.gitignore | ||
tsconfig.json | ||
tslint.json | ||
webpack.config.js | ||
yarn.lock | ||
yarn.lock |
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.