Skip to content

Commit 8e3513b

Browse files
authored
feat: add ci-cd integration and semantic release (#1)
* ✏️ docs: add commands and installation * 🚧 chore: add custom cz config * 🚧 chore: add husky * 🚧 chore: add build commit type * 🏗️ build: add semantic release dependencies packages * 🚧 chore: update husky hooks * 🧱 build: add commitlint-config-gitmoji * 🔧 ci: add ci pipeline * 💄 style: remove unused code * 📦 refactor: change version to custom command * 🧪 test(version): fix broken test * 📦 refactor: output version * 🐛 fix: read of package.json * 🚧 chore: update branch name from master to main
1 parent 5610901 commit 8e3513b

18 files changed

+19253
-7676
lines changed

.github/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: pipeline
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-node@v1
17+
with:
18+
node-version: '12.x'
19+
- name: Install 🔧
20+
run: npm ci
21+
22+
- name: Build 🏗️
23+
run: npm run build
24+
25+
- name: Release 🚀
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29+
run: npm run semantic-release

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit $1
5+

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run test

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"trailingComma": "none",
3-
"endOfLine": "auto"
3+
"endOfLine": "auto",
4+
"singleQuote": true
45
}

__tests__/cli-integration.test.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
import { filesystem, system } from 'gluegun';
22
import { PackageJSON } from 'gluegun/build/types/toolbox/meta-types';
33

4-
const src = filesystem.path(__dirname, '..')
4+
const src = filesystem.path(__dirname, '..');
55

66
const cli = async (cmd) =>
7-
system.run('node ' + filesystem.path(src, 'bin', 'ngx-devs-cli') + ` ${cmd}`)
7+
system.run('node ' + filesystem.path(src, 'bin', 'ngx-devs-cli') + ` ${cmd}`);
88

99
describe('[Commands: version]', () => {
1010
test('should output package.json version', async () => {
11-
const packageJson: PackageJSON = filesystem.read(
12-
`${src}/package.json`,
13-
'json'
14-
)
15-
16-
const expectedVersion = packageJson.version
17-
const output = await cli('--version')
18-
19-
expect(output).toContain(expectedVersion)
20-
})
21-
})
11+
const packageJson: PackageJSON = require('../package.json');
12+
const version = packageJson?.version;
13+
const output = await cli('-v');
14+
expect(output).toContain(version);
15+
});
16+
});

changelog.config.js

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
module.exports = {
2+
disableEmoji: false,
3+
format: '{emoji} {type}{scope}: {subject}',
4+
list: [
5+
'build',
6+
'test',
7+
'feat',
8+
'fix',
9+
'chore',
10+
'docs',
11+
'refactor',
12+
'style',
13+
'ci',
14+
'perf'
15+
],
16+
maxMessageLength: 64,
17+
minMessageLength: 3,
18+
questions: [
19+
'type',
20+
'scope',
21+
'subject',
22+
'body',
23+
'breaking',
24+
'issues',
25+
'lerna'
26+
],
27+
scopes: [],
28+
types: {
29+
chore: {
30+
description:
31+
'Updating grunt tasks etc; no production code change "grunt task" means nothing that an external user would see.',
32+
emoji: '🚧',
33+
value: 'chore'
34+
},
35+
build: {
36+
description:
37+
'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
38+
emoji: '🏗️',
39+
value: 'build'
40+
},
41+
ci: {
42+
description:
43+
'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
44+
emoji: '🔧',
45+
value: 'ci'
46+
},
47+
docs: {
48+
description: 'Documentation only changes',
49+
emoji: '✏️',
50+
value: 'docs'
51+
},
52+
feat: {
53+
description: 'A new feature',
54+
emoji: '✨',
55+
value: 'feat'
56+
},
57+
fix: {
58+
description: 'A bug fix',
59+
emoji: '🐛',
60+
value: 'fix'
61+
},
62+
perf: {
63+
description: 'A code change that improves performance',
64+
emoji: '🚀',
65+
value: 'perf'
66+
},
67+
refactor: {
68+
description: 'A code change that neither fixes a bug or adds a feature',
69+
emoji: '📦',
70+
value: 'refactor'
71+
},
72+
release: {
73+
description: 'Create a release commit',
74+
emoji: '🏹',
75+
value: 'release'
76+
},
77+
style: {
78+
description:
79+
'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
80+
emoji: '💄',
81+
value: 'style'
82+
},
83+
test: {
84+
description: 'Adding missing tests or correcting existing tests',
85+
emoji: '🧪',
86+
value: 'test'
87+
}
88+
}
89+
};

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['gitmoji'] };

delpe/delpe.page.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

delpe/delpe.page.scss

Whitespace-only changes.

delpe/delpe.page.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)