Skip to content

Commit

Permalink
feat: add new config provenance-file
Browse files Browse the repository at this point in the history
Exclusive with `provenance`
  • Loading branch information
wraithgar committed May 23, 2023
1 parent 5ab5f04 commit 1c343e7
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 2 deletions.
11 changes: 11 additions & 0 deletions docs/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ const getCommandByDoc = (docFile, docExt) => {
const srcName = name === 'npx' ? 'exec' : name
const { params, usage = [''], workspaces } = require(`../../lib/commands/${srcName}`)
const usagePrefix = name === 'npx' ? 'npx' : `npm ${name}`
if (params) {
for (const param of params) {
if (definitions[param].exclusive) {
for (const e of definitions[param].exclusive) {
if (!params.includes(e)) {
params.splice(params.indexOf(param) + 1, 0, e)
}
}
}
}
}

return {
name,
Expand Down
3 changes: 3 additions & 0 deletions lib/utils/config/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const allowed = [
'defaultDescription',
'deprecated',
'description',
'exclusive',
'flatten',
'hint',
'key',
Expand Down Expand Up @@ -83,12 +84,14 @@ class Definition {
This value is not exported to the environment for child processes.
`
const deprecated = !this.deprecated ? '' : `* DEPRECATED: ${unindent(this.deprecated)}\n`
const exclusive = !this.exclusive ? '' : `\nThis config is can not be used with: \`${this.exclusive.join('`, `')}\``
return wrapAll(`#### \`${this.key}\`
* Default: ${unindent(this.defaultDescription)}
* Type: ${unindent(this.typeDescription)}
${deprecated}
${description}
${exclusive}
${noEnvExport}`)
}
}
Expand Down
12 changes: 12 additions & 0 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1635,13 +1635,25 @@ define('progress', {
define('provenance', {
default: false,
type: Boolean,
exclusive: ['provenance-file'],
description: `
When publishing from a supported cloud CI/CD system, the package will be
publicly linked to where it was built and published from.
`,
flatten,
})

define('provenance-file', {
default: null,
type: path,
hint: '<file>',
exclusive: ['provenance'],
description: `
When publishing, the provenance bundle at the given path will be used.
`,
flatten,
})

define('proxy', {
default: null,
type: [null, false, url], // allow proxy to be disabled explicitly
Expand Down
2 changes: 2 additions & 0 deletions tap-snapshots/test/lib/commands/config.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"production": null,
"progress": true,
"provenance": false,
"provenance-file": null,
"proxy": null,
"read-only": false,
"rebuild-bundle": true,
Expand Down Expand Up @@ -274,6 +275,7 @@ preid = ""
production = null
progress = true
provenance = false
provenance-file = null
proxy = null
read-only = false
rebuild-bundle = true
Expand Down
Loading

0 comments on commit 1c343e7

Please sign in to comment.