Skip to content

Commit

Permalink
Build/ci cd setup (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
carpasse authored Feb 2, 2024
2 parents 6c8db40 + 2400268 commit f3dd9c0
Show file tree
Hide file tree
Showing 6 changed files with 8,148 additions and 3,031 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ name: Node.js CI

on:
push:
branches: [ "master" ]
branches: ['master']
pull_request:
branches: [ "master" ]
branches: ['master']

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand All @@ -20,13 +19,13 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm run lint
- run: npm test
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci --ignore-scripts
- run: npm run build --if-present
- run: npm run lint:ci
- run: npm test
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: npm ci --ignore-scripts

- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
57 changes: 57 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"type": "docs",
"scope": "README",
"release": "patch"
},
{
"type": "refactor",
"release": "patch"
},
{
"type": "perf",
"release": "patch"
},
{
"type": "style",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "build",
"release": "patch"
},
{
"type": "ci",
"release": "patch"
},
{
"type": "chore",
"release": "patch"
},
{
"type": "revert",
"release": "patch"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,21 +209,21 @@ const start = async (config: Config) => {

await db.close();

user.updateDependencies({db}); // From this point on all the user Dapi fns will receive the new db client on their first argument
user.updateDependencies({db}); // From this point on the user Dapi fns will receive the new db client on their first argument
});

if(config.profile.customer) {
customer.decorate('createCustomer', (createCustomer, deps, ...args) => {
return profile(deps.logger, createCustomer(deps, ...args));
customer.decorate('create', (create, deps, ...args) => {
return profile(deps.logger, create(deps, ...args));
});
}

// you could also add hooks to the DapiFns
customer.addHook('preCreateCustomer', (createCustomer, deps, ...args) => {
customer.addPreHook('create', (create, deps, ...args) => {
deps.logger.info(`Create customer start` data);
});

customer.addHook('preCreateCustomer', (createCustomer, deps, ...args) => {
customer.addPostHook('create', (createCustomer, deps, ...args) => {
deps.logger.info(`Create customer end` data);
});

Expand Down Expand Up @@ -266,7 +266,7 @@ Represents an [`DapiWrapper`](#dapiwrapper) definition with dependencies and fns
- `type` - The type of the `DapiWrapper`.
- `name` - The name of the `DapiWrapper`.

### DapiMixin
### `DapiMixin`

[Mixin](https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/) fn that creates a [`DapiWrapper`]() class that extends the passed SuperClass class and wraps the passed DapiFns dictionary.

Expand Down
Loading

0 comments on commit f3dd9c0

Please sign in to comment.