Skip to content

Commit

Permalink
Improve distribution of this package (#6)
Browse files Browse the repository at this point in the history
* chore: remove transpiled files

* chore: update deps, configure typescript

* chore: add eslint plugin and run linter

* ci: add ci

* ci: remove unneeded secrets
  • Loading branch information
Kuruyia committed Apr 20, 2023
1 parent 97fbc50 commit f97db37
Show file tree
Hide file tree
Showing 52 changed files with 2,803 additions and 1,288 deletions.
16 changes: 16 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# JS generated files from TS
app.js
app.d.ts
app.js.map
lib/**/*.d.ts
lib/**/*.js.map
lib/**/*.js
tests/**/*.d.ts
tests/**/*.js.map
tests/**/*.js
index.d.ts
index.js
index.js.map

# Anything in the dist directory
dist/
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"plugins": ["kuzzle"],
"extends": [
"plugin:kuzzle/default",
"plugin:kuzzle/node",
"plugin:kuzzle/typescript"
]
}
11 changes: 11 additions & 0 deletions .github/workflows/pull_request.workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Pull request

on:
pull_request:

jobs:
tests_lint:
name: Lint
uses: ./.github/workflows/tests_lint.yaml
secrets: inherit

55 changes: 55 additions & 0 deletions .github/workflows/push_master.workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Push to master

on:
push:
branches:
- master

jobs:
tests_lint:
name: Lint
uses: ./.github/workflows/tests_lint.yaml
secrets: inherit

npm-deploy:
name: Publish Package to NPM.js
runs-on: ubuntu-22.04
needs: [functional-tests]
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
name: id_rsa
known_hosts: unnecessary

- name: Checkout repository
uses: actions/checkout@v3

- 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 }}-
- name: Install nodejs version 16
uses: actions/setup-node@v3
with:
node-version: 16

- name: Publish to NPM
run: |
npm install
npm run build
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/tests_lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run linter tests

on:
workflow_call:

jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install nodejs version 16
uses: actions/setup-node@v3
with:
node-version: 16

- name: Lint project
run: |
npm install -g npm
npm install
npm run test:lint
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,5 @@ node_modules/
*#
*~

# Typescript related files
# index.js
# index.d.ts
# index.js.map

# lib/**/*.d.ts
# lib/**/*.js.map
# lib/**/*.js
# TypeScript output
dist/
4 changes: 0 additions & 4 deletions index.d.ts

This file was deleted.

17 changes: 0 additions & 17 deletions index.js

This file was deleted.

1 change: 0 additions & 1 deletion index.js.map

This file was deleted.

91 changes: 0 additions & 91 deletions lib/config/ConfigManager.d.ts

This file was deleted.

143 changes: 0 additions & 143 deletions lib/config/ConfigManager.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/config/ConfigManager.js.map

This file was deleted.

Loading

0 comments on commit f97db37

Please sign in to comment.