Skip to content

Commit

Permalink
Update config's JSON schema (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Jun 17, 2020
1 parent e5b547f commit 377f5c3
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-papayas-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/config": patch
---

Removed experimental flags from `defaultWrittenConfig`. They were added there by mistake.
5 changes: 5 additions & 0 deletions .changeset/great-trains-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/cli": patch
---

Fixed an issue with experimental flags being written to disk as part of the default config when initializing Changesets.
5 changes: 5 additions & 0 deletions .changeset/nine-hairs-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/config": minor
---

Added `updateInternalDependencies` and `ignore` options to the JSON schema.
20 changes: 17 additions & 3 deletions packages/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,33 @@
},
"commit": {
"type": "boolean",
"description": "Determines whether Changesets should commit the results of the add and version command",
"description": "Determines whether Changesets should commit the results of the add and version command.",
"default": false
},
"access": {
"enum": ["restricted", "public"],
"type": "string",
"description": "Determines whether Changesets should publish packages to the registry publicly or to a restricted scope",
"description": "Determines whether Changesets should publish packages to the registry publicly or to a restricted scope.",
"default": "restricted"
},
"baseBranch": {
"type": "string",
"default": "master",
"description": "Determines the branch that Changesets uses when finding what packages have changed"
"description": "Determines the branch that Changesets uses when finding what packages have changed."
},
"ignore": {
"type": "array",
"items": {
"type": "string"
},
"description": "Packages that should not be released.",
"default": []
},
"updateInternalDependencies": {
"enum": ["patch", "minor"],
"type": "string",
"description": "The minimum bump type to trigger automatic update of internal dependencies that are part of the same release.",
"default": "patch"
}
}
}
14 changes: 3 additions & 11 deletions packages/config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ export let defaultWrittenConfig = {
access: "restricted",
baseBranch: "master",
updateInternalDependencies: "patch",
ignore: [] as ReadonlyArray<string>,
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: {
onlyUpdatePeerDependentsWhenOutOfRange: false,
useCalculatedVersionForSnapshots: false
}
ignore: [] as ReadonlyArray<string>
} as const;

function getNormalisedChangelogOption(
Expand Down Expand Up @@ -267,19 +263,15 @@ export let parse = (json: WrittenConfig, packages: Packages): Config => {
json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined ||
json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH
.onlyUpdatePeerDependentsWhenOutOfRange === undefined
? defaultWrittenConfig
.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH
.onlyUpdatePeerDependentsWhenOutOfRange
? false
: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH
.onlyUpdatePeerDependentsWhenOutOfRange,

useCalculatedVersionForSnapshots:
json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined ||
json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH
.useCalculatedVersionForSnapshots === undefined
? defaultWrittenConfig
.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH
.useCalculatedVersionForSnapshots
? false
: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH
.useCalculatedVersionForSnapshots
}
Expand Down

0 comments on commit 377f5c3

Please sign in to comment.