@projitect/blueprint-changesets 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/package.json +48 -0
- package/dist/src/index.d.ts +44 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +77 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +45 -3
- package/src/index.ts +121 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kapil Easwar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@projitect/blueprint-changesets",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Changesets release-tooling blueprint for projitect — owns .changeset/config.json and the package.json scripts and @changesets/cli devDependency.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/projitect/projitect.git",
|
|
8
|
+
"directory": "packages/blueprint-changesets"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/src/index.d.ts",
|
|
15
|
+
"import": "./dist/src/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src",
|
|
21
|
+
"!**/*.tsbuildinfo"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc --build",
|
|
25
|
+
"build:clean": "tsc --build --clean",
|
|
26
|
+
"tc": "tsc --build"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@projitect/blueprint": "workspace:*",
|
|
30
|
+
"@projitect/core": "workspace:*",
|
|
31
|
+
"@projitect/test-kit": "workspace:*",
|
|
32
|
+
"effect": "4.0.0-rc.111",
|
|
33
|
+
"typescript": "5.9.3"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@projitect/blueprint": "workspace:*",
|
|
37
|
+
"@projitect/core": "workspace:*",
|
|
38
|
+
"effect": "4.0.0-rc.111"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=22.12.0"
|
|
42
|
+
},
|
|
43
|
+
"projitect": {
|
|
44
|
+
"type": "blueprint",
|
|
45
|
+
"import": "import { changesets } from \"@projitect/blueprint-changesets\"",
|
|
46
|
+
"call": "changesets()"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @projitect/blueprint-changesets
|
|
3
|
+
*
|
|
4
|
+
* One composite blueprint that wires Changesets release tooling into a project:
|
|
5
|
+
*
|
|
6
|
+
* 1. Owns `.changeset/config.json` with the defaults `changeset init` writes. Owned mode —
|
|
7
|
+
* projitect rewrites this file on every `remodel`, so teams adjust it through options rather
|
|
8
|
+
* than by hand.
|
|
9
|
+
* 2. Merges the `changeset` / `version-packages` scripts and the `@changesets/cli` devDependency
|
|
10
|
+
* into `package.json`. Merge mode — non-conflicting with whatever else lives in the file.
|
|
11
|
+
*/
|
|
12
|
+
import type { Blueprint } from "@projitect/core";
|
|
13
|
+
/**
|
|
14
|
+
* A changelog generator: a package name, a `[name, options]` tuple, or `false` to disable
|
|
15
|
+
* changelog generation.
|
|
16
|
+
*/
|
|
17
|
+
export type ChangesetsChangelog = string | readonly [string, Readonly<Record<string, unknown>>] | false;
|
|
18
|
+
/**
|
|
19
|
+
* Options for the changesets blueprint. All optional; anything not given keeps the default
|
|
20
|
+
* `changeset init` would write.
|
|
21
|
+
*/
|
|
22
|
+
export interface ChangesetsOptions {
|
|
23
|
+
/** Branch changesets compares against. Defaults to `"main"`. */
|
|
24
|
+
readonly baseBranch?: string;
|
|
25
|
+
/** Publish access for packages. Defaults to `"restricted"`. */
|
|
26
|
+
readonly access?: "public" | "restricted";
|
|
27
|
+
/** Groups of packages that always version together. Defaults to none. */
|
|
28
|
+
readonly fixed?: readonly (readonly string[])[];
|
|
29
|
+
/** Groups of packages that share a version when released together. Defaults to none. */
|
|
30
|
+
readonly linked?: readonly (readonly string[])[];
|
|
31
|
+
/** Packages changesets ignores. Defaults to none. */
|
|
32
|
+
readonly ignore?: readonly string[];
|
|
33
|
+
/**
|
|
34
|
+
* Changelog generator. Defaults to the built-in `"@changesets/cli/changelog"`. Any other
|
|
35
|
+
* generator (e.g. `@changesets/changelog-github`) must be installed by the project itself.
|
|
36
|
+
*/
|
|
37
|
+
readonly changelog?: ChangesetsChangelog;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Build the composite changesets blueprint. The returned `Blueprint` emits two operations (merge
|
|
41
|
+
* `package.json`, own `.changeset/config.json`), both attributed to `pjt:changesets`.
|
|
42
|
+
*/
|
|
43
|
+
export declare const changesets: (options?: ChangesetsOptions) => Blueprint.Blueprint;
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAWhD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GACpD,KAAK,CAAA;AAET;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAA;IACzC,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAA;IAC/C,wFAAwF;IACxF,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAA;IAChD,qDAAqD;IACrD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAA;CACzC;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,UAAS,iBAAsB,KAAG,SAAS,CAAC,SA0CtE,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @projitect/blueprint-changesets
|
|
3
|
+
*
|
|
4
|
+
* One composite blueprint that wires Changesets release tooling into a project:
|
|
5
|
+
*
|
|
6
|
+
* 1. Owns `.changeset/config.json` with the defaults `changeset init` writes. Owned mode —
|
|
7
|
+
* projitect rewrites this file on every `remodel`, so teams adjust it through options rather
|
|
8
|
+
* than by hand.
|
|
9
|
+
* 2. Merges the `changeset` / `version-packages` scripts and the `@changesets/cli` devDependency
|
|
10
|
+
* into `package.json`. Merge mode — non-conflicting with whatever else lives in the file.
|
|
11
|
+
*/
|
|
12
|
+
import { Effect } from "effect";
|
|
13
|
+
import { jsonMerge, ownFile } from "@projitect/blueprint";
|
|
14
|
+
import { ChangeSet as CS } from "@projitect/core";
|
|
15
|
+
import manifest from "../package.json" with { type: "json" };
|
|
16
|
+
// Read the version from the package manifest (emitted next to `dist/src`) so a release bump
|
|
17
|
+
// reaches `.pjt.lock` without a hand-edited constant. JSON import keeps this runtime-pure.
|
|
18
|
+
const PACKAGE_VERSION = manifest.version;
|
|
19
|
+
const CHANGESETS_CLI_DEP_RANGE = "^2.0.0";
|
|
20
|
+
const CONFIG_SCHEMA_URL = "https://unpkg.com/@changesets/config@3.1.1/schema.json";
|
|
21
|
+
/**
|
|
22
|
+
* Build the composite changesets blueprint. The returned `Blueprint` emits two operations (merge
|
|
23
|
+
* `package.json`, own `.changeset/config.json`), both attributed to `pjt:changesets`.
|
|
24
|
+
*/
|
|
25
|
+
export const changesets = (options = {}) => {
|
|
26
|
+
const id = "pjt:changesets";
|
|
27
|
+
const packageJsonMerge = jsonMerge({
|
|
28
|
+
id,
|
|
29
|
+
version: PACKAGE_VERSION,
|
|
30
|
+
description: "changesets scripts and @changesets/cli devDependency",
|
|
31
|
+
path: "package.json",
|
|
32
|
+
ownedKeys: ["scripts.changeset", "scripts.version-packages", "devDependencies.@changesets/cli"],
|
|
33
|
+
value: {
|
|
34
|
+
scripts: {
|
|
35
|
+
changeset: "changeset",
|
|
36
|
+
"version-packages": "changeset version",
|
|
37
|
+
},
|
|
38
|
+
devDependencies: {
|
|
39
|
+
"@changesets/cli": CHANGESETS_CLI_DEP_RANGE,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
const config = ownFile({
|
|
44
|
+
id,
|
|
45
|
+
version: PACKAGE_VERSION,
|
|
46
|
+
description: "changesets configuration",
|
|
47
|
+
path: ".changeset/config.json",
|
|
48
|
+
content: renderConfig(options),
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
id,
|
|
52
|
+
version: PACKAGE_VERSION,
|
|
53
|
+
description: "changesets release tooling (config + scripts + devDep)",
|
|
54
|
+
permissions: [
|
|
55
|
+
{ kind: "read", glob: "package.json" },
|
|
56
|
+
{ kind: "write", glob: "package.json" },
|
|
57
|
+
{ kind: "write", glob: ".changeset/config.json" },
|
|
58
|
+
],
|
|
59
|
+
plan: Effect.gen(function* () {
|
|
60
|
+
const changeSets = yield* Effect.forEach([packageJsonMerge, config], (b) => b.plan);
|
|
61
|
+
return CS.Reducer.combineAll(changeSets);
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
// Key order mirrors what `changeset init` writes, so the output is deterministic.
|
|
66
|
+
const renderConfig = (options) => `${JSON.stringify({
|
|
67
|
+
$schema: CONFIG_SCHEMA_URL,
|
|
68
|
+
changelog: options.changelog ?? "@changesets/cli/changelog",
|
|
69
|
+
commit: false,
|
|
70
|
+
fixed: options.fixed ?? [],
|
|
71
|
+
linked: options.linked ?? [],
|
|
72
|
+
access: options.access ?? "restricted",
|
|
73
|
+
baseBranch: options.baseBranch ?? "main",
|
|
74
|
+
updateInternalDependencies: "patch",
|
|
75
|
+
ignore: options.ignore ?? [],
|
|
76
|
+
}, null, 2)}\n`;
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,EAAE,SAAS,IAAI,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,QAAQ,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAE5D,4FAA4F;AAC5F,2FAA2F;AAC3F,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAA;AAExC,MAAM,wBAAwB,GAAG,QAAQ,CAAA;AACzC,MAAM,iBAAiB,GAAG,wDAAwD,CAAA;AAiClF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAA6B,EAAE,EAAuB,EAAE;IACjF,MAAM,EAAE,GAAG,gBAAgB,CAAA;IAE3B,MAAM,gBAAgB,GAAG,SAAS,CAAC;QACjC,EAAE;QACF,OAAO,EAAE,eAAe;QACxB,WAAW,EAAE,sDAAsD;QACnE,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,CAAC,mBAAmB,EAAE,0BAA0B,EAAE,iCAAiC,CAAC;QAC/F,KAAK,EAAE;YACL,OAAO,EAAE;gBACP,SAAS,EAAE,WAAW;gBACtB,kBAAkB,EAAE,mBAAmB;aACxC;YACD,eAAe,EAAE;gBACf,iBAAiB,EAAE,wBAAwB;aAC5C;SACF;KACF,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,OAAO,CAAC;QACrB,EAAE;QACF,OAAO,EAAE,eAAe;QACxB,WAAW,EAAE,0BAA0B;QACvC,IAAI,EAAE,wBAAwB;QAC9B,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC;KAC/B,CAAC,CAAA;IAEF,OAAO;QACL,EAAE;QACF,OAAO,EAAE,eAAe;QACxB,WAAW,EAAE,wDAAwD;QACrE,WAAW,EAAE;YACX,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE;YACtC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE;YACvC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE;SAClD;QACD,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;YACnF,OAAO,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;QAC1C,CAAC,CAAC;KACH,CAAA;AACH,CAAC,CAAA;AAED,kFAAkF;AAClF,MAAM,YAAY,GAAG,CAAC,OAA0B,EAAU,EAAE,CAC1D,GAAG,IAAI,CAAC,SAAS,CACf;IACE,OAAO,EAAE,iBAAiB;IAC1B,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,2BAA2B;IAC3D,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;IAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;IAC5B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,YAAY;IACtC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,MAAM;IACxC,0BAA0B,EAAE,OAAO;IACnC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;CAC7B,EACD,IAAI,EACJ,CAAC,CACF,IAAI,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projitect/blueprint-changesets",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Changesets release-tooling blueprint for projitect — owns .changeset/config.json and the package.json scripts and @changesets/cli devDependency.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/projitect/projitect.git",
|
|
8
|
+
"directory": "packages/blueprint-changesets"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/src/index.d.ts",
|
|
15
|
+
"import": "./dist/src/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src",
|
|
21
|
+
"!**/*.tsbuildinfo"
|
|
22
|
+
],
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"effect": "4.0.0-rc.111",
|
|
25
|
+
"typescript": "5.9.3",
|
|
26
|
+
"@projitect/blueprint": "1.0.0",
|
|
27
|
+
"@projitect/core": "1.0.0",
|
|
28
|
+
"@projitect/test-kit": "1.0.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"effect": "4.0.0-rc.111",
|
|
32
|
+
"@projitect/blueprint": "1.0.0",
|
|
33
|
+
"@projitect/core": "1.0.0"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=22.12.0"
|
|
37
|
+
},
|
|
38
|
+
"projitect": {
|
|
39
|
+
"type": "blueprint",
|
|
40
|
+
"import": "import { changesets } from \"@projitect/blueprint-changesets\"",
|
|
41
|
+
"call": "changesets()"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc --build",
|
|
45
|
+
"build:clean": "tsc --build --clean",
|
|
46
|
+
"tc": "tsc --build"
|
|
47
|
+
}
|
|
6
48
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @projitect/blueprint-changesets
|
|
3
|
+
*
|
|
4
|
+
* One composite blueprint that wires Changesets release tooling into a project:
|
|
5
|
+
*
|
|
6
|
+
* 1. Owns `.changeset/config.json` with the defaults `changeset init` writes. Owned mode —
|
|
7
|
+
* projitect rewrites this file on every `remodel`, so teams adjust it through options rather
|
|
8
|
+
* than by hand.
|
|
9
|
+
* 2. Merges the `changeset` / `version-packages` scripts and the `@changesets/cli` devDependency
|
|
10
|
+
* into `package.json`. Merge mode — non-conflicting with whatever else lives in the file.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { Effect } from "effect"
|
|
14
|
+
import { jsonMerge, ownFile } from "@projitect/blueprint"
|
|
15
|
+
import type { Blueprint } from "@projitect/core"
|
|
16
|
+
import { ChangeSet as CS } from "@projitect/core"
|
|
17
|
+
import manifest from "../package.json" with { type: "json" }
|
|
18
|
+
|
|
19
|
+
// Read the version from the package manifest (emitted next to `dist/src`) so a release bump
|
|
20
|
+
// reaches `.pjt.lock` without a hand-edited constant. JSON import keeps this runtime-pure.
|
|
21
|
+
const PACKAGE_VERSION = manifest.version
|
|
22
|
+
|
|
23
|
+
const CHANGESETS_CLI_DEP_RANGE = "^2.0.0"
|
|
24
|
+
const CONFIG_SCHEMA_URL = "https://unpkg.com/@changesets/config@3.1.1/schema.json"
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A changelog generator: a package name, a `[name, options]` tuple, or `false` to disable
|
|
28
|
+
* changelog generation.
|
|
29
|
+
*/
|
|
30
|
+
export type ChangesetsChangelog =
|
|
31
|
+
| string
|
|
32
|
+
| readonly [string, Readonly<Record<string, unknown>>]
|
|
33
|
+
| false
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Options for the changesets blueprint. All optional; anything not given keeps the default
|
|
37
|
+
* `changeset init` would write.
|
|
38
|
+
*/
|
|
39
|
+
export interface ChangesetsOptions {
|
|
40
|
+
/** Branch changesets compares against. Defaults to `"main"`. */
|
|
41
|
+
readonly baseBranch?: string
|
|
42
|
+
/** Publish access for packages. Defaults to `"restricted"`. */
|
|
43
|
+
readonly access?: "public" | "restricted"
|
|
44
|
+
/** Groups of packages that always version together. Defaults to none. */
|
|
45
|
+
readonly fixed?: readonly (readonly string[])[]
|
|
46
|
+
/** Groups of packages that share a version when released together. Defaults to none. */
|
|
47
|
+
readonly linked?: readonly (readonly string[])[]
|
|
48
|
+
/** Packages changesets ignores. Defaults to none. */
|
|
49
|
+
readonly ignore?: readonly string[]
|
|
50
|
+
/**
|
|
51
|
+
* Changelog generator. Defaults to the built-in `"@changesets/cli/changelog"`. Any other
|
|
52
|
+
* generator (e.g. `@changesets/changelog-github`) must be installed by the project itself.
|
|
53
|
+
*/
|
|
54
|
+
readonly changelog?: ChangesetsChangelog
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Build the composite changesets blueprint. The returned `Blueprint` emits two operations (merge
|
|
59
|
+
* `package.json`, own `.changeset/config.json`), both attributed to `pjt:changesets`.
|
|
60
|
+
*/
|
|
61
|
+
export const changesets = (options: ChangesetsOptions = {}): Blueprint.Blueprint => {
|
|
62
|
+
const id = "pjt:changesets"
|
|
63
|
+
|
|
64
|
+
const packageJsonMerge = jsonMerge({
|
|
65
|
+
id,
|
|
66
|
+
version: PACKAGE_VERSION,
|
|
67
|
+
description: "changesets scripts and @changesets/cli devDependency",
|
|
68
|
+
path: "package.json",
|
|
69
|
+
ownedKeys: ["scripts.changeset", "scripts.version-packages", "devDependencies.@changesets/cli"],
|
|
70
|
+
value: {
|
|
71
|
+
scripts: {
|
|
72
|
+
changeset: "changeset",
|
|
73
|
+
"version-packages": "changeset version",
|
|
74
|
+
},
|
|
75
|
+
devDependencies: {
|
|
76
|
+
"@changesets/cli": CHANGESETS_CLI_DEP_RANGE,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const config = ownFile({
|
|
82
|
+
id,
|
|
83
|
+
version: PACKAGE_VERSION,
|
|
84
|
+
description: "changesets configuration",
|
|
85
|
+
path: ".changeset/config.json",
|
|
86
|
+
content: renderConfig(options),
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
id,
|
|
91
|
+
version: PACKAGE_VERSION,
|
|
92
|
+
description: "changesets release tooling (config + scripts + devDep)",
|
|
93
|
+
permissions: [
|
|
94
|
+
{ kind: "read", glob: "package.json" },
|
|
95
|
+
{ kind: "write", glob: "package.json" },
|
|
96
|
+
{ kind: "write", glob: ".changeset/config.json" },
|
|
97
|
+
],
|
|
98
|
+
plan: Effect.gen(function* () {
|
|
99
|
+
const changeSets = yield* Effect.forEach([packageJsonMerge, config], (b) => b.plan)
|
|
100
|
+
return CS.Reducer.combineAll(changeSets)
|
|
101
|
+
}),
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Key order mirrors what `changeset init` writes, so the output is deterministic.
|
|
106
|
+
const renderConfig = (options: ChangesetsOptions): string =>
|
|
107
|
+
`${JSON.stringify(
|
|
108
|
+
{
|
|
109
|
+
$schema: CONFIG_SCHEMA_URL,
|
|
110
|
+
changelog: options.changelog ?? "@changesets/cli/changelog",
|
|
111
|
+
commit: false,
|
|
112
|
+
fixed: options.fixed ?? [],
|
|
113
|
+
linked: options.linked ?? [],
|
|
114
|
+
access: options.access ?? "restricted",
|
|
115
|
+
baseBranch: options.baseBranch ?? "main",
|
|
116
|
+
updateInternalDependencies: "patch",
|
|
117
|
+
ignore: options.ignore ?? [],
|
|
118
|
+
},
|
|
119
|
+
null,
|
|
120
|
+
2,
|
|
121
|
+
)}\n`
|
package/README.md
DELETED