Skip to content

Commit 8955995

Browse files
authored
Merge pull request #2 from getshifter/chore/release-tools
Chore/release tools
2 parents 75ed10f + 546b8ef commit 8955995

File tree

9 files changed

+4479
-117
lines changed

9 files changed

+4479
-117
lines changed

.github/workflows/main.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- '!master'
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Begin CI...
12+
uses: actions/checkout@v2
13+
14+
- name: Use Node 12
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: 12.x
18+
19+
- name: Use cached node_modules
20+
uses: actions/cache@v1
21+
with:
22+
path: node_modules
23+
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
24+
restore-keys: |
25+
nodeModules-
26+
- name: Install dependencies
27+
run: yarn install --frozen-lockfile
28+
env:
29+
CI: true
30+
31+
- name: Lint
32+
run: yarn lint
33+
env:
34+
CI: true
35+
36+
- name: Test
37+
run: yarn test --ci --coverage --maxWorkers=2
38+
env:
39+
CI: true

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Release package"
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
release_package:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
13+
- name: "yarn install"
14+
run: yarn install --frozen-lockfile
15+
16+
- name: "npm run semantic-release"
17+
run: npm run semantic-release
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional']
3+
}

package.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@
1919
"tslib": "^1"
2020
},
2121
"devDependencies": {
22+
"@commitlint/cli": "^9.1.1",
23+
"@commitlint/config-conventional": "^9.1.1",
2224
"@oclif/dev-cli": "^1",
2325
"@types/node": "^10",
2426
"eslint": "^5.13",
2527
"eslint-config-oclif": "^3.1",
2628
"eslint-config-oclif-typescript": "^0.1",
2729
"globby": "^10",
30+
"husky": "^4.2.5",
31+
"lint-staged": "^10.2.11",
32+
"semantic-release": "^17.1.1",
2833
"ts-node": "^8",
2934
"typescript": "^3.3"
3035
},
@@ -50,6 +55,17 @@
5055
"@oclif/plugin-help"
5156
]
5257
},
58+
"lint-staged": {
59+
"*.ts": [
60+
"eslint --fix"
61+
]
62+
},
63+
"husky": {
64+
"hooks": {
65+
"pre-commit": "lint-staged",
66+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
67+
}
68+
},
5369
"publishConfig": {
5470
"access": "public"
5571
},
@@ -60,7 +76,8 @@
6076
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
6177
"test": "echo NO TESTS",
6278
"lint": "eslint src/**/*.ts",
63-
"version": "oclif-dev readme && git add README.md"
79+
"version": "oclif-dev readme && git add README.md",
80+
"semantic-release": "semantic-release"
6481
},
6582
"types": "lib/index.d.ts"
6683
}

src/commands/add.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { flags} from '@oclif/command'
1+
import {flags} from '@oclif/command'
22
import cli from 'cli-ux'
3-
import { AbstractCommand } from '../share/abstract.command'
4-
import { APIClientService } from '../share/api/api.service'
3+
import {AbstractCommand} from '../share/abstract.command'
4+
import {APIClientService} from '../share/api/api.service'
55

66
export default class Add extends AbstractCommand {
77
static description = 'Domain registration command'
@@ -33,7 +33,7 @@ export default class Add extends AbstractCommand {
3333
}),
3434
domain: flags.string({
3535
char: 'D',
36-
description: 'target domain name (eg. example.com)'
36+
description: 'target domain name (eg. example.com)',
3737
}),
3838
'site-id': flags.string({
3939
char: 'S',

src/commands/get-verification-code.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { flags} from '@oclif/command'
1+
import {flags} from '@oclif/command'
22
import cli from 'cli-ux'
3-
import { AbstractCommand } from '../share/abstract.command'
4-
import { APIClientService } from '../share/api/api.service'
3+
import {AbstractCommand} from '../share/abstract.command'
4+
import {APIClientService} from '../share/api/api.service'
55

66
export default class Add extends AbstractCommand {
77
static description = 'Domain verification code command'
@@ -33,7 +33,7 @@ export default class Add extends AbstractCommand {
3333
}),
3434
domain: flags.string({
3535
char: 'D',
36-
description: 'target domain name (eg. example.com)'
36+
description: 'target domain name (eg. example.com)',
3737
}),
3838
'site-id': flags.string({
3939
char: 'S',
@@ -52,7 +52,7 @@ export default class Add extends AbstractCommand {
5252
const domain = flags.domain || await cli.prompt('Target domain')
5353
const domainObj = await clientWithAuth.get(`/latest/sites/${siteId}/domains/${domain}`)
5454
if (!domainObj) throw new Error(`No such domain ${domain}`)
55-
55+
5656
const validationDetail = await clientWithAuth.get(`/latest/sites/${siteId}/domains/${domain}/validation`)
5757
this.log(JSON.stringify(validationDetail, null, 2))
5858
} catch (error) {

src/commands/get.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {flags} from '@oclif/command'
22
import cli from 'cli-ux'
3-
import { AbstractCommand } from '../share/abstract.command'
4-
import { APIClientService } from '../share/api/api.service'
3+
import {AbstractCommand} from '../share/abstract.command'
4+
import {APIClientService} from '../share/api/api.service'
55

66
export default class Get extends AbstractCommand {
77
static description = 'Domain get command'
@@ -33,7 +33,7 @@ export default class Get extends AbstractCommand {
3333
}),
3434
domain: flags.string({
3535
char: 'D',
36-
description: 'target domain name (eg. example.com)'
36+
description: 'target domain name (eg. example.com)',
3737
}),
3838
'site-id': flags.string({
3939
char: 'S',

src/commands/list.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {flags} from '@oclif/command'
22
import cli from 'cli-ux'
3-
import { AbstractCommand } from '../share/abstract.command'
4-
import { APIClientService } from '../share/api/api.service'
3+
import {AbstractCommand} from '../share/abstract.command'
4+
import {APIClientService} from '../share/api/api.service'
55

66
export default class List extends AbstractCommand {
77
static description = 'Domain lists command'
@@ -10,6 +10,7 @@ export default class List extends AbstractCommand {
1010
'Simply usage',
1111
'$ shifter-domain list --username USERNAME --password PASSWORD --site-id xxx-YOUR-SITE-ID-xxxx ',
1212
]
13+
1314
static flags = {
1415
version: flags.version({char: 'v'}),
1516
help: flags.help({char: 'h'}),
@@ -44,8 +45,8 @@ export default class List extends AbstractCommand {
4445
const domains = await clientWithAuth.get(`/latest/sites/${siteId}/domains`)
4546
this.log(JSON.stringify(domains.map((domainDetail: {
4647
attached_project?: {
47-
notification_emails?: object
48-
}
48+
notification_emails?: object;
49+
};
4950
}) => {
5051
if (domainDetail && domainDetail.attached_project) {
5152
delete domainDetail.attached_project.notification_emails

0 commit comments

Comments
 (0)