-
Notifications
You must be signed in to change notification settings - Fork 0
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 #2 from kuzzleio/1.0.0-proposal
Release 1.0.0
- Loading branch information
Showing
12 changed files
with
2,590 additions
and
153 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,67 @@ | ||
{ | ||
"rules": { | ||
"consistent-return": 0, | ||
"curly": 2, | ||
"dot-notation": 2, | ||
"eqeqeq": 2, | ||
"func-names": ["error", "always"], | ||
"guard-for-in": 2, | ||
"indent": [2, 2, {"SwitchCase": 1}], | ||
"linebreak-style": [2, "unix"], | ||
"new-cap": 1, | ||
"no-caller": 2, | ||
"no-catch-shadow": 2, | ||
"no-console": 2, | ||
"no-else-return": 2, | ||
"no-extend-native": 2, | ||
"no-extra-bind": 2, | ||
"no-eval": 2, | ||
"no-implicit-coercion": 2, | ||
"no-implied-eval": 2, | ||
"no-invalid-this": 2, | ||
"no-irregular-whitespace": 2, | ||
"no-labels": 2, | ||
"no-lone-blocks": 2, | ||
"no-lonely-if": 1, | ||
"no-loop-func": 2, | ||
"no-multi-spaces": 1, | ||
"no-multiple-empty-lines": 1, | ||
"no-native-reassign": 2, | ||
"no-nested-ternary": 2, | ||
"no-new": 2, | ||
"no-new-func": 2, | ||
"no-new-require": 2, | ||
"no-new-wrappers": 2, | ||
"no-return-assign": 2, | ||
"no-self-compare": 2, | ||
"no-sequences": 2, | ||
"no-shadow": 2, | ||
"no-shadow-restricted-names": 2, | ||
"no-throw-literal": 2, | ||
"no-undef": 2, | ||
"no-undef-init": 1, | ||
"no-unreachable": 2, | ||
"no-unused-expressions": [2, {"allowShortCircuit": true}], | ||
"no-useless-call": 2, | ||
"no-with": 2, | ||
"quotes": [2, "single"], | ||
"require-atomic-updates": 0, | ||
"semi": [2, "always"], | ||
"space-before-blocks": 2, | ||
"strict": [2, "global"], | ||
"vars-on-top": 2, | ||
"yoda": [2, "never"], | ||
"sort-keys": ["error", "asc"] | ||
}, | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"impliedStrict": false | ||
}, | ||
"ecmaVersion": 2018 | ||
}, | ||
"extends": "eslint:recommended" | ||
} |
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,10 @@ | ||
name: ESLint | ||
description: Run ESLint | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install dependencies & run ESLint | ||
shell: bash | ||
run: | | ||
npm ci | ||
npm run test:lint |
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,26 @@ | ||
name: Pull request checks | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-18.04 | ||
timeout-minutes: 30 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: "12" | ||
- uses: ./.github/actions/lint |
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,59 @@ | ||
name: Push checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-18.04 | ||
timeout-minutes: 30 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: "12" | ||
- uses: ./.github/actions/lint | ||
|
||
npm-deploy: | ||
name: Publish Package to NPM.js | ||
runs-on: ubuntu-18.04 | ||
timeout-minutes: 30 | ||
needs: [lint] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: | | ||
~/.cache/pip | ||
~/.npm | ||
**/node_modules | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm install | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,27 +1,82 @@ | ||
# Kuzzle Reloader | ||
# Ergol | ||
|
||
__For development purposes only__ | ||
|
||
This script is meant to be run on top of a Kuzzle starter script. It watches source files (json, ts, js) from Kuzzle core, plugins, configuration files. When a file changes, it automatically shuts the current process down, __WAIT__ until it has correctly been stopped (or kills it after some delay), and only then restarts it. | ||
This script is meant to run on top of another process while watching source files. If any change occurs, it automatically shuts the process down, __WAIT__ until it has correctly been stopped (or kills it after some delay), and only then restarts it. | ||
|
||
This script is meant to replace solutions like nodemon, which have a few cumbersome caveats. | ||
|
||
|
||
## Usage | ||
|
||
` $ npx kuzzle-reloader <config file> <node args> <starter script> <args> | ||
` | ||
`$ npx ergol <script> -c <config> -d <cwd>` | ||
|
||
| Arguments | Description | | ||
|----------------|-------------------------------------------| | ||
| config files | This script configuration file | | ||
| node args | Arguments to pass to the node interpreter | | ||
| starter script | The script to execute using node | | ||
| args | Script arguments | | ||
| Options | Alias | Required | Description | | ||
|-----------------|-------|----------|-------------------------------------------------------------------------| | ||
| No flag needed | - | yes | Script that runs under this process and that is reloaded when necessary | | ||
| `--config` | `-c` | no | JSON file containing configuration variables intended to override default ones | | ||
| `--cwd` | `-d` | no | Current Working Directory (if different from your actual cwd) | | ||
| `--script-args` | - | no | Arguments to pass to the script | | ||
| `--node-args` | - | no | Arguments to pass to the node interpreter | | ||
| `--watch` | `-w` | no | Array of cwd relative path/to/directories or files to watch | | ||
| `--kill-delay` | `-k` | no | Kill the process if it did not stop after this delay | | ||
|
||
|
||
## Configuration | ||
|
||
Ergol allows you to customize its behavior when necessary. If its a ponctual setting you can use one of the command argument listed before but we recommend using a config file when using recurrent options. | ||
|
||
If you choose to use both methods, beware of which setting will be selected. Ergol will resolve each parameter by looking for command options first, config file then and default config otherwise. | ||
|
||
### Default Config | ||
|
||
```json | ||
{ | ||
"killDelay": "5000", | ||
"nodeArgs": [], | ||
"scriptArgs": [], | ||
"watch": [ | ||
"lib", | ||
"src", | ||
"index.*s", | ||
"nodes_modules" | ||
] | ||
} | ||
``` | ||
|
||
|
||
## Example | ||
|
||
```sh-session | ||
$ npx kuzzle-reloader --inspect=0.0.0.0:9229 -r ts-node/register docker/scripts/start-kuzzle-dev.ts --enable-plugins functional-test-plugin | ||
$ npx ergol scripts/start-app.js -c config/ergol.config.json --script-args=--option my-option-1 | ||
``` | ||
|
||
### ergol.config.json | ||
|
||
```json | ||
{ | ||
"killDelay": "10000", | ||
"watch": [ | ||
"index.ts", | ||
"src", | ||
"package-lock.json" | ||
] | ||
} | ||
``` | ||
|
||
### Final Ergol Configuration | ||
|
||
```json | ||
{ | ||
"killDelay": "10000", | ||
"nodeArgs": [], | ||
"scriptArgs": [ | ||
"--option my-option-1" | ||
], | ||
"watch": [ | ||
"index.ts", | ||
"src", | ||
"package-lock.json" | ||
] | ||
} | ||
``` |
Oops, something went wrong.