@projitect/blueprint-husky-lint-staged 0.0.0-stage → 1.0.1

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 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-husky-lint-staged",
3
+ "version": "1.0.1",
4
+ "description": "Husky and lint-staged blueprint for projitect — owns .husky/pre-commit and the package.json lint-staged field, prepare script and husky and lint-staged devDependencies.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/projitect/projitect.git",
8
+ "directory": "packages/blueprint-husky-lint-staged"
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 { huskyLintStaged } from \"@projitect/blueprint-husky-lint-staged\"",
46
+ "call": "huskyLintStaged()"
47
+ }
48
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @projitect/blueprint-husky-lint-staged
3
+ *
4
+ * One composite blueprint that wires commit-time linting and formatting into a project:
5
+ *
6
+ * 1. Owns `.husky/pre-commit` with a single `lint-staged` line. Owned mode — projitect rewrites
7
+ * this file on every `remodel`. Husky 9 runs hooks through `sh`, so the file needs no
8
+ * executable bit (the SDK cannot set one) and no `husky.sh` bootstrap.
9
+ * 2. Merges the `lint-staged` field, `scripts.prepare` (`husky`) and the `husky` / `lint-staged`
10
+ * devDependencies into `package.json`. Merge mode — non-conflicting with whatever else lives
11
+ * in the file.
12
+ */
13
+ import type { Blueprint } from "@projitect/core";
14
+ /** A lint-staged config: globs mapped to the command (or commands) run on matching staged files. */
15
+ export type LintStagedConfig = Readonly<Record<string, string | readonly string[]>>;
16
+ /**
17
+ * Options for the husky + lint-staged blueprint. All optional.
18
+ */
19
+ export interface HuskyLintStagedOptions {
20
+ /**
21
+ * The `lint-staged` config. When given it replaces the default entirely (no merge): globs mapped
22
+ * to the command or commands run on matching staged files. Defaults to `eslint --fix` for
23
+ * JS/TS files and `prettier --write` for JSON, Markdown, YAML and CSS.
24
+ */
25
+ readonly config?: LintStagedConfig;
26
+ }
27
+ /**
28
+ * Build the composite husky + lint-staged blueprint. The returned `Blueprint` emits two operations
29
+ * (merge `package.json`, own `.husky/pre-commit`), both attributed to `pjt:husky-lint-staged`.
30
+ */
31
+ export declare const huskyLintStaged: (options?: HuskyLintStagedOptions) => Blueprint.Blueprint;
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAWhD,oGAAoG;AACpG,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC,CAAA;AAOnF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,UAAS,sBAA2B,KAAG,SAAS,CAAC,SA8ChF,CAAA"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @projitect/blueprint-husky-lint-staged
3
+ *
4
+ * One composite blueprint that wires commit-time linting and formatting into a project:
5
+ *
6
+ * 1. Owns `.husky/pre-commit` with a single `lint-staged` line. Owned mode — projitect rewrites
7
+ * this file on every `remodel`. Husky 9 runs hooks through `sh`, so the file needs no
8
+ * executable bit (the SDK cannot set one) and no `husky.sh` bootstrap.
9
+ * 2. Merges the `lint-staged` field, `scripts.prepare` (`husky`) and the `husky` / `lint-staged`
10
+ * devDependencies into `package.json`. Merge mode — non-conflicting with whatever else lives
11
+ * in the file.
12
+ */
13
+ import { Effect } from "effect";
14
+ import { jsonMerge, ownFile } from "@projitect/blueprint";
15
+ import { ChangeSet as CS } from "@projitect/core";
16
+ import manifest from "../package.json" with { type: "json" };
17
+ // Read the version from the package manifest (emitted next to `dist/src`) so a release bump
18
+ // reaches `.pjt.lock` without a hand-edited constant. JSON import keeps this runtime-pure.
19
+ const PACKAGE_VERSION = manifest.version;
20
+ const HUSKY_DEP_RANGE = "^9.0.0";
21
+ const LINT_STAGED_DEP_RANGE = "^16.0.0";
22
+ const DEFAULT_CONFIG = {
23
+ "*.{js,jsx,ts,tsx,mjs,cjs}": "eslint --fix",
24
+ "*.{json,md,mdx,yml,yaml,css}": "prettier --write",
25
+ };
26
+ /**
27
+ * Build the composite husky + lint-staged blueprint. The returned `Blueprint` emits two operations
28
+ * (merge `package.json`, own `.husky/pre-commit`), both attributed to `pjt:husky-lint-staged`.
29
+ */
30
+ export const huskyLintStaged = (options = {}) => {
31
+ const id = "pjt:husky-lint-staged";
32
+ const packageJsonMerge = jsonMerge({
33
+ id,
34
+ version: PACKAGE_VERSION,
35
+ description: "lint-staged config, prepare script and husky / lint-staged devDependencies",
36
+ path: "package.json",
37
+ ownedKeys: [
38
+ "lint-staged",
39
+ "scripts.prepare",
40
+ "devDependencies.husky",
41
+ "devDependencies.lint-staged",
42
+ ],
43
+ value: {
44
+ "lint-staged": options.config ?? DEFAULT_CONFIG,
45
+ scripts: { prepare: "husky" },
46
+ devDependencies: {
47
+ husky: HUSKY_DEP_RANGE,
48
+ "lint-staged": LINT_STAGED_DEP_RANGE,
49
+ },
50
+ },
51
+ });
52
+ const hook = ownFile({
53
+ id,
54
+ version: PACKAGE_VERSION,
55
+ description: "husky pre-commit hook",
56
+ path: ".husky/pre-commit",
57
+ content: "lint-staged\n",
58
+ });
59
+ return {
60
+ id,
61
+ version: PACKAGE_VERSION,
62
+ description: "husky + lint-staged commit-time checks (hook + config + scripts + devDeps)",
63
+ permissions: [
64
+ { kind: "read", glob: "package.json" },
65
+ { kind: "write", glob: "package.json" },
66
+ { kind: "write", glob: ".husky/pre-commit" },
67
+ ],
68
+ plan: Effect.gen(function* () {
69
+ const changeSets = yield* Effect.forEach([packageJsonMerge, hook], (b) => b.plan);
70
+ return CS.Reducer.combineAll(changeSets);
71
+ }),
72
+ };
73
+ };
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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,eAAe,GAAG,QAAQ,CAAA;AAChC,MAAM,qBAAqB,GAAG,SAAS,CAAA;AAKvC,MAAM,cAAc,GAAqB;IACvC,2BAA2B,EAAE,cAAc;IAC3C,8BAA8B,EAAE,kBAAkB;CACnD,CAAA;AAcD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAAkC,EAAE,EAAuB,EAAE;IAC3F,MAAM,EAAE,GAAG,uBAAuB,CAAA;IAElC,MAAM,gBAAgB,GAAG,SAAS,CAAC;QACjC,EAAE;QACF,OAAO,EAAE,eAAe;QACxB,WAAW,EAAE,4EAA4E;QACzF,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE;YACT,aAAa;YACb,iBAAiB;YACjB,uBAAuB;YACvB,6BAA6B;SAC9B;QACD,KAAK,EAAE;YACL,aAAa,EAAE,OAAO,CAAC,MAAM,IAAI,cAAc;YAC/C,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;YAC7B,eAAe,EAAE;gBACf,KAAK,EAAE,eAAe;gBACtB,aAAa,EAAE,qBAAqB;aACrC;SACF;KACF,CAAC,CAAA;IAEF,MAAM,IAAI,GAAG,OAAO,CAAC;QACnB,EAAE;QACF,OAAO,EAAE,eAAe;QACxB,WAAW,EAAE,uBAAuB;QACpC,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,eAAe;KACzB,CAAC,CAAA;IAEF,OAAO;QACL,EAAE;QACF,OAAO,EAAE,eAAe;QACxB,WAAW,EAAE,4EAA4E;QACzF,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,mBAAmB,EAAE;SAC7C;QACD,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;YACjF,OAAO,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;QAC1C,CAAC,CAAC;KACH,CAAA;AACH,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,48 @@
1
1
  {
2
2
  "name": "@projitect/blueprint-husky-lint-staged",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.1",
4
+ "description": "Husky and lint-staged blueprint for projitect — owns .husky/pre-commit and the package.json lint-staged field, prepare script and husky and lint-staged devDependencies.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/projitect/projitect.git",
8
+ "directory": "packages/blueprint-husky-lint-staged"
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.1",
27
+ "@projitect/core": "1.0.1",
28
+ "@projitect/test-kit": "1.0.1"
29
+ },
30
+ "peerDependencies": {
31
+ "effect": "4.0.0-rc.111",
32
+ "@projitect/blueprint": "1.0.1",
33
+ "@projitect/core": "1.0.1"
34
+ },
35
+ "engines": {
36
+ "node": ">=22.12.0"
37
+ },
38
+ "projitect": {
39
+ "type": "blueprint",
40
+ "import": "import { huskyLintStaged } from \"@projitect/blueprint-husky-lint-staged\"",
41
+ "call": "huskyLintStaged()"
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,97 @@
1
+ /**
2
+ * @projitect/blueprint-husky-lint-staged
3
+ *
4
+ * One composite blueprint that wires commit-time linting and formatting into a project:
5
+ *
6
+ * 1. Owns `.husky/pre-commit` with a single `lint-staged` line. Owned mode — projitect rewrites
7
+ * this file on every `remodel`. Husky 9 runs hooks through `sh`, so the file needs no
8
+ * executable bit (the SDK cannot set one) and no `husky.sh` bootstrap.
9
+ * 2. Merges the `lint-staged` field, `scripts.prepare` (`husky`) and the `husky` / `lint-staged`
10
+ * devDependencies into `package.json`. Merge mode — non-conflicting with whatever else lives
11
+ * in the file.
12
+ */
13
+
14
+ import { Effect } from "effect"
15
+ import { jsonMerge, ownFile } from "@projitect/blueprint"
16
+ import type { Blueprint } from "@projitect/core"
17
+ import { ChangeSet as CS } from "@projitect/core"
18
+ import manifest from "../package.json" with { type: "json" }
19
+
20
+ // Read the version from the package manifest (emitted next to `dist/src`) so a release bump
21
+ // reaches `.pjt.lock` without a hand-edited constant. JSON import keeps this runtime-pure.
22
+ const PACKAGE_VERSION = manifest.version
23
+
24
+ const HUSKY_DEP_RANGE = "^9.0.0"
25
+ const LINT_STAGED_DEP_RANGE = "^16.0.0"
26
+
27
+ /** A lint-staged config: globs mapped to the command (or commands) run on matching staged files. */
28
+ export type LintStagedConfig = Readonly<Record<string, string | readonly string[]>>
29
+
30
+ const DEFAULT_CONFIG: LintStagedConfig = {
31
+ "*.{js,jsx,ts,tsx,mjs,cjs}": "eslint --fix",
32
+ "*.{json,md,mdx,yml,yaml,css}": "prettier --write",
33
+ }
34
+
35
+ /**
36
+ * Options for the husky + lint-staged blueprint. All optional.
37
+ */
38
+ export interface HuskyLintStagedOptions {
39
+ /**
40
+ * The `lint-staged` config. When given it replaces the default entirely (no merge): globs mapped
41
+ * to the command or commands run on matching staged files. Defaults to `eslint --fix` for
42
+ * JS/TS files and `prettier --write` for JSON, Markdown, YAML and CSS.
43
+ */
44
+ readonly config?: LintStagedConfig
45
+ }
46
+
47
+ /**
48
+ * Build the composite husky + lint-staged blueprint. The returned `Blueprint` emits two operations
49
+ * (merge `package.json`, own `.husky/pre-commit`), both attributed to `pjt:husky-lint-staged`.
50
+ */
51
+ export const huskyLintStaged = (options: HuskyLintStagedOptions = {}): Blueprint.Blueprint => {
52
+ const id = "pjt:husky-lint-staged"
53
+
54
+ const packageJsonMerge = jsonMerge({
55
+ id,
56
+ version: PACKAGE_VERSION,
57
+ description: "lint-staged config, prepare script and husky / lint-staged devDependencies",
58
+ path: "package.json",
59
+ ownedKeys: [
60
+ "lint-staged",
61
+ "scripts.prepare",
62
+ "devDependencies.husky",
63
+ "devDependencies.lint-staged",
64
+ ],
65
+ value: {
66
+ "lint-staged": options.config ?? DEFAULT_CONFIG,
67
+ scripts: { prepare: "husky" },
68
+ devDependencies: {
69
+ husky: HUSKY_DEP_RANGE,
70
+ "lint-staged": LINT_STAGED_DEP_RANGE,
71
+ },
72
+ },
73
+ })
74
+
75
+ const hook = ownFile({
76
+ id,
77
+ version: PACKAGE_VERSION,
78
+ description: "husky pre-commit hook",
79
+ path: ".husky/pre-commit",
80
+ content: "lint-staged\n",
81
+ })
82
+
83
+ return {
84
+ id,
85
+ version: PACKAGE_VERSION,
86
+ description: "husky + lint-staged commit-time checks (hook + config + scripts + devDeps)",
87
+ permissions: [
88
+ { kind: "read", glob: "package.json" },
89
+ { kind: "write", glob: "package.json" },
90
+ { kind: "write", glob: ".husky/pre-commit" },
91
+ ],
92
+ plan: Effect.gen(function* () {
93
+ const changeSets = yield* Effect.forEach([packageJsonMerge, hook], (b) => b.plan)
94
+ return CS.Reducer.combineAll(changeSets)
95
+ }),
96
+ }
97
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.