-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tools): adds add/remove commands for tools
This adds support for more tools: - EditorConfig - Prettier - ls-lint - GitHub - Stale - Dependabot - Semantic Pull Requests - Workflows - NodeJs - App - Lib Now uses the cli-helpers-engine cache to download the workflows directly from dhis2/workflows.
- Loading branch information
Showing
9 changed files
with
234 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const log = require('@dhis2/cli-helpers-engine').reporter | ||
const cfg = require('../../utils/config.js') | ||
|
||
exports.command = 'editorconfig [type]' | ||
|
||
exports.desc = 'Add the editorconfig configuration to the project.' | ||
|
||
exports.builder = yargs => | ||
yargs | ||
.positional('type', { | ||
describe: 'Template to use for EditorConfig', | ||
type: 'string', | ||
default: 'base', | ||
}) | ||
.option('overwrite', { | ||
describe: 'Overwrite the existing configuration.', | ||
type: 'boolean', | ||
}) | ||
.example( | ||
'$0 add editorconfig', | ||
'Adds the standard configuration to .editorconfig' | ||
) | ||
|
||
exports.handler = argv => { | ||
const { add, type, overwrite } = argv | ||
|
||
log.info(`editorconfig > ${add ? 'add' : 'remove'}`) | ||
|
||
if (add) { | ||
cfg.add({ | ||
tool: 'editorconfig', | ||
type: type ? type : 'base', | ||
overwrite, | ||
}) | ||
} else { | ||
cfg.remove({ tool: 'editorconfig', type: type ? type : 'base' }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const log = require('@dhis2/cli-helpers-engine').reporter | ||
const cfg = require('../../utils/config.js') | ||
|
||
exports.command = 'github <type>' | ||
|
||
exports.desc = 'Add configuration files for GitHub' | ||
|
||
exports.builder = yargs => | ||
yargs | ||
.positional('type', { | ||
describe: 'Template to use for GitHub configuration', | ||
type: 'string', | ||
choices: Object.keys(cfg.templateConfigs.github), | ||
}) | ||
.option('overwrite', { | ||
describe: 'Overwrite the existing configuration.', | ||
type: 'boolean', | ||
}) | ||
.example( | ||
'$0 add github workflow-node', | ||
'Adds the GitHub Workflow template for NodeJS projects' | ||
) | ||
.example( | ||
'$0 add github dependabot', | ||
'Adds the configuration file for Dependabot with DHIS2 defaults' | ||
) | ||
|
||
exports.handler = argv => { | ||
const { add, type, overwrite, getCache } = argv | ||
|
||
log.info(`github > ${add ? 'add' : 'remove'}`) | ||
|
||
if (add) { | ||
cfg.add({ | ||
tool: 'github', | ||
type, | ||
cache: getCache(), | ||
overwrite, | ||
}) | ||
} else { | ||
cfg.remove({ tool: 'github', type }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const log = require('@dhis2/cli-helpers-engine').reporter | ||
const cfg = require('../../utils/config.js') | ||
|
||
exports.command = 'prettier [type]' | ||
|
||
exports.desc = 'Add the Prettier configuration to the project.' | ||
|
||
exports.builder = yargs => | ||
yargs | ||
.positional('type', { | ||
describe: 'Configuration template to use for Prettier', | ||
type: 'string', | ||
default: 'base', | ||
}) | ||
.option('overwrite', { | ||
describe: 'Overwrite the existing configuration.', | ||
type: 'boolean', | ||
}) | ||
.example( | ||
'$0 add prettier', | ||
'Adds the standard configuration to .prettierrc.js' | ||
) | ||
|
||
exports.handler = argv => { | ||
const { add, type, overwrite } = argv | ||
|
||
log.info(`prettier > ${add ? 'add' : 'remove'}`) | ||
|
||
if (add) { | ||
cfg.add({ | ||
tool: 'prettier', | ||
type: type ? type : 'base', | ||
overwrite, | ||
}) | ||
} else { | ||
cfg.remove({ tool: 'prettier', type: type ? type : 'base' }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.