@dcdavidev/shared-spells 0.0.0-stage → 0.3.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 Davide Di Criscito
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.
package/README.md CHANGED
@@ -1,3 +1,120 @@
1
- # Temporary Holding Version
1
+ # @dcdavidev/shared-spells
2
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.
3
+ Shared building blocks for the spellbook configurations: ignore glob patterns, import groups, Conventional Commit types and workspace package discovery.
4
+
5
+ The other spellbook packages use these spells, so ESLint, CSpell and Commitlint all ignore the same files and see the same workspace. You can use them in your own tool configurations too.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ pnpm add @dcdavidev/shared-spells
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Import from the package root, or from a subpath to load only one module:
16
+
17
+ ```ts
18
+ import { ignores, imports } from '@dcdavidev/shared-spells';
19
+ import { COMMIT_TYPES } from '@dcdavidev/shared-spells/commit-types';
20
+ ```
21
+
22
+ | Subpath | Contents |
23
+ | ----------------------------------- | ------------------------------------------------- |
24
+ | `/ignores` | Ignore glob patterns. |
25
+ | `/imports` | Import group patterns. |
26
+ | `/commit-types` | Conventional Commit types. |
27
+ | `/discover-workspace-scopes` | Workspace package discovery. |
28
+ | `/get-workspace-scopes-description` | Commit scope descriptions. |
29
+ | `/workspace-scopes` | Commit scopes computed for the current workspace. |
30
+
31
+ `commit-types` and `workspace-scopes` are not re-exported from the package root. Import them from their subpaths.
32
+
33
+ ## Ignores
34
+
35
+ Glob patterns for files that linters and formatters should skip, grouped by ecosystem:
36
+
37
+ | Key | Contents |
38
+ | ------------ | ------------------------------------------------------------ |
39
+ | `core` | Build junk, generated changelogs and temporary caches. |
40
+ | `node` | Node.js, JavaScript and TypeScript build outputs and caches. |
41
+ | `lockFiles` | npm, pnpm, Yarn and Bun lock files. |
42
+ | `rust` | Rust build outputs and `Cargo.lock`. |
43
+ | `go` | Go build outputs, vendor folders and dependency files. |
44
+ | `python` | Python caches, bytecode and virtual environments. |
45
+ | `aiAgents` | AI coding agent configurations and instruction files. |
46
+ | `toolchains` | IDE folders, toolchains and system dotfiles. |
47
+ | `windows` | Windows and WSL metadata files. |
48
+ | `misc` | Other project artifacts and template files. |
49
+ | `all` | Every pattern above. |
50
+
51
+ ```ts
52
+ import { defineConfig, globalIgnores } from 'eslint/config';
53
+ import { ignores } from '@dcdavidev/shared-spells';
54
+
55
+ export default defineConfig([globalIgnores([...ignores.all])]);
56
+ ```
57
+
58
+ Each group is also exported on its own (`core`, `node`, ...) and as an uppercase alias (`CORE_IGNORE_PATHS`, `ALL_IGNORE_PATHS`, ...). `ignorePaths` is a mutable `string[]` copy of `all`.
59
+
60
+ ## Imports
61
+
62
+ Package name and path patterns for sorting imports into groups, such as `builtinModules`, `uiFrameworks`, `testing`, `thirdParty`, `monorepo`, `styles` and `relative`. Use `separator` (also exported as `newline` and `nl`) to put a blank line between groups. `@dcdavidev/eslint-plugin` turns these groups into `eslint-plugin-simple-import-sort` rules.
63
+
64
+ ```ts
65
+ import { imports } from '@dcdavidev/shared-spells';
66
+
67
+ const groups = [imports.builtinModules, imports.thirdParty, imports.relative];
68
+ ```
69
+
70
+ ## Commit types
71
+
72
+ ```ts
73
+ import {
74
+ COMMIT_TYPES,
75
+ COMMIT_TYPE_DEFINITIONS,
76
+ } from '@dcdavidev/shared-spells/commit-types';
77
+
78
+ COMMIT_TYPES;
79
+ // => ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'ci', 'build', 'revert']
80
+ ```
81
+
82
+ `COMMIT_TYPE_DEFINITIONS` adds a title, a description and an emoji to each type, for commit prompts.
83
+
84
+ ## Workspace discovery
85
+
86
+ These functions ask the workspace package manager (pnpm, Yarn, npm or Bun) for the packages it contains. The package manager is detected from the `packageManager` field of `package.json` or from the lock files. Results are cached, and the functions return empty results instead of throwing.
87
+
88
+ ```ts
89
+ import {
90
+ discoverWorkspaceScopes,
91
+ getScopeDescription,
92
+ listWorkspacePackages,
93
+ } from '@dcdavidev/shared-spells';
94
+
95
+ listWorkspacePackages();
96
+ // => [{ name: '@acme/ui', dir: '/repo/packages/ui', isRoot: false }, ...]
97
+
98
+ discoverWorkspaceScopes();
99
+ // => ['@acme']
100
+
101
+ getScopeDescription('@acme/ui');
102
+ // => the `description` field of packages/ui/package.json
103
+ ```
104
+
105
+ All three accept an options object with `cwd` (where to start looking) and `packageManager` (to skip detection).
106
+
107
+ `detectPackageManager(cwd)` returns the detected package manager and the folder where it was found, for example `{ manager: 'pnpm', root: '/repo' }`, or `undefined` when none is found. It does not cache its result.
108
+
109
+ `getWorkspaceScopesDescription(scopes)` returns the descriptions of several scopes at once.
110
+
111
+ The `workspace-scopes` subpath computes the commit scopes when it is imported: `scopesArray` lists `release` and the workspace package names, and `scopesEnum` maps each scope to its description. `@dcdavidev/commitlint-config` uses them.
112
+
113
+ ## License
114
+
115
+ This project is open-source software licensed under the [MIT License](https://github.com/dcdavidev/spellbook/blob/main/LICENSE).
116
+
117
+ - **Author & Creator**: [Davide Di Criscito](https://github.com/dcdavidev)
118
+ - **Copyright**: © 2026 Davide Di Criscito and contributors.
119
+
120
+ For full license details and permissions, see the [LICENSE](https://github.com/dcdavidev/spellbook/blob/main/LICENSE) file.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @file Standard Conventional Commit types supported by `@dcdavidev/spellbook`.
3
+ */
4
+ /**
5
+ * List of allowed commit types based on the Conventional Commits specification.
6
+ */
7
+ export declare const COMMIT_TYPES: readonly ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'ci', 'build', 'revert'];
8
+ /**
9
+ * Valid Conventional Commit type string.
10
+ */
11
+ export type CommitType = (typeof COMMIT_TYPES)[number];
12
+ /**
13
+ * CamelCase alias for `COMMIT_TYPES`.
14
+ */
15
+ export declare const commitTypes: typeof COMMIT_TYPES;
16
+ /**
17
+ * Display metadata for a Conventional Commit type.
18
+ */
19
+ export interface CommitTypeDefinition {
20
+ /**
21
+ The commit type, e.g. `feat`.
22
+ */
23
+ type: CommitType;
24
+ /**
25
+ Changelog section title.
26
+ */
27
+ title: string;
28
+ /**
29
+ Emoji shown next to the type in interactive prompts.
30
+ */
31
+ emoji: string;
32
+ /**
33
+ One-line description shown in interactive prompts.
34
+ */
35
+ description: string;
36
+ }
37
+ /**
38
+ * Commit types with their prompt metadata, in the order shown to the user.
39
+ * Shared by `@dcdavidev/commitlint-config` and `@dcdavidev/cz-config`.
40
+ */
41
+ export declare const COMMIT_TYPE_DEFINITIONS: readonly CommitTypeDefinition[];
42
+ //# sourceMappingURL=commit-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-types.d.ts","sources":["../src/commit-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,YACvB,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,UAAU,EACV,MAAM,EACN,MAAM,EACN,OAAO,EACP,IAAI,EACJ,OAAO,EACP,QAAQ,CACA,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,OAAO,YAA2B,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;MAEE;IACF,IAAI,EAAE,UAAU,CAAC;IACjB;;MAEE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;MAEE;IACF,KAAK,EAAE,MAAM,CAAC;IACd;;MAEE;IACF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,oBAAoB,EA+DlE,CAAC"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * @file Standard Conventional Commit types supported by `@dcdavidev/spellbook`.
3
+ */
4
+ /**
5
+ * List of allowed commit types based on the Conventional Commits specification.
6
+ */
7
+ export const COMMIT_TYPES = [
8
+ 'feat',
9
+ 'fix',
10
+ 'docs',
11
+ 'style',
12
+ 'refactor',
13
+ 'perf',
14
+ 'test',
15
+ 'chore',
16
+ 'ci',
17
+ 'build',
18
+ 'revert',
19
+ ];
20
+ /**
21
+ * CamelCase alias for `COMMIT_TYPES`.
22
+ */
23
+ export const commitTypes = COMMIT_TYPES;
24
+ /**
25
+ * Commit types with their prompt metadata, in the order shown to the user.
26
+ * Shared by `@dcdavidev/commitlint-config` and `@dcdavidev/cz-config`.
27
+ */
28
+ export const COMMIT_TYPE_DEFINITIONS = [
29
+ {
30
+ type: 'feat',
31
+ title: 'Features',
32
+ emoji: '✨',
33
+ description: 'A new feature',
34
+ },
35
+ { type: 'fix', title: 'Bug Fixes', emoji: '🐛', description: 'A bug fix' },
36
+ {
37
+ type: 'docs',
38
+ title: 'Documentation',
39
+ emoji: '📖',
40
+ description: 'Documentation only changes',
41
+ },
42
+ {
43
+ type: 'style',
44
+ title: 'Styles',
45
+ emoji: '🎨',
46
+ description: 'Changes that do not affect the meaning of the code',
47
+ },
48
+ {
49
+ type: 'refactor',
50
+ title: 'Code Refactoring',
51
+ emoji: '🧹',
52
+ description: 'A code change that neither fixes a bug nor adds a feature',
53
+ },
54
+ {
55
+ type: 'perf',
56
+ title: 'Performance Improvements',
57
+ emoji: '🚀',
58
+ description: 'A code change that improves performance',
59
+ },
60
+ {
61
+ type: 'test',
62
+ title: 'Tests',
63
+ emoji: '🧪',
64
+ description: 'Adding missing tests or correcting existing tests',
65
+ },
66
+ {
67
+ type: 'build',
68
+ title: 'Builds',
69
+ emoji: '📦',
70
+ description: 'Changes that affect the build system or external dependencies',
71
+ },
72
+ {
73
+ type: 'ci',
74
+ title: 'Continuous Integrations',
75
+ emoji: '🤖',
76
+ description: 'Changes to our CI configuration files and scripts',
77
+ },
78
+ {
79
+ type: 'chore',
80
+ title: 'Chores',
81
+ emoji: '♻️',
82
+ description: "Other changes that don't modify src or test files",
83
+ },
84
+ {
85
+ type: 'revert',
86
+ title: 'Reverts',
87
+ emoji: '🔙',
88
+ description: 'Reverts a previous commit',
89
+ },
90
+ ];
91
+ //# sourceMappingURL=commit-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-types.js","sources":["../src/commit-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,UAAU;IACV,MAAM;IACN,MAAM;IACN,OAAO;IACP,IAAI;IACJ,OAAO;IACP,QAAQ;CACA,CAAC;AAOX;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAwB,YAAY,CAAC;AAwB7D;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB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
+ * @file Lists the packages of the current workspace and the npm scopes they
3
+ * use, by asking the workspace package manager (pnpm, Yarn, npm or Bun).
4
+ */
5
+ /**
6
+ * Package managers supported by {@link discoverWorkspaceScopes}.
7
+ */
8
+ export type WorkspacePackageManager = 'pnpm' | 'yarn' | 'npm' | 'bun';
9
+ /**
10
+ * Options accepted by {@link discoverWorkspaceScopes}.
11
+ */
12
+ export interface DiscoverWorkspaceScopesOptions {
13
+ /**
14
+ * Directory inside the workspace to start from. Defaults to `process.cwd()`.
15
+ */
16
+ readonly cwd?: string;
17
+ /**
18
+ * Package manager to use. Detected from `packageManager` or lock files
19
+ * when omitted.
20
+ */
21
+ readonly packageManager?: WorkspacePackageManager;
22
+ }
23
+ /**
24
+ * Package defined in the workspace.
25
+ */
26
+ export interface WorkspacePackage {
27
+ /**
28
+ * Package name, from its `package.json`.
29
+ */
30
+ readonly name: string;
31
+ /**
32
+ * Absolute path of the package directory.
33
+ */
34
+ readonly dir: string;
35
+ /**
36
+ * Whether this is the workspace root package.
37
+ */
38
+ readonly isRoot: boolean;
39
+ }
40
+ /**
41
+ * Detects the workspace package manager by walking up from `cwd`, looking at
42
+ * the `packageManager` field of each `package.json` and at known lock files.
43
+ *
44
+ * @param cwd - Directory to start from.
45
+ * @returns The detected package manager and the directory it was found in.
46
+ */
47
+ export declare function detectPackageManager(cwd: string): {
48
+ manager: WorkspacePackageManager;
49
+ root: string;
50
+ } | undefined;
51
+ /**
52
+ * Lists the packages defined in the current workspace, including the root
53
+ * package.
54
+ *
55
+ * The package manager is detected from the `packageManager` field or the lock
56
+ * files, unless given, and asked for the workspace packages:
57
+ * `pnpm ls -r --depth -1 --json`, `yarn workspaces list --json` (Yarn 2+),
58
+ * `yarn workspaces info` (Yarn 1) or `npm query .workspace`. For Bun the
59
+ * `workspaces` globs of the root `package.json` are read directly.
60
+ * Results are cached per working directory and package manager. If detection
61
+ * or the command fails, an empty list is returned instead of throwing.
62
+ *
63
+ * @param options - Working directory and optional package manager.
64
+ * @returns The workspace packages, with their names, absolute directories and
65
+ * whether each one is the workspace root.
66
+ * @example
67
+ * ```ts
68
+ * const packages = listWorkspacePackages();
69
+ * // => [{ name: '@dcdavidev/eslint-plugin', dir: '/repo/packages/eslint-plugin', isRoot: false }, ...]
70
+ * ```
71
+ */
72
+ export declare function listWorkspacePackages(options?: DiscoverWorkspaceScopesOptions): readonly WorkspacePackage[];
73
+ /**
74
+ * Returns the npm scopes (such as `@dcdavidev`) of the packages defined in
75
+ * the current workspace.
76
+ *
77
+ * The packages come from {@link listWorkspacePackages}; unscoped packages are
78
+ * skipped. If detection or the command fails, an empty list is returned
79
+ * instead of throwing.
80
+ *
81
+ * @param options - Working directory and optional package manager.
82
+ * @returns Unique scopes, sorted alphabetically, without the trailing `/`.
83
+ * @example
84
+ * ```ts
85
+ * const scopes = discoverWorkspaceScopes();
86
+ * // => ['@dcdavidev']
87
+ * const groups = scopes.map((scope) => `^${scope}/`);
88
+ * ```
89
+ */
90
+ export declare function discoverWorkspaceScopes(options?: DiscoverWorkspaceScopesOptions): string[];
91
+ export default discoverWorkspaceScopes;
92
+ //# sourceMappingURL=discover-workspace-scopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover-workspace-scopes.d.ts","sources":["../src/discover-workspace-scopes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAuGD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,GACV;IAAE,OAAO,EAAE,uBAAuB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAuBhE;AA2GD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,8BAAmC,GAC3C,SAAS,gBAAgB,EAAE,CA4B7B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,GAAE,8BAAmC,GAC3C,MAAM,EAAE,CAOV;AAED,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,272 @@
1
+ /**
2
+ * @file Lists the packages of the current workspace and the npm scopes they
3
+ * use, by asking the workspace package manager (pnpm, Yarn, npm or Bun).
4
+ */
5
+ import { execFileSync } from 'node:child_process';
6
+ import { existsSync, globSync, readFileSync } from 'node:fs';
7
+ import path from 'node:path';
8
+ /**
9
+ * Package managers recognized in the `packageManager` field of `package.json`.
10
+ */
11
+ const PACKAGE_MANAGERS = new Set([
12
+ 'pnpm',
13
+ 'yarn',
14
+ 'npm',
15
+ 'bun',
16
+ ]);
17
+ /**
18
+ * Files that identify each package manager, in detection order.
19
+ */
20
+ const LOCK_FILES = [
21
+ ['pnpm-lock.yaml', 'pnpm'],
22
+ ['pnpm-workspace.yaml', 'pnpm'],
23
+ ['yarn.lock', 'yarn'],
24
+ ['bun.lock', 'bun'],
25
+ ['bun.lockb', 'bun'],
26
+ ['package-lock.json', 'npm'],
27
+ ];
28
+ /**
29
+ * Parses a JSON string, returning `undefined` when it is invalid.
30
+ *
31
+ * @param text - JSON source.
32
+ * @returns The parsed value, or `undefined`.
33
+ */
34
+ function parseJson(text) {
35
+ try {
36
+ return JSON.parse(text);
37
+ }
38
+ catch {
39
+ return undefined;
40
+ }
41
+ }
42
+ /**
43
+ * Reads and parses a JSON file, returning `undefined` when it is missing or
44
+ * invalid.
45
+ *
46
+ * @param file - Absolute path of the JSON file.
47
+ * @returns The parsed content, or `undefined`.
48
+ */
49
+ function readJson(file) {
50
+ return existsSync(file) ? parseJson(readFileSync(file, 'utf8')) : undefined;
51
+ }
52
+ /**
53
+ * Runs a command and returns its standard output, or `undefined` when it
54
+ * fails or is not installed.
55
+ *
56
+ * @param command - Executable to run.
57
+ * @param args - Command line arguments.
58
+ * @param cwd - Working directory.
59
+ * @returns The trimmed standard output, or `undefined`.
60
+ */
61
+ function run(command, args, cwd) {
62
+ try {
63
+ return execFileSync(command, args, {
64
+ cwd,
65
+ encoding: 'utf8',
66
+ stdio: ['ignore', 'pipe', 'ignore'],
67
+ shell: process.platform === 'win32',
68
+ }).trim();
69
+ }
70
+ catch {
71
+ return undefined;
72
+ }
73
+ }
74
+ /**
75
+ * Converts parsed workspace entries into packages, skipping entries without a
76
+ * `name` or a directory.
77
+ *
78
+ * @param entries - Parsed workspace entries.
79
+ * @param key - Entry field holding the package directory.
80
+ * @param root - Directory that relative package directories resolve against.
81
+ * @returns The workspace packages.
82
+ */
83
+ function packagesOf(entries, key, root) {
84
+ if (!Array.isArray(entries))
85
+ return [];
86
+ return entries
87
+ .map((entry) => ({
88
+ name: entry?.name,
89
+ dir: entry?.[key],
90
+ }))
91
+ .filter((entry) => typeof entry.name === 'string' && typeof entry.dir === 'string')
92
+ .map(({ name, dir }) => ({ name, dir: path.resolve(root, dir) }));
93
+ }
94
+ /**
95
+ * Detects the workspace package manager by walking up from `cwd`, looking at
96
+ * the `packageManager` field of each `package.json` and at known lock files.
97
+ *
98
+ * @param cwd - Directory to start from.
99
+ * @returns The detected package manager and the directory it was found in.
100
+ */
101
+ export function detectPackageManager(cwd) {
102
+ let dir = path.resolve(cwd);
103
+ for (;;) {
104
+ const manifest = readJson(path.join(dir, 'package.json'));
105
+ const declared = typeof manifest?.packageManager === 'string'
106
+ ? manifest.packageManager.split('@', 1)[0]
107
+ : undefined;
108
+ if (declared && PACKAGE_MANAGERS.has(declared)) {
109
+ return { manager: declared, root: dir };
110
+ }
111
+ for (const [file, manager] of LOCK_FILES) {
112
+ if (existsSync(path.join(dir, file)))
113
+ return { manager, root: dir };
114
+ }
115
+ const parent = path.dirname(dir);
116
+ if (parent === dir)
117
+ return undefined;
118
+ dir = parent;
119
+ }
120
+ }
121
+ /**
122
+ * Lists workspace packages with `pnpm ls -r --depth -1 --json`.
123
+ *
124
+ * @param cwd - Directory inside the workspace.
125
+ * @returns The workspace packages.
126
+ */
127
+ function listPnpm(cwd) {
128
+ const output = run('pnpm', ['ls', '-r', '--depth', '-1', '--json'], cwd);
129
+ return output ? packagesOf(parseJson(output), 'path', cwd) : [];
130
+ }
131
+ /**
132
+ * Lists workspace packages with `yarn workspaces list --json` (Yarn 2+) or
133
+ * `yarn workspaces info` (Yarn 1).
134
+ *
135
+ * @param cwd - Directory inside the workspace.
136
+ * @param root - Workspace root, which Yarn locations are relative to.
137
+ * @returns The workspace packages.
138
+ */
139
+ function listYarn(cwd, root) {
140
+ const version = run('yarn', ['--version'], cwd);
141
+ if (!version)
142
+ return [];
143
+ if (version.startsWith('1.')) {
144
+ const output = run('yarn', ['--silent', 'workspaces', 'info'], cwd);
145
+ const info = output ? parseJson(output) : undefined;
146
+ if (!info || typeof info !== 'object')
147
+ return [];
148
+ const entries = Object.entries(info).map(([name, value]) => ({
149
+ name,
150
+ location: value?.location,
151
+ }));
152
+ return packagesOf(entries, 'location', root);
153
+ }
154
+ const output = run('yarn', ['workspaces', 'list', '--json'], cwd);
155
+ return output
156
+ ? packagesOf(output.split('\n').map((line) => parseJson(line)), 'location', root)
157
+ : [];
158
+ }
159
+ /**
160
+ * Lists workspace packages with `npm query .workspace`.
161
+ *
162
+ * @param cwd - Directory inside the workspace.
163
+ * @returns The workspace packages.
164
+ */
165
+ function listNpm(cwd) {
166
+ const output = run('npm', ['query', '.workspace'], cwd);
167
+ return output ? packagesOf(parseJson(output), 'path', cwd) : [];
168
+ }
169
+ /**
170
+ * Lists workspace packages for Bun, which has no command that lists only
171
+ * local packages: the `workspaces` globs of the root `package.json` are
172
+ * expanded and each matched `package.json` is read.
173
+ *
174
+ * @param root - Workspace root directory.
175
+ * @returns The workspace packages.
176
+ */
177
+ function listBun(root) {
178
+ const manifest = readJson(path.join(root, 'package.json'));
179
+ const workspaces = manifest?.workspaces;
180
+ const patterns = Array.isArray(workspaces)
181
+ ? workspaces
182
+ : workspaces?.packages;
183
+ if (!Array.isArray(patterns))
184
+ return [];
185
+ const globs = patterns.filter((pattern) => typeof pattern === 'string');
186
+ const include = globs
187
+ .filter((pattern) => !pattern.startsWith('!'))
188
+ .map((pattern) => `${pattern}/package.json`);
189
+ const exclude = globs
190
+ .filter((pattern) => pattern.startsWith('!'))
191
+ .map((pattern) => `${pattern.slice(1)}/package.json`);
192
+ const files = globSync(include, { cwd: root, exclude });
193
+ const entries = files.map((file) => ({
194
+ ...readJson(path.join(root, file)),
195
+ dir: path.dirname(file),
196
+ }));
197
+ return packagesOf(entries, 'dir', root);
198
+ }
199
+ /**
200
+ * Workspace packages already listed, keyed by working directory and package
201
+ * manager, so that repeated calls do not run the package manager again.
202
+ */
203
+ const cache = new Map();
204
+ /**
205
+ * Lists the packages defined in the current workspace, including the root
206
+ * package.
207
+ *
208
+ * The package manager is detected from the `packageManager` field or the lock
209
+ * files, unless given, and asked for the workspace packages:
210
+ * `pnpm ls -r --depth -1 --json`, `yarn workspaces list --json` (Yarn 2+),
211
+ * `yarn workspaces info` (Yarn 1) or `npm query .workspace`. For Bun the
212
+ * `workspaces` globs of the root `package.json` are read directly.
213
+ * Results are cached per working directory and package manager. If detection
214
+ * or the command fails, an empty list is returned instead of throwing.
215
+ *
216
+ * @param options - Working directory and optional package manager.
217
+ * @returns The workspace packages, with their names, absolute directories and
218
+ * whether each one is the workspace root.
219
+ * @example
220
+ * ```ts
221
+ * const packages = listWorkspacePackages();
222
+ * // => [{ name: '@dcdavidev/eslint-plugin', dir: '/repo/packages/eslint-plugin', isRoot: false }, ...]
223
+ * ```
224
+ */
225
+ export function listWorkspacePackages(options = {}) {
226
+ const cwd = path.resolve(options.cwd ?? process.cwd());
227
+ const detected = detectPackageManager(cwd);
228
+ const manager = options.packageManager ?? detected?.manager;
229
+ const root = detected?.root ?? cwd;
230
+ const key = `${manager ?? ''}:${cwd}`;
231
+ const cached = cache.get(key);
232
+ if (cached)
233
+ return cached;
234
+ const listers = {
235
+ pnpm: () => listPnpm(cwd),
236
+ yarn: () => listYarn(cwd, root),
237
+ npm: () => listNpm(cwd),
238
+ bun: () => listBun(root),
239
+ };
240
+ const packages = (manager ? listers[manager]() : []).map((workspacePackage) => ({
241
+ ...workspacePackage,
242
+ isRoot: workspacePackage.dir === root,
243
+ }));
244
+ cache.set(key, packages);
245
+ return packages;
246
+ }
247
+ /**
248
+ * Returns the npm scopes (such as `@dcdavidev`) of the packages defined in
249
+ * the current workspace.
250
+ *
251
+ * The packages come from {@link listWorkspacePackages}; unscoped packages are
252
+ * skipped. If detection or the command fails, an empty list is returned
253
+ * instead of throwing.
254
+ *
255
+ * @param options - Working directory and optional package manager.
256
+ * @returns Unique scopes, sorted alphabetically, without the trailing `/`.
257
+ * @example
258
+ * ```ts
259
+ * const scopes = discoverWorkspaceScopes();
260
+ * // => ['@dcdavidev']
261
+ * const groups = scopes.map((scope) => `^${scope}/`);
262
+ * ```
263
+ */
264
+ export function discoverWorkspaceScopes(options = {}) {
265
+ const scopes = listWorkspacePackages(options)
266
+ .map(({ name }) => name)
267
+ .filter((name) => name.startsWith('@') && name.includes('/'))
268
+ .map((name) => name.slice(0, name.indexOf('/')));
269
+ return [...new Set(scopes)].toSorted((a, b) => a.localeCompare(b));
270
+ }
271
+ export default discoverWorkspaceScopes;
272
+ //# sourceMappingURL=discover-workspace-scopes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover-workspace-scopes.js","sources":["../src/discover-workspace-scopes.ts"],"names":[],"mappings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