Skip to content

Commit c53358f

Browse files
authored
Merge pull request #77 from devmehq/develop
develop
2 parents 8bebffa + 08e94e7 commit c53358f

File tree

11 files changed

+173
-21
lines changed

11 files changed

+173
-21
lines changed

.github/renovate.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"extends": [
33
"config:base"
44
],
5+
"branchPrefix": "renovate-",
6+
"baseBranches": [
7+
"develop"
8+
],
59
"assigneesFromCodeOwners": true,
610
"packageRules": [
711
{

.github/workflows/ci.yml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,60 @@
1-
name: ci
1+
name: CI
22
on:
3+
workflow_dispatch:
4+
workflow_call:
35
push:
46
paths:
57
- 'src/**'
6-
- 'test/**'
8+
- '__tests__/**'
79
- 'package.json'
810
- 'yarn.lock'
11+
- 'release.config.js'
12+
- '.github/workflows/ci.yml'
913
branches:
1014
- '*'
15+
- '**'
16+
- '!master'
1117

1218
env:
19+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1321
CI: true
1422

1523
jobs:
16-
build:
17-
runs-on: ubuntu-18.04
24+
CI:
25+
runs-on: ubuntu-latest
1826
timeout-minutes: 20
1927

28+
permissions:
29+
packages: write
30+
contents: write
31+
2032
steps:
33+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
2134
- uses: styfle/cancel-workflow-action@0.11.0
2235
with:
23-
workflow_id: build-docker.yml
36+
workflow_id: ci.yml
2437
access_token: ${{ github.token }}
2538

2639
- uses: actions/checkout@v3
2740
with:
2841
fetch-depth: 30
29-
persist-credentials: false
30-
31-
- uses: bahmutov/npm-install@v1
3242

33-
- name: Yarn install
34-
uses: bahmutov/npm-install@v1
43+
- uses: FranzDiebold/github-env-vars-action@v2
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v3
3546
with:
36-
install-command: yarn --frozen-lockfile --silent
47+
node-version: 19
48+
49+
- name: Yarn
50+
run: yarn install --frozen-lockfile
3751

3852
- name: Test
3953
run: |
4054
yarn test
55+
56+
- name: Release
57+
if: github.ref == 'refs/heads/develop'
58+
run: |
59+
npm i -g semantic-release @semantic-release/git @semantic-release/github conventional-changelog-conventionalcommits
60+
npx semantic-release --no-ci --debug

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
workflow_call:
5+
push:
6+
paths:
7+
- 'src/**'
8+
- 'yarn.lock'
9+
branches:
10+
- 'master'
11+
12+
env:
13+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
CI: true
16+
17+
jobs:
18+
Release:
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 20
21+
22+
permissions:
23+
packages: write
24+
contents: write
25+
26+
steps:
27+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
28+
- uses: styfle/cancel-workflow-action@0.11.0
29+
with:
30+
workflow_id: release.yml
31+
access_token: ${{ github.token }}
32+
33+
- uses: actions/checkout@v3
34+
with:
35+
fetch-depth: 30
36+
37+
- uses: FranzDiebold/github-env-vars-action@v2
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v3
40+
with:
41+
node-version: 19
42+
43+
- name: Yarn
44+
run: yarn install --frozen-lockfile
45+
46+
- name: Test
47+
run: |
48+
yarn test
49+
50+
- name: Release
51+
run: |
52+
npm i -g semantic-release @semantic-release/git @semantic-release/github conventional-changelog-conventionalcommits
53+
npx semantic-release --no-ci --debug

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/.bin/pretty-quick
2+
node_modules/.bin/lint-staged

.mocharc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323
recursive: false,
2424
reporter: 'spec',
2525
require: ['ts-node/register', 'should'],
26-
spec: ['./test/*-test.ts'],
26+
spec: ['./__tests__/*-test.ts'],
2727
timeout: '8s',
2828
'trace-warnings': true,
2929
};

test/currency-test.ts renamed to __tests__/currency-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ describe('currency', async function () {
1212
expect(data.from).to.be.eql('USD');
1313
expect(data.to).to.be.eql('EUR');
1414

15-
expect(data.convertedAmount).to.be.lessThan(9);
15+
expect(data.convertedAmount).to.be.greaterThanOrEqual(9);
1616
expect(data.convertedAmount).to.be.greaterThan(8);
1717

18-
expect(data.exchangeRate).to.be.lessThan(0.9);
18+
expect(data.exchangeRate).to.be.greaterThanOrEqual(0.9);
1919
expect(data.exchangeRate).to.be.greaterThan(0.8);
2020

2121
expect(data.originalAmount).to.be.eql(10);
2222

2323
expect(data.convertedText.startsWith('10 USD equal to')).to.be.eql(true);
24-
expect(data.rateTime.startsWith('2022-')).to.be.eql(true);
24+
expect(data.rateTime.startsWith('2023-')).to.be.eql(true);
2525

2626
// expect(result).to.be.eql({
2727
// convertedAmount: 8.819,
File renamed without changes.
File renamed without changes.

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,16 @@
3333
"typings": "./index.d.ts",
3434
"scripts": {
3535
"build": "rm -rf dist && tsc -p .",
36-
"lint": "eslint src test",
36+
"lint": "eslint src __tests__",
3737
"lint-fix": "yarn lint -- --fix",
3838
"prepare": "yarn husky install",
39-
"prettier": "prettier --write \"src/**/*.{ts,json}\" \"test/**/*.{ts,json}\"",
39+
"prettier": "prettier --write \"src/**/*.{ts,json}\" \"__tests__/**/*.{ts,json}\"",
4040
"test": "TS_NODE_TRANSPILE_ONLY=1 TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha",
4141
"test-ci": "TS_NODE_TRANSPILE_ONLY=1 TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha"
4242
},
4343
"lint-staged": {
4444
"src/**/*.{ts,json}": "prettier --write",
45-
"__tests__/**/*.{ts}": "prettier --write",
46-
"__api_flows__/**/*.ts": "prettier --write",
47-
"swagger/**/*.json": "prettier --write"
45+
"__tests__/**/*.{ts,json}": "prettier --write"
4846
},
4947
"dependencies": {
5048
"axios": "1.2.3"

release.config.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// https://semantic-release.gitbook.io/semantic-release/usage/configuration
2+
const pkg = require('./package.json');
3+
const branch = process.env.BRANCH || process.env.CI_REF_NAME || '';
4+
const branchSlug = branch.replace(/\//g, '-');
5+
const branchPrefix = branch.split('/')[0];
6+
7+
const isMaster = branch === 'master' || branch === 'main';
8+
// semantic-release configuration
9+
module.exports = {
10+
branches: [
11+
{
12+
name: 'master',
13+
prerelease: false,
14+
},
15+
{
16+
name: 'main',
17+
prerelease: false,
18+
},
19+
{
20+
name: 'next',
21+
prerelease: 'next',
22+
},
23+
{
24+
name: 'develop',
25+
prerelease: 'beta',
26+
},
27+
{ name: branchSlug, prerelease: 'alpha' },
28+
{ name: `${branchPrefix}/**`, prerelease: 'alpha' },
29+
],
30+
plugins: [
31+
[
32+
'@semantic-release/commit-analyzer',
33+
{
34+
preset: 'angular',
35+
releaseRules: [
36+
{ type: 'breaking', release: 'major' },
37+
{ type: 'feat', release: 'minor' },
38+
{ type: 'fix', release: 'patch' },
39+
{ type: 'revert', release: 'patch' },
40+
{ type: 'docs', release: 'patch' },
41+
{ type: 'refactor', release: 'patch' },
42+
{ type: 'style', release: 'patch' },
43+
{ type: 'test', release: 'patch' },
44+
{ type: 'chore', release: 'patch' },
45+
{ type: 'ci', release: 'patch' },
46+
{ type: 'perf', release: 'patch' },
47+
{ type: 'build', release: 'patch' },
48+
],
49+
},
50+
],
51+
['@semantic-release/release-notes-generator'],
52+
// https://github.com/semantic-release/npm
53+
['@semantic-release/npm'],
54+
// https://github.com/semantic-release/github
55+
[
56+
'@semantic-release/github',
57+
{
58+
successComment: false,
59+
failComment: false,
60+
},
61+
],
62+
// https://github.com/semantic-release/git
63+
isMaster && [
64+
'@semantic-release/git',
65+
{
66+
assets: ['package.json', 'package-lock.json', 'yarn.lock', 'npm-shrinkwrap.json', 'CHANGELOG.md'],
67+
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
68+
GIT_AUTHOR_NAME: pkg.author.name,
69+
GIT_AUTHOR_EMAIL: pkg.author.email,
70+
GIT_COMMITTER_NAME: pkg.author.name,
71+
GIT_COMMITTER_EMAIL: pkg.author.email,
72+
},
73+
],
74+
].filter(Boolean),
75+
};

0 commit comments

Comments
 (0)