wads.npm_config¶
Read NPM CI configuration from a package.json wads.ci block.
This is the NPM-side analog of wads.ci_config.CIConfig (which reads
[tool.wads.ci] from pyproject.toml). npm ignores unknown top-level keys,
so wads namespaces its config under a top-level "wads" key:
{
"name": "@scope/my-widget",
"wads": {
"ci": {
"subdir": "js",
"nodeVersions": ["20", "22", "24"],
"publish": {"enabled": false, "marker": "[publish-npm]"}
}
}
}
The reusable workflow (i2mint/wads/.github/workflows/npm-ci.yml) parses the
same block in CI via node; this class is the parsing/validation surface used
from Python (tests, populate validation, inspection tooling).
Module Attributes
Defaults applied when a field is absent from |
|
Package managers the reusable npm CI workflow knows how to drive. |
|
Defaults for the nested |
|
|
|
Defaults for the nested |
Classes
|
Typed accessors over a |
- wads.npm_config.NPM_CI_DEFAULTS = {'buildCommand': 'npm run build --if-present', 'lintCommand': 'npm run lint --if-present', 'nodeVersions': ['20', '22', '24'], 'packageManager': 'npm', 'publishNode': '24', 'subdir': 'js', 'testCommand': 'npm test --if-present'}¶
Defaults applied when a field is absent from
wads.ci.packageManageris"npm"here for the typed Python accessor, but in CI an absent field triggers auto-detection (apnpm-lock.yamlin the package dir selects pnpm); an explicit value always wins. So existing npm consumers — no field, nopnpm-lock.yaml— keep byte-identical behavior.
- wads.npm_config.NPM_PUBLISH_DEFAULTS = {'access': 'public', 'enabled': False, 'marker': '[publish-npm]', 'provenance': True, 'registry': 'https://registry.npmjs.org', 'trustedPublishing': True}¶
Defaults for the nested
wads.ci.publishblock.
- wads.npm_config.NPM_TRIGGER_DEFAULTS = {'mode': 'auto', 'runCiMarker': '[run ci]'}¶
Defaults for the nested
wads.ci.triggerblock. Same values as the Python side (wads.ci_config.DFLT_TRIGGER_MODE/DFLT_RUN_CI_MARKER) so a repo with both a pyproject.toml and a package.json can use one marker convention.
- class wads.npm_config.NpmCIConfig(package_json_data)[source]¶
Bases:
objectTyped accessors over a
package.jsonwads.ciconfiguration block.- classmethod from_file(package_json_path)[source]¶
Build from a
package.jsonfile path (file or its directory).- Return type:
- property package_manager: str¶
The package manager driving install/build (
"npm"or"pnpm").Returns the explicit
wads.ci.packageManagerif set, else the default ("npm"). Note the CI workflow additionally auto-detects pnpm from apnpm-lock.yamlwhen the field is absent — this accessor reports only the declared value.
- property run_ci_marker: str¶
Commit-subject substring that runs CI in
"on-demand"mode.Defaults to
"[run ci]"(same default as the Python side). Must be a non-empty single line: an empty marker would match every subject and silently turn on-demand back into auto.
- property trigger_mode: str¶
"auto"(default) or"on-demand"."on-demand"means nothing runs unless the commit subject line containsrun_ci_marker, or the run is a manualworkflow_dispatch. RaisesValueErroron any other value.>>> NpmCIConfig({}).trigger_mode 'auto' >>> NpmCIConfig({"wads": {"ci": {"trigger": {"mode": "on-demand"}}}}).trigger_mode 'on-demand'
- Type:
When CI runs
- wads.npm_config.SUPPORTED_PACKAGE_MANAGERS = ('npm', 'pnpm')¶
Package managers the reusable npm CI workflow knows how to drive.
- wads.npm_config.TRIGGER_MODES = ('auto', 'on-demand')¶
wads.ci.trigger.modevalues the reusable workflow understands. Mirrorswads.ci_config.TRIGGER_MODES(the Python/pyproject.toml side).