8000 feat: make circleci optional by CallumDenby · Pull Request #137 · oclif/oclif · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: make circleci optional #137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/generators/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class App extends Generator {
options: {
defaults?: boolean
mocha: boolean
circleci: boolean
'semantic-release': boolean
typescript: boolean
tslint: boolean
Expand All @@ -63,13 +64,15 @@ class App extends Generator {
license: string
options: {
mocha: boolean
circleci: boolean
typescript: boolean
tslint: boolean
yarn: boolean
'semantic-release': boolean
}
}
mocha!: boolean
circleci!: boolean
semantic_release!: boolean
ts!: boolean
tslint!: boolean
Expand All @@ -90,6 +93,7 @@ class App extends Generator {
this.options = {
defaults: opts.defaults,
mocha: opts.options.includes('mocha'),
circleci: opts.options.includes('circleci'),
'semantic-release': opts.options.includes('semantic-release'),
typescript: opts.options.includes('typescript'),
tslint: opts.options.includes('tslint'),
Expand Down Expand Up @@ -222,6 +226,7 @@ class App extends Generator {
choices: [
{name: 'yarn (npm alternative)', value: 'yarn', checked: this.options.yarn || hasYarn},
{name: 'mocha (testing framework)', value: 'mocha', checked: true},
{name: 'circleci (continuous integration/delivery service)', value: 'circleci', checked: true},
{name: 'typescript (static typing for javascript)', value: 'typescript', checked: true},
{name: 'tslint (static analysis tool for typescript)', value: 'tslint', checked: true},
{name: 'semantic-release (automated version management)', value: 'semantic-release', checked: this.options['semantic-release']}
Expand All @@ -243,6 +248,7 @@ class App extends Generator {
this.tslint = this.options.tslint
this.yarn = this.options.yarn
this.mocha = this.options.mocha
this.circleci = this.options.circleci
this.semantic_release = this.options['semantic-release']

this.pjson.name = this.answers.name || defaults.name
Expand Down Expand Up @@ -353,13 +359,15 @@ class App extends Generator {
this.pjson.files = _.uniq((this.pjson.files || []).sort())
this.fs.writeJSON(this.destinationPath('./package.json'), sortPjson(this.pjson))
this.fs.copyTpl(this.templatePath('editorconfig'), this.destinationPath('.editorconfig'), this)
this.fs.copyTpl(this.templatePath('scripts/greenkeeper'), this.destinationPath('.circleci/greenkeeper'), this)
// if (this.semantic_release) {
// this.fs.copyTpl(this.templatePath('scripts/release'), this.destinationPath('.circleci/release'), this)
// }
// this.fs.copyTpl(this.templatePath('scripts/setup_git'), this.destinationPath('.circleci/setup_git'), this)
if (this.circleci) {
this.fs.copyTpl(this.templatePath('scripts/greenkeeper'), this.destinationPath('.circleci/greenkeeper'), this)
// if (this.semantic_release) {
// this.fs.copyTpl(this.templatePath('scripts/release'), this.destinationPath('.circleci/release'), this)
// }
// this.fs.copyTpl(this.templatePath('scripts/setup_git'), this.destinationPath('.circleci/setup_git'), this)
this.fs.copyTpl(this.templatePath('circle.yml.ejs'), this.destinationPath('.circleci/config.yml'), this)
}
this.fs.copyTpl(this.templatePath('README.md.ejs'), this.destinationPath('README.md'), this)
this.fs.copyTpl(this.templatePath(&# A486 39;circle.yml.ejs'), this.destinationPath('.circleci/config.yml'), this)
this.fs.copyTpl(this.templatePath('appveyor.yml.ejs'), this.destinationPath('appveyor.yml'), this)
if (this.pjson.license === 'MIT' && (this.pjson.repository.startsWith('oclif') || this.pjson.repository.startsWith('heroku'))) {
this.fs.copyTpl(this.templatePath('LICENSE.mit'), this.destinationPath('LICENSE'), this)
Expand Down
2 changes: 2 additions & 0 deletions templates/README.md.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/<%= pjson.name %>.svg)](https://npmjs.org/package/<%= pjson.name %>)
<% if(circleci) { %>
[![CircleCI](https://circleci.com/gh/<%= repository %>/tree/master.svg?style=shield)](https://circleci.com/gh/<%= repository %>/tree/master)
<% } %>
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/<%= repository %>?branch=master&svg=true)](https://ci.appveyor.com/project/<%= repository %>/branch/master)
[![Codecov](https://codecov.io/gh/<%= repository %>/branch/master/graph/badge.svg)](https://codecov.io/gh/<%= repository %>)
[![Downloads/week](https://img.shields.io/npm/dw/<%= pjson.name %>.svg)](https://npmjs.org/package/<%= pjson.name %>)
Expand Down
0