Skip to content

Commit a91b61d

Browse files
committed
make circleci support
1 parent 074c892 commit a91b61d

5 files changed

Lines changed: 47 additions & 10 deletions

File tree

agents.const.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
GITLAB_CI: 'gitlab_ci',
3+
AZURE_PIPELINES: 'azure_pipelines',
4+
CIRCLE_CI: 'circle_ci',
5+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2.1
2+
jobs:
3+
build:
4+
docker:
5+
- image: node
6+
steps:
7+
- checkout
8+
- run:
9+
name: Install
10+
command: |
11+
yarn
12+
- run:
13+
name: Lint
14+
command: |
15+
yarn lint
16+
- run:
17+
name: Test
18+
command: |
19+
yarn test:unit
20+
- run:
21+
name: Build
22+
command: |
23+
yarn build
24+
- store_artifacts:
25+
path: dist/

generator/index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
const AGENTS = require('../agents.const');
2+
13
module.exports = (api, options, rootOptions) => {
2-
if (options.agent === 'gitlab') {
4+
if (options.agent === AGENTS.GITLAB_CI) {
35
api.render('./gitlab_template')
46
}
57

6-
if (options.agent === 'azure') {
7-
api.render('./azure_template', {
8-
appName: rootOptions.projectName.replace(' ', '')
9-
})
8+
if (options.agent === AGENTS.AZURE_PIPELINES) {
9+
api.render('./azure_template')
10+
}
11+
12+
if (options.agent === AGENTS.CIRCLE_CI) {
13+
api.render('./circle_template')
1014
}
11-
}
15+
};

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = (api) => {}
1+
module.exports = (api) => {};

prompts.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
const AGENTS = require('./agents.const');
2+
13
module.exports = [
24
{
35
type: 'list',
46
name: 'agent',
57
message: 'Which agent for your CI?',
68
choices: [
7-
{ name: 'GitLab', value: 'gitlab' },
8-
{ name: 'Azure DevOps', value: 'azure'}
9+
{ name: 'GitLab', value: AGENTS.GITLAB_CI },
10+
{ name: 'Azure DevOps', value: AGENTS.AZURE_PIPELINES},
11+
{ name: 'CircleCI', value: AGENTS.CIRCLE_CI}
912
],
1013
},
11-
]
14+
];

0 commit comments

Comments
 (0)