Skip to content

Commit

Permalink
🎨 Clean up repo, update utilities (#1)
Browse files Browse the repository at this point in the history
* 📝 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
rushilsrivastava and legitatx authored Jul 2, 2021
1 parent bb752c3 commit 3154edd
Show file tree
Hide file tree
Showing 38 changed files with 15,318 additions and 3,817 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
sample/
.github/
66 changes: 66 additions & 0 deletions .eslintrc.js
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",
},
};
6 changes: 0 additions & 6 deletions .github/CHANGELOG.md

This file was deleted.

51 changes: 29 additions & 22 deletions .github/CONTRIBUTING.MD
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.
33 changes: 23 additions & 10 deletions .github/workflows/audit-and-lint.yml
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
46 changes: 30 additions & 16 deletions .github/workflows/publish.yml
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
33 changes: 23 additions & 10 deletions .github/workflows/tests.yml
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ jspm_packages
# Yarn Integrity file
.yarn-integrity

# NPM lock file
package-lock.json
# Yarn lock file
yarn.lock
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ dist/tests.js.map
.babelrc
.gitignore
tsconfig.json
tslint.json
webpack.config.js
yarn.lock
yarn.lock
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Rubens Pinheiro Gonçalves Cavalcante
Copyright (c) 2019 Rubens Pinheiro Gonçalves Cavalcante, 2021 Simplify Jobs Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 3154edd

Please sign in to comment.