commitlint-config-spellbookx 0.7.3 → 0.8.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.
@@ -1,7 +1,7 @@
1
1
 
2
- > commitlint-config-spellbookx@0.7.3 build /home/runner/work/spellbookx/spellbookx/packages/commitlint-config-spellbookx
2
+ > commitlint-config-spellbookx@0.8.1 build /home/runner/work/spellbookx/spellbookx/packages/commitlint-config-spellbookx
3
3
  > rolldown -c && tsc
4
4
 
5
- [log] <DIR>/index.js chunk │ size: 272.41 kB
5
+ [log] <DIR>/index.js chunk │ size: 272.66 kB
6
6
  [log]
7
- [success] rolldown v1.0.0-rc.1 Finished in 33.15 ms
7
+ [success] rolldown v1.0.0-rc.1 Finished in 59.35 ms
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW,EAAoD;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,QAAQ,GAAE,MAAqB,GAC9B,MAAM,EAAE,CA0BV;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,MAAM,EAAE,CA+CpC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW,EAAoD;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,QAAQ,GAAE,MAAqB,GAC9B,MAAM,EAAE,CA0BV;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,MAAM,EAAE,CA6DpC"}
package/dist/index.js CHANGED
@@ -7697,18 +7697,22 @@ function getScopes() {
7697
7697
  rawWorkspaces.push(...getWorkspacesRawPath(pnpmWorkspaceYmlPath, "yaml", "packages"));
7698
7698
  const lernaJsonPath = path.join(cwd, "lerna.json");
7699
7699
  rawWorkspaces.push(...getWorkspacesRawPath(lernaJsonPath, "json", "packages"));
7700
- const workspaces = [];
7700
+ const workspaces = /* @__PURE__ */ new Set();
7701
+ if (existsSync(path.join(cwd, "package.json")) && !rawWorkspaces.includes(".")) rawWorkspaces.push(".");
7701
7702
  for (const pattern of rawWorkspaces) {
7702
7703
  const entries = import_out.default.sync(pattern, {
7703
7704
  onlyDirectories: true,
7704
7705
  absolute: true
7705
7706
  });
7706
7707
  for (const dirPath of entries) {
7707
- const dirName = dirPath.split(path.sep).at(-1);
7708
- if (typeof dirName === "string") workspaces.push(dirName);
7708
+ const packageJsonPath = path.join(dirPath, "package.json");
7709
+ if (existsSync(packageJsonPath)) try {
7710
+ const pkg = JSON.parse(readFileSync(packageJsonPath, "utf8"));
7711
+ if (pkg.name) workspaces.add(pkg.name);
7712
+ } catch {}
7709
7713
  }
7710
7714
  }
7711
- return workspaces;
7715
+ return [...workspaces];
7712
7716
  }
7713
7717
 
7714
7718
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commitlint-config-spellbookx",
3
- "version": "0.7.3",
3
+ "version": "0.8.1",
4
4
  "private": false,
5
5
  "description": "A shareable Commitlint configuration for enforcing conventional commits.",
6
6
  "keywords": [
@@ -45,11 +45,11 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@commitlint/types": "^20.3.1",
48
+ "@dcdavidev/tsconfig": "^0.1.0",
48
49
  "@types/js-yaml": "^4.0.9",
49
50
  "@types/node": "^25.0.10",
50
51
  "rolldown": "1.0.0-rc.1",
51
- "typescript": "5.9.2",
52
- "@spellbookx/typescript-config": "0.7.3"
52
+ "typescript": "5.9.2"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"
package/src/helpers.ts CHANGED
@@ -90,20 +90,34 @@ export function getScopes(): string[] {
90
90
  ...getWorkspacesRawPath(lernaJsonPath, 'json', 'packages')
91
91
  );
92
92
 
93
- const workspaces: string[] = [];
93
+ const workspaces = new Set<string>();
94
+
95
+ const rootPackageJsonPath = path.join(cwd, 'package.json');
96
+ if (existsSync(rootPackageJsonPath) && !rawWorkspaces.includes('.')) {
97
+ rawWorkspaces.push('.');
98
+ }
94
99
 
95
100
  for (const pattern of rawWorkspaces) {
96
101
  const entries = fg.sync(pattern, { onlyDirectories: true, absolute: true });
97
102
 
98
103
  for (const dirPath of entries) {
99
- const dirArray = dirPath.split(path.sep);
100
- const dirName = dirArray.at(-1);
101
-
102
- if (typeof dirName === 'string') {
103
- workspaces.push(dirName);
104
+ const packageJsonPath = path.join(dirPath, 'package.json');
105
+
106
+ if (existsSync(packageJsonPath)) {
107
+ try {
108
+ const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {
109
+ name?: string;
110
+ };
111
+
112
+ if (pkg.name) {
113
+ workspaces.add(pkg.name);
114
+ }
115
+ } catch {
116
+ // ignore invalid package.json files
117
+ }
104
118
  }
105
119
  }
106
120
  }
107
121
 
108
- return workspaces;
122
+ return [...workspaces];
109
123
  }
package/tsconfig.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
- "extends": "@spellbookx/typescript-config/base.json",
2
+ "extends": "@dcdavidev/tsconfig/base.json",
3
3
  "compilerOptions": {
4
4
  "outDir": "./dist",
5
5
  "rootDir": "./src",
6
- "tsBuildInfoFile": "./dist/.tsbuildinfo"
6
+ "tsBuildInfoFile": "./dist/.tsbuildinfo",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "emitDeclarationOnly": true
7
10
  },
8
11
  "include": ["src/**/*"],
9
12
  "exclude": ["node_modules", "**/*.test.ts"]