Skip to content

config file support in ecp, local & validate modes#25

Open
dor-itzhaki wants to merge 1 commit intomasterfrom
config-file
Open

config file support in ecp, local & validate modes#25
dor-itzhaki wants to merge 1 commit intomasterfrom
config-file

Conversation

@dor-itzhaki
Copy link
Copy Markdown
Contributor

No description provided.

.describe('fs', 'one or more folders containing the source files to extract docs from')
.alias('fx', 'excludes')
.describe('fx', 'one or more folders to exclude (including their children) from extracting docs')
.default('fp', '.+\\.js?$')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you remove this default on purpose?

.describe('fx', 'one or more folders to exclude (including their children) from extracting docs')
.default('fp', '.+\\.js?$')
.alias('fp', 'pattern')
.describe('fp', 'file pattern, defaults to ".+\\.js$"')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you did remove it on purpose (see previous comment) then you also need to modify the text here

const argv = commandConfig.parse(cliArgs)

const config = argv.config
? Object.assign(require(argv.config), argv)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config file is assumed to be what? a path to a JS that exports an object?
Should be documented better in the command description, and probably also elsewhere

let argv = optimist
.usage('Usage: $0 ecp -r [remote repo] [-b [remote branch]] -s [local sources] -p [file pattern] [-ed [enrichment docs directory]] [--plug [plugin]] [--dryrun]')
.demand('r')
const commandConfig = optimist
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to https://github.com/substack/node-optimist optimist is deprecated, it might be worth replacing it already (it won't be a lot of work). Acceptable to do separately IMO.

: argv

if (!config.remote || !config.sources || !config.project) {
commandConfig.showHelp()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my understanding, this will make the command description pop up, which is why it should be more descriptive

projectSubdir: config.project,
jsDocSources: {
include: config.sources,
includePattern: config.pattern || '.+\\.js?$',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now understand why you removed the default from the fp argument, but I still think it's pretty confusing in the command description. Leaving the comments in place as it made me confused, but I can see why you'd want to keep it as is - think about it.

@@ -0,0 +1,251 @@
const chai = require('chai')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should open a tech-debt task to move docworks to jest. Could be a candidate first-task for a newcomer

return tempFilePath
}

describe.only('config file unit tests', function () {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only should probably be removed, I assume you used it for debugging.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another tech-debt task is to make sure eslint catches this..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants