@hyperfrontend/versioning 0.1.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/ARCHITECTURE.md +593 -0
- package/CHANGELOG.md +35 -0
- package/FUNDING.md +141 -0
- package/LICENSE.md +21 -0
- package/README.md +195 -0
- package/SECURITY.md +82 -0
- package/changelog/compare/diff.d.ts +128 -0
- package/changelog/compare/diff.d.ts.map +1 -0
- package/changelog/compare/index.cjs.js +628 -0
- package/changelog/compare/index.cjs.js.map +1 -0
- package/changelog/compare/index.d.ts +4 -0
- package/changelog/compare/index.d.ts.map +1 -0
- package/changelog/compare/index.esm.js +612 -0
- package/changelog/compare/index.esm.js.map +1 -0
- package/changelog/compare/is-equal.d.ts +114 -0
- package/changelog/compare/is-equal.d.ts.map +1 -0
- package/changelog/index.cjs.js +6448 -0
- package/changelog/index.cjs.js.map +1 -0
- package/changelog/index.d.ts +6 -0
- package/changelog/index.d.ts.map +1 -0
- package/changelog/index.esm.js +6358 -0
- package/changelog/index.esm.js.map +1 -0
- package/changelog/models/changelog.d.ts +86 -0
- package/changelog/models/changelog.d.ts.map +1 -0
- package/changelog/models/commit-ref.d.ts +51 -0
- package/changelog/models/commit-ref.d.ts.map +1 -0
- package/changelog/models/entry.d.ts +84 -0
- package/changelog/models/entry.d.ts.map +1 -0
- package/changelog/models/index.cjs.js +2043 -0
- package/changelog/models/index.cjs.js.map +1 -0
- package/changelog/models/index.d.ts +11 -0
- package/changelog/models/index.d.ts.map +1 -0
- package/changelog/models/index.esm.js +2026 -0
- package/changelog/models/index.esm.js.map +1 -0
- package/changelog/models/schema.d.ts +68 -0
- package/changelog/models/schema.d.ts.map +1 -0
- package/changelog/models/section.d.ts +25 -0
- package/changelog/models/section.d.ts.map +1 -0
- package/changelog/operations/add-entry.d.ts +56 -0
- package/changelog/operations/add-entry.d.ts.map +1 -0
- package/changelog/operations/add-item.d.ts +18 -0
- package/changelog/operations/add-item.d.ts.map +1 -0
- package/changelog/operations/filter-by-predicate.d.ts +81 -0
- package/changelog/operations/filter-by-predicate.d.ts.map +1 -0
- package/changelog/operations/filter-by-range.d.ts +63 -0
- package/changelog/operations/filter-by-range.d.ts.map +1 -0
- package/changelog/operations/filter-entries.d.ts +9 -0
- package/changelog/operations/filter-entries.d.ts.map +1 -0
- package/changelog/operations/index.cjs.js +2455 -0
- package/changelog/operations/index.cjs.js.map +1 -0
- package/changelog/operations/index.d.ts +15 -0
- package/changelog/operations/index.d.ts.map +1 -0
- package/changelog/operations/index.esm.js +2411 -0
- package/changelog/operations/index.esm.js.map +1 -0
- package/changelog/operations/merge.d.ts +88 -0
- package/changelog/operations/merge.d.ts.map +1 -0
- package/changelog/operations/remove-entry.d.ts +45 -0
- package/changelog/operations/remove-entry.d.ts.map +1 -0
- package/changelog/operations/remove-section.d.ts +50 -0
- package/changelog/operations/remove-section.d.ts.map +1 -0
- package/changelog/operations/transform.d.ts +143 -0
- package/changelog/operations/transform.d.ts.map +1 -0
- package/changelog/parse/index.cjs.js +1282 -0
- package/changelog/parse/index.cjs.js.map +1 -0
- package/changelog/parse/index.d.ts +5 -0
- package/changelog/parse/index.d.ts.map +1 -0
- package/changelog/parse/index.esm.js +1275 -0
- package/changelog/parse/index.esm.js.map +1 -0
- package/changelog/parse/line.d.ts +48 -0
- package/changelog/parse/line.d.ts.map +1 -0
- package/changelog/parse/parser.d.ts +16 -0
- package/changelog/parse/parser.d.ts.map +1 -0
- package/changelog/parse/tokenizer.d.ts +49 -0
- package/changelog/parse/tokenizer.d.ts.map +1 -0
- package/changelog/serialize/index.cjs.js +574 -0
- package/changelog/serialize/index.cjs.js.map +1 -0
- package/changelog/serialize/index.d.ts +6 -0
- package/changelog/serialize/index.d.ts.map +1 -0
- package/changelog/serialize/index.esm.js +564 -0
- package/changelog/serialize/index.esm.js.map +1 -0
- package/changelog/serialize/templates.d.ts +81 -0
- package/changelog/serialize/templates.d.ts.map +1 -0
- package/changelog/serialize/to-json.d.ts +57 -0
- package/changelog/serialize/to-json.d.ts.map +1 -0
- package/changelog/serialize/to-string.d.ts +30 -0
- package/changelog/serialize/to-string.d.ts.map +1 -0
- package/commits/index.cjs.js +648 -0
- package/commits/index.cjs.js.map +1 -0
- package/commits/index.d.ts +3 -0
- package/commits/index.d.ts.map +1 -0
- package/commits/index.esm.js +629 -0
- package/commits/index.esm.js.map +1 -0
- package/commits/models/breaking.d.ts +39 -0
- package/commits/models/breaking.d.ts.map +1 -0
- package/commits/models/commit-type.d.ts +32 -0
- package/commits/models/commit-type.d.ts.map +1 -0
- package/commits/models/conventional.d.ts +49 -0
- package/commits/models/conventional.d.ts.map +1 -0
- package/commits/models/index.cjs.js +207 -0
- package/commits/models/index.cjs.js.map +1 -0
- package/commits/models/index.d.ts +7 -0
- package/commits/models/index.d.ts.map +1 -0
- package/commits/models/index.esm.js +193 -0
- package/commits/models/index.esm.js.map +1 -0
- package/commits/parse/body.d.ts +18 -0
- package/commits/parse/body.d.ts.map +1 -0
- package/commits/parse/footer.d.ts +16 -0
- package/commits/parse/footer.d.ts.map +1 -0
- package/commits/parse/header.d.ts +15 -0
- package/commits/parse/header.d.ts.map +1 -0
- package/commits/parse/index.cjs.js +505 -0
- package/commits/parse/index.cjs.js.map +1 -0
- package/commits/parse/index.d.ts +5 -0
- package/commits/parse/index.d.ts.map +1 -0
- package/commits/parse/index.esm.js +499 -0
- package/commits/parse/index.esm.js.map +1 -0
- package/commits/parse/message.d.ts +17 -0
- package/commits/parse/message.d.ts.map +1 -0
- package/commits/utils/replace-char.d.ts +19 -0
- package/commits/utils/replace-char.d.ts.map +1 -0
- package/flow/executor/execute.d.ts +72 -0
- package/flow/executor/execute.d.ts.map +1 -0
- package/flow/executor/index.cjs.js +4402 -0
- package/flow/executor/index.cjs.js.map +1 -0
- package/flow/executor/index.d.ts +3 -0
- package/flow/executor/index.d.ts.map +1 -0
- package/flow/executor/index.esm.js +4398 -0
- package/flow/executor/index.esm.js.map +1 -0
- package/flow/factory.d.ts +58 -0
- package/flow/factory.d.ts.map +1 -0
- package/flow/index.cjs.js +8506 -0
- package/flow/index.cjs.js.map +1 -0
- package/flow/index.d.ts +7 -0
- package/flow/index.d.ts.map +1 -0
- package/flow/index.esm.js +8451 -0
- package/flow/index.esm.js.map +1 -0
- package/flow/models/flow.d.ts +130 -0
- package/flow/models/flow.d.ts.map +1 -0
- package/flow/models/index.cjs.js +285 -0
- package/flow/models/index.cjs.js.map +1 -0
- package/flow/models/index.d.ts +7 -0
- package/flow/models/index.d.ts.map +1 -0
- package/flow/models/index.esm.js +268 -0
- package/flow/models/index.esm.js.map +1 -0
- package/flow/models/step.d.ts +108 -0
- package/flow/models/step.d.ts.map +1 -0
- package/flow/models/types.d.ts +150 -0
- package/flow/models/types.d.ts.map +1 -0
- package/flow/presets/conventional.d.ts +59 -0
- package/flow/presets/conventional.d.ts.map +1 -0
- package/flow/presets/independent.d.ts +61 -0
- package/flow/presets/independent.d.ts.map +1 -0
- package/flow/presets/index.cjs.js +3903 -0
- package/flow/presets/index.cjs.js.map +1 -0
- package/flow/presets/index.d.ts +4 -0
- package/flow/presets/index.d.ts.map +1 -0
- package/flow/presets/index.esm.js +3889 -0
- package/flow/presets/index.esm.js.map +1 -0
- package/flow/presets/synced.d.ts +65 -0
- package/flow/presets/synced.d.ts.map +1 -0
- package/flow/steps/analyze-commits.d.ts +19 -0
- package/flow/steps/analyze-commits.d.ts.map +1 -0
- package/flow/steps/calculate-bump.d.ts +27 -0
- package/flow/steps/calculate-bump.d.ts.map +1 -0
- package/flow/steps/create-commit.d.ts +16 -0
- package/flow/steps/create-commit.d.ts.map +1 -0
- package/flow/steps/create-tag.d.ts +22 -0
- package/flow/steps/create-tag.d.ts.map +1 -0
- package/flow/steps/fetch-registry.d.ts +19 -0
- package/flow/steps/fetch-registry.d.ts.map +1 -0
- package/flow/steps/generate-changelog.d.ts +25 -0
- package/flow/steps/generate-changelog.d.ts.map +1 -0
- package/flow/steps/index.cjs.js +3523 -0
- package/flow/steps/index.cjs.js.map +1 -0
- package/flow/steps/index.d.ts +8 -0
- package/flow/steps/index.d.ts.map +1 -0
- package/flow/steps/index.esm.js +3504 -0
- package/flow/steps/index.esm.js.map +1 -0
- package/flow/steps/update-packages.d.ts +25 -0
- package/flow/steps/update-packages.d.ts.map +1 -0
- package/flow/utils/interpolate.d.ts +11 -0
- package/flow/utils/interpolate.d.ts.map +1 -0
- package/git/factory.d.ts +233 -0
- package/git/factory.d.ts.map +1 -0
- package/git/index.cjs.js +2863 -0
- package/git/index.cjs.js.map +1 -0
- package/git/index.d.ts +5 -0
- package/git/index.d.ts.map +1 -0
- package/git/index.esm.js +2785 -0
- package/git/index.esm.js.map +1 -0
- package/git/models/commit.d.ts +129 -0
- package/git/models/commit.d.ts.map +1 -0
- package/git/models/index.cjs.js +755 -0
- package/git/models/index.cjs.js.map +1 -0
- package/git/models/index.d.ts +7 -0
- package/git/models/index.d.ts.map +1 -0
- package/git/models/index.esm.js +729 -0
- package/git/models/index.esm.js.map +1 -0
- package/git/models/ref.d.ts +120 -0
- package/git/models/ref.d.ts.map +1 -0
- package/git/models/tag.d.ts +141 -0
- package/git/models/tag.d.ts.map +1 -0
- package/git/operations/commit.d.ts +97 -0
- package/git/operations/commit.d.ts.map +1 -0
- package/git/operations/head-info.d.ts +29 -0
- package/git/operations/head-info.d.ts.map +1 -0
- package/git/operations/index.cjs.js +1954 -0
- package/git/operations/index.cjs.js.map +1 -0
- package/git/operations/index.d.ts +14 -0
- package/git/operations/index.d.ts.map +1 -0
- package/git/operations/index.esm.js +1903 -0
- package/git/operations/index.esm.js.map +1 -0
- package/git/operations/log.d.ts +104 -0
- package/git/operations/log.d.ts.map +1 -0
- package/git/operations/manage-tags.d.ts +60 -0
- package/git/operations/manage-tags.d.ts.map +1 -0
- package/git/operations/query-tags.d.ts +88 -0
- package/git/operations/query-tags.d.ts.map +1 -0
- package/git/operations/stage.d.ts +66 -0
- package/git/operations/stage.d.ts.map +1 -0
- package/git/operations/status.d.ts +173 -0
- package/git/operations/status.d.ts.map +1 -0
- package/index.cjs.js +16761 -0
- package/index.cjs.js.map +1 -0
- package/index.d.ts +102 -0
- package/index.d.ts.map +1 -0
- package/index.esm.js +16427 -0
- package/index.esm.js.map +1 -0
- package/package.json +200 -0
- package/registry/factory.d.ts +18 -0
- package/registry/factory.d.ts.map +1 -0
- package/registry/index.cjs.js +543 -0
- package/registry/index.cjs.js.map +1 -0
- package/registry/index.d.ts +5 -0
- package/registry/index.d.ts.map +1 -0
- package/registry/index.esm.js +535 -0
- package/registry/index.esm.js.map +1 -0
- package/registry/models/index.cjs.js +69 -0
- package/registry/models/index.cjs.js.map +1 -0
- package/registry/models/index.d.ts +6 -0
- package/registry/models/index.d.ts.map +1 -0
- package/registry/models/index.esm.js +66 -0
- package/registry/models/index.esm.js.map +1 -0
- package/registry/models/package-info.d.ts +55 -0
- package/registry/models/package-info.d.ts.map +1 -0
- package/registry/models/registry.d.ts +62 -0
- package/registry/models/registry.d.ts.map +1 -0
- package/registry/models/version-info.d.ts +67 -0
- package/registry/models/version-info.d.ts.map +1 -0
- package/registry/npm/cache.d.ts +50 -0
- package/registry/npm/cache.d.ts.map +1 -0
- package/registry/npm/client.d.ts +30 -0
- package/registry/npm/client.d.ts.map +1 -0
- package/registry/npm/index.cjs.js +456 -0
- package/registry/npm/index.cjs.js.map +1 -0
- package/registry/npm/index.d.ts +4 -0
- package/registry/npm/index.d.ts.map +1 -0
- package/registry/npm/index.esm.js +451 -0
- package/registry/npm/index.esm.js.map +1 -0
- package/semver/compare/compare.d.ts +100 -0
- package/semver/compare/compare.d.ts.map +1 -0
- package/semver/compare/index.cjs.js +386 -0
- package/semver/compare/index.cjs.js.map +1 -0
- package/semver/compare/index.d.ts +3 -0
- package/semver/compare/index.d.ts.map +1 -0
- package/semver/compare/index.esm.js +370 -0
- package/semver/compare/index.esm.js.map +1 -0
- package/semver/compare/sort.d.ts +36 -0
- package/semver/compare/sort.d.ts.map +1 -0
- package/semver/format/index.cjs.js +58 -0
- package/semver/format/index.cjs.js.map +1 -0
- package/semver/format/index.d.ts +2 -0
- package/semver/format/index.d.ts.map +1 -0
- package/semver/format/index.esm.js +53 -0
- package/semver/format/index.esm.js.map +1 -0
- package/semver/format/to-string.d.ts +31 -0
- package/semver/format/to-string.d.ts.map +1 -0
- package/semver/increment/bump.d.ts +37 -0
- package/semver/increment/bump.d.ts.map +1 -0
- package/semver/increment/index.cjs.js +223 -0
- package/semver/increment/index.cjs.js.map +1 -0
- package/semver/increment/index.d.ts +2 -0
- package/semver/increment/index.d.ts.map +1 -0
- package/semver/increment/index.esm.js +219 -0
- package/semver/increment/index.esm.js.map +1 -0
- package/semver/index.cjs.js +1499 -0
- package/semver/index.cjs.js.map +1 -0
- package/semver/index.d.ts +6 -0
- package/semver/index.d.ts.map +1 -0
- package/semver/index.esm.js +1458 -0
- package/semver/index.esm.js.map +1 -0
- package/semver/models/index.cjs.js +153 -0
- package/semver/models/index.cjs.js.map +1 -0
- package/semver/models/index.d.ts +5 -0
- package/semver/models/index.d.ts.map +1 -0
- package/semver/models/index.esm.js +139 -0
- package/semver/models/index.esm.js.map +1 -0
- package/semver/models/range.d.ts +83 -0
- package/semver/models/range.d.ts.map +1 -0
- package/semver/models/version.d.ts +78 -0
- package/semver/models/version.d.ts.map +1 -0
- package/semver/parse/index.cjs.js +799 -0
- package/semver/parse/index.cjs.js.map +1 -0
- package/semver/parse/index.d.ts +5 -0
- package/semver/parse/index.d.ts.map +1 -0
- package/semver/parse/index.esm.js +793 -0
- package/semver/parse/index.esm.js.map +1 -0
- package/semver/parse/range.d.ts +38 -0
- package/semver/parse/range.d.ts.map +1 -0
- package/semver/parse/version.d.ts +49 -0
- package/semver/parse/version.d.ts.map +1 -0
- package/workspace/discovery/changelog-path.d.ts +21 -0
- package/workspace/discovery/changelog-path.d.ts.map +1 -0
- package/workspace/discovery/dependencies.d.ts +145 -0
- package/workspace/discovery/dependencies.d.ts.map +1 -0
- package/workspace/discovery/discover-changelogs.d.ts +76 -0
- package/workspace/discovery/discover-changelogs.d.ts.map +1 -0
- package/workspace/discovery/index.cjs.js +2300 -0
- package/workspace/discovery/index.cjs.js.map +1 -0
- package/workspace/discovery/index.d.ts +13 -0
- package/workspace/discovery/index.d.ts.map +1 -0
- package/workspace/discovery/index.esm.js +2283 -0
- package/workspace/discovery/index.esm.js.map +1 -0
- package/workspace/discovery/packages.d.ts +83 -0
- package/workspace/discovery/packages.d.ts.map +1 -0
- package/workspace/index.cjs.js +4445 -0
- package/workspace/index.cjs.js.map +1 -0
- package/workspace/index.d.ts +52 -0
- package/workspace/index.d.ts.map +1 -0
- package/workspace/index.esm.js +4394 -0
- package/workspace/index.esm.js.map +1 -0
- package/workspace/models/index.cjs.js +284 -0
- package/workspace/models/index.cjs.js.map +1 -0
- package/workspace/models/index.d.ts +10 -0
- package/workspace/models/index.d.ts.map +1 -0
- package/workspace/models/index.esm.js +261 -0
- package/workspace/models/index.esm.js.map +1 -0
- package/workspace/models/project.d.ts +118 -0
- package/workspace/models/project.d.ts.map +1 -0
- package/workspace/models/workspace.d.ts +139 -0
- package/workspace/models/workspace.d.ts.map +1 -0
- package/workspace/operations/batch-update.d.ts +99 -0
- package/workspace/operations/batch-update.d.ts.map +1 -0
- package/workspace/operations/cascade-bump.d.ts +125 -0
- package/workspace/operations/cascade-bump.d.ts.map +1 -0
- package/workspace/operations/index.cjs.js +2675 -0
- package/workspace/operations/index.cjs.js.map +1 -0
- package/workspace/operations/index.d.ts +12 -0
- package/workspace/operations/index.d.ts.map +1 -0
- package/workspace/operations/index.esm.js +2663 -0
- package/workspace/operations/index.esm.js.map +1 -0
- package/workspace/operations/validate.d.ts +85 -0
- package/workspace/operations/validate.d.ts.map +1 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Model
|
|
3
|
+
*
|
|
4
|
+
* Represents a monorepo workspace with multiple projects.
|
|
5
|
+
* Used for package discovery, dependency tracking, and coordinated versioning.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Default workspace discovery patterns.
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_PATTERNS = [
|
|
11
|
+
'libs/*/package.json',
|
|
12
|
+
'apps/*/package.json',
|
|
13
|
+
'packages/*/package.json',
|
|
14
|
+
'tools/*/package.json',
|
|
15
|
+
'plugins/*/package.json',
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Default exclusion patterns.
|
|
19
|
+
*/
|
|
20
|
+
const DEFAULT_EXCLUDE = ['**/node_modules/**', '**/dist/**', '**/coverage/**', '**/.git/**'];
|
|
21
|
+
/**
|
|
22
|
+
* Default workspace configuration.
|
|
23
|
+
*/
|
|
24
|
+
const DEFAULT_WORKSPACE_CONFIG = {
|
|
25
|
+
patterns: DEFAULT_PATTERNS,
|
|
26
|
+
exclude: DEFAULT_EXCLUDE,
|
|
27
|
+
includeChangelogs: true,
|
|
28
|
+
trackDependencies: true,
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new workspace configuration by merging with defaults.
|
|
32
|
+
*
|
|
33
|
+
* @param options - Partial configuration options
|
|
34
|
+
* @returns Complete workspace configuration
|
|
35
|
+
*/
|
|
36
|
+
function createWorkspaceConfig(options) {
|
|
37
|
+
return {
|
|
38
|
+
patterns: options?.patterns ?? DEFAULT_PATTERNS,
|
|
39
|
+
exclude: options?.exclude ?? DEFAULT_EXCLUDE,
|
|
40
|
+
includeChangelogs: options?.includeChangelogs ?? true,
|
|
41
|
+
trackDependencies: options?.trackDependencies ?? true,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a new workspace object.
|
|
46
|
+
*
|
|
47
|
+
* @param options - Workspace properties
|
|
48
|
+
* @param options.root - Absolute path to workspace root directory
|
|
49
|
+
* @param options.type - Type of workspace (nx, turbo, etc.)
|
|
50
|
+
* @param options.projects - Map of project names to project objects
|
|
51
|
+
* @param options.config - Configuration used for workspace discovery
|
|
52
|
+
* @param options.dependencyGraph - Map of package names to their dependents
|
|
53
|
+
* @param options.reverseDependencyGraph - Map of package names to their dependencies
|
|
54
|
+
* @returns A new Workspace object
|
|
55
|
+
*/
|
|
56
|
+
function createWorkspace(options) {
|
|
57
|
+
const projectList = [...options.projects.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
58
|
+
return {
|
|
59
|
+
root: options.root,
|
|
60
|
+
type: options.type,
|
|
61
|
+
projects: options.projects,
|
|
62
|
+
projectList,
|
|
63
|
+
config: options.config,
|
|
64
|
+
dependencyGraph: options.dependencyGraph,
|
|
65
|
+
reverseDependencyGraph: options.reverseDependencyGraph,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Gets a project by name from the workspace.
|
|
70
|
+
*
|
|
71
|
+
* @param workspace - Workspace to search in
|
|
72
|
+
* @param projectName - Identifier of the project to retrieve
|
|
73
|
+
* @returns The project or undefined if not found
|
|
74
|
+
*/
|
|
75
|
+
function getProject(workspace, projectName) {
|
|
76
|
+
return workspace.projects.get(projectName);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Checks if a project exists in the workspace.
|
|
80
|
+
*
|
|
81
|
+
* @param workspace - Workspace to search in
|
|
82
|
+
* @param projectName - Identifier of the project to check
|
|
83
|
+
* @returns True if the project exists
|
|
84
|
+
*/
|
|
85
|
+
function hasProject(workspace, projectName) {
|
|
86
|
+
return workspace.projects.has(projectName);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Gets all project names in the workspace.
|
|
90
|
+
*
|
|
91
|
+
* @param workspace - Workspace to retrieve project names from
|
|
92
|
+
* @returns Array of project names
|
|
93
|
+
*/
|
|
94
|
+
function getProjectNames(workspace) {
|
|
95
|
+
return workspace.projectList.map((p) => p.name);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Gets the count of projects in the workspace.
|
|
99
|
+
*
|
|
100
|
+
* @param workspace - Workspace to count projects in
|
|
101
|
+
* @returns Number of projects
|
|
102
|
+
*/
|
|
103
|
+
function getProjectCount(workspace) {
|
|
104
|
+
return workspace.projects.size;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Gets projects that depend on the given project.
|
|
108
|
+
*
|
|
109
|
+
* @param workspace - Workspace containing the dependency graph
|
|
110
|
+
* @param projectName - Name of the dependency
|
|
111
|
+
* @returns Array of dependent project names
|
|
112
|
+
*/
|
|
113
|
+
function getDependents(workspace, projectName) {
|
|
114
|
+
return workspace.dependencyGraph.get(projectName) ?? [];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Gets projects that the given project depends on.
|
|
118
|
+
*
|
|
119
|
+
* @param workspace - Workspace containing the dependency graph
|
|
120
|
+
* @param projectName - Identifier of the project to look up
|
|
121
|
+
* @returns Array of dependency project names
|
|
122
|
+
*/
|
|
123
|
+
function getDependencies(workspace, projectName) {
|
|
124
|
+
return workspace.reverseDependencyGraph.get(projectName) ?? [];
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Checks if projectA depends on projectB.
|
|
128
|
+
*
|
|
129
|
+
* @param workspace - Workspace containing the dependency graph
|
|
130
|
+
* @param projectA - Name of the potentially dependent project
|
|
131
|
+
* @param projectB - Name of the potential dependency
|
|
132
|
+
* @returns True if projectA depends on projectB
|
|
133
|
+
*/
|
|
134
|
+
function dependsOn(workspace, projectA, projectB) {
|
|
135
|
+
const deps = getDependencies(workspace, projectA);
|
|
136
|
+
return deps.includes(projectB);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Project Model
|
|
141
|
+
*
|
|
142
|
+
* Represents a single project/package within a workspace.
|
|
143
|
+
* Contains package.json data, paths, and dependency information.
|
|
144
|
+
*/
|
|
145
|
+
/**
|
|
146
|
+
* Creates a new Project object.
|
|
147
|
+
*
|
|
148
|
+
* @param options - Project properties
|
|
149
|
+
* @returns A new Project object
|
|
150
|
+
*/
|
|
151
|
+
function createProject(options) {
|
|
152
|
+
const isPrivate = options.packageJson['private'] === true;
|
|
153
|
+
const publishable = !isPrivate && options.name !== undefined && options.version !== undefined;
|
|
154
|
+
return {
|
|
155
|
+
name: options.name,
|
|
156
|
+
version: options.version,
|
|
157
|
+
path: options.path,
|
|
158
|
+
packageJsonPath: options.packageJsonPath,
|
|
159
|
+
packageJson: options.packageJson,
|
|
160
|
+
changelogPath: options.changelogPath ?? null,
|
|
161
|
+
internalDependencies: options.internalDependencies ?? [],
|
|
162
|
+
internalDependents: options.internalDependents ?? [],
|
|
163
|
+
publishable,
|
|
164
|
+
private: isPrivate,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Checks if a project is publishable (public and has name/version).
|
|
169
|
+
*
|
|
170
|
+
* @param project - The project to check
|
|
171
|
+
* @returns True if the project can be published
|
|
172
|
+
*/
|
|
173
|
+
function isPublishable(project) {
|
|
174
|
+
return project.publishable;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Checks if a project is private.
|
|
178
|
+
*
|
|
179
|
+
* @param project - The project to check
|
|
180
|
+
* @returns True if the project is marked as private
|
|
181
|
+
*/
|
|
182
|
+
function isPrivate(project) {
|
|
183
|
+
return project.private;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Checks if a project has a changelog file.
|
|
187
|
+
*
|
|
188
|
+
* @param project - The project to check
|
|
189
|
+
* @returns True if changelog exists
|
|
190
|
+
*/
|
|
191
|
+
function hasChangelog(project) {
|
|
192
|
+
return project.changelogPath !== null;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Checks if a project has any internal dependencies.
|
|
196
|
+
*
|
|
197
|
+
* @param project - The project to check
|
|
198
|
+
* @returns True if project depends on other workspace packages
|
|
199
|
+
*/
|
|
200
|
+
function hasInternalDependencies(project) {
|
|
201
|
+
return project.internalDependencies.length > 0;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Checks if a project has any internal dependents.
|
|
205
|
+
*
|
|
206
|
+
* @param project - The project to check
|
|
207
|
+
* @returns True if other workspace packages depend on this project
|
|
208
|
+
*/
|
|
209
|
+
function hasInternalDependents(project) {
|
|
210
|
+
return project.internalDependents.length > 0;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Gets the dependency count (internal dependencies).
|
|
214
|
+
*
|
|
215
|
+
* @param project - Project instance to analyze
|
|
216
|
+
* @returns Number of internal dependencies
|
|
217
|
+
*/
|
|
218
|
+
function getDependencyCount(project) {
|
|
219
|
+
return project.internalDependencies.length;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Gets the dependent count (packages that depend on this one).
|
|
223
|
+
*
|
|
224
|
+
* @param project - Project instance to analyze
|
|
225
|
+
* @returns Number of internal dependents
|
|
226
|
+
*/
|
|
227
|
+
function getDependentCount(project) {
|
|
228
|
+
return project.internalDependents.length;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Creates a copy of a project with updated internal dependents.
|
|
232
|
+
*
|
|
233
|
+
* @param project - The project to update
|
|
234
|
+
* @param dependents - New list of internal dependents
|
|
235
|
+
* @returns A new Project with updated dependents
|
|
236
|
+
*/
|
|
237
|
+
function withDependents(project, dependents) {
|
|
238
|
+
return {
|
|
239
|
+
...project,
|
|
240
|
+
internalDependents: dependents,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Creates a copy of a project with an added internal dependent.
|
|
245
|
+
*
|
|
246
|
+
* @param project - The project to update
|
|
247
|
+
* @param dependent - Name of the dependent to add
|
|
248
|
+
* @returns A new Project with the added dependent
|
|
249
|
+
*/
|
|
250
|
+
function addDependent(project, dependent) {
|
|
251
|
+
if (project.internalDependents.includes(dependent)) {
|
|
252
|
+
return project;
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
...project,
|
|
256
|
+
internalDependents: [...project.internalDependents, dependent],
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export { DEFAULT_EXCLUDE, DEFAULT_PATTERNS, DEFAULT_WORKSPACE_CONFIG, addDependent, createProject, createWorkspace, createWorkspaceConfig, dependsOn, getDependencies, getDependencyCount, getDependentCount, getDependents, getProject, getProjectCount, getProjectNames, hasChangelog, hasInternalDependencies, hasInternalDependents, hasProject, isPrivate, isPublishable, withDependents };
|
|
261
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../libs/versioning/src/workspace/models/workspace.ts","../../../../../../../../../../libs/versioning/src/workspace/models/project.ts"],"sourcesContent":[null,null],"names":[],"mappings":"AAAA;;;;;AAKG;AAqDH;;AAEG;AACI,MAAM,gBAAgB,GAAsB;IACjD,qBAAqB;IACrB,qBAAqB;IACrB,yBAAyB;IACzB,sBAAsB;IACtB,wBAAwB;;AAG1B;;AAEG;AACI,MAAM,eAAe,GAAsB,CAAC,oBAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY;AAErH;;AAEG;AACI,MAAM,wBAAwB,GAAoB;AACvD,IAAA,QAAQ,EAAE,gBAAgB;AAC1B,IAAA,OAAO,EAAE,eAAe;AACxB,IAAA,iBAAiB,EAAE,IAAI;AACvB,IAAA,iBAAiB,EAAE,IAAI;;AAGzB;;;;;AAKG;AACG,SAAU,qBAAqB,CAAC,OAAkC,EAAA;IACtE,OAAO;AACL,QAAA,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,gBAAgB;AAC/C,QAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,eAAe;AAC5C,QAAA,iBAAiB,EAAE,OAAO,EAAE,iBAAiB,IAAI,IAAI;AACrD,QAAA,iBAAiB,EAAE,OAAO,EAAE,iBAAiB,IAAI,IAAI;KACtD;AACH;AAEA;;;;;;;;;;;AAWG;AACG,SAAU,eAAe,CAAC,OAO/B,EAAA;AACC,IAAA,MAAM,WAAW,GAAG,CAAC,GAAG,OAAO,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D,IAAA,OAAO,OAAO,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC;AAChD;AAEA;;;;;AAKG;AACG,SAAU,qBAAqB,CAAC,OAAgB,EAAA;AACpD,IAAA,OAAO,OAAO,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC;AAC9C;AAEA;;;;;AAKG;AACG,SAAU,kBAAkB,CAAC,OAAgB,EAAA;AACjD,IAAA,OAAO,OAAO,CAAC,oBAAoB,CAAC,MAAM;AAC5C;AAEA;;;;;AAKG;AACG,SAAU,iBAAiB,CAAC,OAAgB,EAAA;AAChD,IAAA,OAAO,OAAO,CAAC,kBAAkB,CAAC,MAAM;AAC1C;AAEA;;;;;;AAMG;AACG,SAAU,cAAc,CAAC,OAAgB,EAAE,UAA6B,EAAA;IAC5E,OAAO;AACL,QAAA,GAAG,OAAO;AACV,QAAA,kBAAkB,EAAE,UAAU;KAC/B;AACH;AAEA;;;;;;AAMG;AACG,SAAU,YAAY,CAAC,OAAgB,EAAE,SAAiB,EAAA;IAC9D,IAAI,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;AAClD,QAAA,OAAO,OAAO;IAChB;IACA,OAAO;AACL,QAAA,GAAG,OAAO;QACV,kBAAkB,EAAE,CAAC,GAAG,OAAO,CAAC,kBAAkB,EAAE,SAAS,CAAC;KAC/D;AACH;;;;"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project Model
|
|
3
|
+
*
|
|
4
|
+
* Represents a single project/package within a workspace.
|
|
5
|
+
* Contains package.json data, paths, and dependency information.
|
|
6
|
+
*/
|
|
7
|
+
import type { PackageJson } from '@hyperfrontend/project-scope';
|
|
8
|
+
/**
|
|
9
|
+
* A single project within a workspace.
|
|
10
|
+
*/
|
|
11
|
+
export interface Project {
|
|
12
|
+
/** Package name from package.json */
|
|
13
|
+
readonly name: string;
|
|
14
|
+
/** Package version from package.json */
|
|
15
|
+
readonly version: string;
|
|
16
|
+
/** Absolute path to project root directory */
|
|
17
|
+
readonly path: string;
|
|
18
|
+
/** Absolute path to package.json */
|
|
19
|
+
readonly packageJsonPath: string;
|
|
20
|
+
/** Parsed package.json content */
|
|
21
|
+
readonly packageJson: PackageJson;
|
|
22
|
+
/** Absolute path to CHANGELOG.md (null if not found) */
|
|
23
|
+
readonly changelogPath: string | null;
|
|
24
|
+
/** Names of workspace packages this project depends on */
|
|
25
|
+
readonly internalDependencies: readonly string[];
|
|
26
|
+
/** Names of workspace packages that depend on this project */
|
|
27
|
+
readonly internalDependents: readonly string[];
|
|
28
|
+
/** Whether this is a publishable package */
|
|
29
|
+
readonly publishable: boolean;
|
|
30
|
+
/** Whether this is a private package */
|
|
31
|
+
readonly private: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Options for creating a project.
|
|
35
|
+
*/
|
|
36
|
+
export interface CreateProjectOptions {
|
|
37
|
+
name: string;
|
|
38
|
+
version: string;
|
|
39
|
+
path: string;
|
|
40
|
+
packageJsonPath: string;
|
|
41
|
+
packageJson: PackageJson;
|
|
42
|
+
changelogPath?: string | null;
|
|
43
|
+
internalDependencies?: readonly string[];
|
|
44
|
+
internalDependents?: readonly string[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new Project object.
|
|
48
|
+
*
|
|
49
|
+
* @param options - Project properties
|
|
50
|
+
* @returns A new Project object
|
|
51
|
+
*/
|
|
52
|
+
export declare function createProject(options: CreateProjectOptions): Project;
|
|
53
|
+
/**
|
|
54
|
+
* Checks if a project is publishable (public and has name/version).
|
|
55
|
+
*
|
|
56
|
+
* @param project - The project to check
|
|
57
|
+
* @returns True if the project can be published
|
|
58
|
+
*/
|
|
59
|
+
export declare function isPublishable(project: Project): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Checks if a project is private.
|
|
62
|
+
*
|
|
63
|
+
* @param project - The project to check
|
|
64
|
+
* @returns True if the project is marked as private
|
|
65
|
+
*/
|
|
66
|
+
export declare function isPrivate(project: Project): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Checks if a project has a changelog file.
|
|
69
|
+
*
|
|
70
|
+
* @param project - The project to check
|
|
71
|
+
* @returns True if changelog exists
|
|
72
|
+
*/
|
|
73
|
+
export declare function hasChangelog(project: Project): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Checks if a project has any internal dependencies.
|
|
76
|
+
*
|
|
77
|
+
* @param project - The project to check
|
|
78
|
+
* @returns True if project depends on other workspace packages
|
|
79
|
+
*/
|
|
80
|
+
export declare function hasInternalDependencies(project: Project): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Checks if a project has any internal dependents.
|
|
83
|
+
*
|
|
84
|
+
* @param project - The project to check
|
|
85
|
+
* @returns True if other workspace packages depend on this project
|
|
86
|
+
*/
|
|
87
|
+
export declare function hasInternalDependents(project: Project): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Gets the dependency count (internal dependencies).
|
|
90
|
+
*
|
|
91
|
+
* @param project - Project instance to analyze
|
|
92
|
+
* @returns Number of internal dependencies
|
|
93
|
+
*/
|
|
94
|
+
export declare function getDependencyCount(project: Project): number;
|
|
95
|
+
/**
|
|
96
|
+
* Gets the dependent count (packages that depend on this one).
|
|
97
|
+
*
|
|
98
|
+
* @param project - Project instance to analyze
|
|
99
|
+
* @returns Number of internal dependents
|
|
100
|
+
*/
|
|
101
|
+
export declare function getDependentCount(project: Project): number;
|
|
102
|
+
/**
|
|
103
|
+
* Creates a copy of a project with updated internal dependents.
|
|
104
|
+
*
|
|
105
|
+
* @param project - The project to update
|
|
106
|
+
* @param dependents - New list of internal dependents
|
|
107
|
+
* @returns A new Project with updated dependents
|
|
108
|
+
*/
|
|
109
|
+
export declare function withDependents(project: Project, dependents: readonly string[]): Project;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a copy of a project with an added internal dependent.
|
|
112
|
+
*
|
|
113
|
+
* @param project - The project to update
|
|
114
|
+
* @param dependent - Name of the dependent to add
|
|
115
|
+
* @returns A new Project with the added dependent
|
|
116
|
+
*/
|
|
117
|
+
export declare function addDependent(project: Project, dependent: string): Project;
|
|
118
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/workspace/models/project.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAE/D;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB,oCAAoC;IACpC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAEhC,kCAAkC;IAClC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IAEjC,wDAAwD;IACxD,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAErC,0DAA0D;IAC1D,QAAQ,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAA;IAEhD,8DAA8D;IAC9D,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAA;IAE9C,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAE7B,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,WAAW,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAgBpE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEnD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAKvF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAQzE"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Model
|
|
3
|
+
*
|
|
4
|
+
* Represents a monorepo workspace with multiple projects.
|
|
5
|
+
* Used for package discovery, dependency tracking, and coordinated versioning.
|
|
6
|
+
*/
|
|
7
|
+
import type { Project } from './project';
|
|
8
|
+
/**
|
|
9
|
+
* Workspace configuration options.
|
|
10
|
+
*/
|
|
11
|
+
export interface WorkspaceConfig {
|
|
12
|
+
/** Glob patterns for finding packages */
|
|
13
|
+
readonly patterns: readonly string[];
|
|
14
|
+
/** Patterns to exclude from discovery */
|
|
15
|
+
readonly exclude: readonly string[];
|
|
16
|
+
/** Whether to include changelog paths in discovery */
|
|
17
|
+
readonly includeChangelogs: boolean;
|
|
18
|
+
/** Whether to track internal dependencies */
|
|
19
|
+
readonly trackDependencies: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Workspace type indicating the package manager / tool in use.
|
|
23
|
+
*/
|
|
24
|
+
export type WorkspaceType = 'nx' | 'turbo' | 'lerna' | 'pnpm' | 'npm' | 'yarn' | 'rush' | 'unknown';
|
|
25
|
+
/**
|
|
26
|
+
* Complete workspace representation.
|
|
27
|
+
* Contains all discovered projects and their relationships.
|
|
28
|
+
*/
|
|
29
|
+
export interface Workspace {
|
|
30
|
+
/** Absolute path to workspace root */
|
|
31
|
+
readonly root: string;
|
|
32
|
+
/** Detected workspace type */
|
|
33
|
+
readonly type: WorkspaceType;
|
|
34
|
+
/** All discovered projects indexed by name */
|
|
35
|
+
readonly projects: ReadonlyMap<string, Project>;
|
|
36
|
+
/** Projects ordered by name */
|
|
37
|
+
readonly projectList: readonly Project[];
|
|
38
|
+
/** Configuration used for discovery */
|
|
39
|
+
readonly config: WorkspaceConfig;
|
|
40
|
+
/** Dependency graph (project name -> dependents) */
|
|
41
|
+
readonly dependencyGraph: ReadonlyMap<string, readonly string[]>;
|
|
42
|
+
/** Reverse dependency graph (project name -> dependencies) */
|
|
43
|
+
readonly reverseDependencyGraph: ReadonlyMap<string, readonly string[]>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Default workspace discovery patterns.
|
|
47
|
+
*/
|
|
48
|
+
export declare const DEFAULT_PATTERNS: readonly string[];
|
|
49
|
+
/**
|
|
50
|
+
* Default exclusion patterns.
|
|
51
|
+
*/
|
|
52
|
+
export declare const DEFAULT_EXCLUDE: readonly string[];
|
|
53
|
+
/**
|
|
54
|
+
* Default workspace configuration.
|
|
55
|
+
*/
|
|
56
|
+
export declare const DEFAULT_WORKSPACE_CONFIG: WorkspaceConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new workspace configuration by merging with defaults.
|
|
59
|
+
*
|
|
60
|
+
* @param options - Partial configuration options
|
|
61
|
+
* @returns Complete workspace configuration
|
|
62
|
+
*/
|
|
63
|
+
export declare function createWorkspaceConfig(options?: Partial<WorkspaceConfig>): WorkspaceConfig;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a new workspace object.
|
|
66
|
+
*
|
|
67
|
+
* @param options - Workspace properties
|
|
68
|
+
* @param options.root - Absolute path to workspace root directory
|
|
69
|
+
* @param options.type - Type of workspace (nx, turbo, etc.)
|
|
70
|
+
* @param options.projects - Map of project names to project objects
|
|
71
|
+
* @param options.config - Configuration used for workspace discovery
|
|
72
|
+
* @param options.dependencyGraph - Map of package names to their dependents
|
|
73
|
+
* @param options.reverseDependencyGraph - Map of package names to their dependencies
|
|
74
|
+
* @returns A new Workspace object
|
|
75
|
+
*/
|
|
76
|
+
export declare function createWorkspace(options: {
|
|
77
|
+
root: string;
|
|
78
|
+
type: WorkspaceType;
|
|
79
|
+
projects: ReadonlyMap<string, Project>;
|
|
80
|
+
config: WorkspaceConfig;
|
|
81
|
+
dependencyGraph: ReadonlyMap<string, readonly string[]>;
|
|
82
|
+
reverseDependencyGraph: ReadonlyMap<string, readonly string[]>;
|
|
83
|
+
}): Workspace;
|
|
84
|
+
/**
|
|
85
|
+
* Gets a project by name from the workspace.
|
|
86
|
+
*
|
|
87
|
+
* @param workspace - Workspace to search in
|
|
88
|
+
* @param projectName - Identifier of the project to retrieve
|
|
89
|
+
* @returns The project or undefined if not found
|
|
90
|
+
*/
|
|
91
|
+
export declare function getProject(workspace: Workspace, projectName: string): Project | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Checks if a project exists in the workspace.
|
|
94
|
+
*
|
|
95
|
+
* @param workspace - Workspace to search in
|
|
96
|
+
* @param projectName - Identifier of the project to check
|
|
97
|
+
* @returns True if the project exists
|
|
98
|
+
*/
|
|
99
|
+
export declare function hasProject(workspace: Workspace, projectName: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Gets all project names in the workspace.
|
|
102
|
+
*
|
|
103
|
+
* @param workspace - Workspace to retrieve project names from
|
|
104
|
+
* @returns Array of project names
|
|
105
|
+
*/
|
|
106
|
+
export declare function getProjectNames(workspace: Workspace): readonly string[];
|
|
107
|
+
/**
|
|
108
|
+
* Gets the count of projects in the workspace.
|
|
109
|
+
*
|
|
110
|
+
* @param workspace - Workspace to count projects in
|
|
111
|
+
* @returns Number of projects
|
|
112
|
+
*/
|
|
113
|
+
export declare function getProjectCount(workspace: Workspace): number;
|
|
114
|
+
/**
|
|
115
|
+
* Gets projects that depend on the given project.
|
|
116
|
+
*
|
|
117
|
+
* @param workspace - Workspace containing the dependency graph
|
|
118
|
+
* @param projectName - Name of the dependency
|
|
119
|
+
* @returns Array of dependent project names
|
|
120
|
+
*/
|
|
121
|
+
export declare function getDependents(workspace: Workspace, projectName: string): readonly string[];
|
|
122
|
+
/**
|
|
123
|
+
* Gets projects that the given project depends on.
|
|
124
|
+
*
|
|
125
|
+
* @param workspace - Workspace containing the dependency graph
|
|
126
|
+
* @param projectName - Identifier of the project to look up
|
|
127
|
+
* @returns Array of dependency project names
|
|
128
|
+
*/
|
|
129
|
+
export declare function getDependencies(workspace: Workspace, projectName: string): readonly string[];
|
|
130
|
+
/**
|
|
131
|
+
* Checks if projectA depends on projectB.
|
|
132
|
+
*
|
|
133
|
+
* @param workspace - Workspace containing the dependency graph
|
|
134
|
+
* @param projectA - Name of the potentially dependent project
|
|
135
|
+
* @param projectB - Name of the potential dependency
|
|
136
|
+
* @returns True if projectA depends on projectB
|
|
137
|
+
*/
|
|
138
|
+
export declare function dependsOn(workspace: Workspace, projectA: string, projectB: string): boolean;
|
|
139
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @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WAAW,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAE5F;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG3F"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Batch Update
|
|
3
|
+
*
|
|
4
|
+
* Utilities for updating multiple packages at once.
|
|
5
|
+
* Supports updating versions, dependencies, and other package.json fields.
|
|
6
|
+
*/
|
|
7
|
+
import type { Tree } from '@hyperfrontend/project-scope';
|
|
8
|
+
import type { Workspace } from '../models/workspace';
|
|
9
|
+
import type { PlannedBump } from './cascade-bump';
|
|
10
|
+
/**
|
|
11
|
+
* Result of a batch update operation.
|
|
12
|
+
*/
|
|
13
|
+
export interface BatchUpdateResult {
|
|
14
|
+
/** Packages successfully updated */
|
|
15
|
+
readonly updated: readonly UpdatedPackage[];
|
|
16
|
+
/** Packages that failed to update */
|
|
17
|
+
readonly failed: readonly FailedUpdate[];
|
|
18
|
+
/** Total number of packages processed */
|
|
19
|
+
readonly total: number;
|
|
20
|
+
/** Whether all updates succeeded */
|
|
21
|
+
readonly success: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Information about a successfully updated package.
|
|
25
|
+
*/
|
|
26
|
+
export interface UpdatedPackage {
|
|
27
|
+
/** Package name */
|
|
28
|
+
readonly name: string;
|
|
29
|
+
/** Path to package.json */
|
|
30
|
+
readonly packageJsonPath: string;
|
|
31
|
+
/** Previous version */
|
|
32
|
+
readonly previousVersion: string;
|
|
33
|
+
/** New version */
|
|
34
|
+
readonly newVersion: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Information about a failed update.
|
|
38
|
+
*/
|
|
39
|
+
export interface FailedUpdate {
|
|
40
|
+
/** Package name */
|
|
41
|
+
readonly name: string;
|
|
42
|
+
/** Path to package.json */
|
|
43
|
+
readonly packageJsonPath: string;
|
|
44
|
+
/** Error message */
|
|
45
|
+
readonly error: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Options for batch update operations.
|
|
49
|
+
*/
|
|
50
|
+
export interface BatchUpdateOptions {
|
|
51
|
+
/** Whether to perform a dry run (no actual changes) */
|
|
52
|
+
dryRun?: boolean;
|
|
53
|
+
/** Whether to update dependency references in other packages */
|
|
54
|
+
updateDependencyReferences?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Default batch update options.
|
|
58
|
+
*/
|
|
59
|
+
export declare const DEFAULT_BATCH_UPDATE_OPTIONS: Required<BatchUpdateOptions>;
|
|
60
|
+
/**
|
|
61
|
+
* Applies planned bumps to the workspace.
|
|
62
|
+
* Updates package.json version fields for all affected packages.
|
|
63
|
+
*
|
|
64
|
+
* @param workspace - Workspace containing projects to update
|
|
65
|
+
* @param bumps - Planned version bumps
|
|
66
|
+
* @param options - Update options
|
|
67
|
+
* @returns Batch update result
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* import { applyBumps, calculateCascadeBumps } from '@hyperfrontend/versioning'
|
|
72
|
+
*
|
|
73
|
+
* const cascadeResult = calculateCascadeBumps(workspace, directBumps)
|
|
74
|
+
* const updateResult = applyBumps(workspace, cascadeResult.bumps)
|
|
75
|
+
*
|
|
76
|
+
* if (updateResult.success) {
|
|
77
|
+
* console.log(`Updated ${updateResult.updated.length} packages`)
|
|
78
|
+
* } else {
|
|
79
|
+
* console.error('Some updates failed:', updateResult.failed)
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function applyBumps(workspace: Workspace, bumps: readonly PlannedBump[], options?: BatchUpdateOptions): BatchUpdateResult;
|
|
84
|
+
/**
|
|
85
|
+
* Updates a package.json file using a VFS Tree.
|
|
86
|
+
*
|
|
87
|
+
* @param tree - Virtual file system tree
|
|
88
|
+
* @param packageJsonPath - Relative path to package.json
|
|
89
|
+
* @param newVersion - New version string
|
|
90
|
+
*/
|
|
91
|
+
export declare function updatePackageVersionInTree(tree: Tree, packageJsonPath: string, newVersion: string): void;
|
|
92
|
+
/**
|
|
93
|
+
* Creates a summary of the batch update result.
|
|
94
|
+
*
|
|
95
|
+
* @param result - Result object from batch update operation
|
|
96
|
+
* @returns Human-readable summary
|
|
97
|
+
*/
|
|
98
|
+
export declare function summarizeBatchUpdate(result: BatchUpdateResult): string;
|
|
99
|
+
//# sourceMappingURL=batch-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-update.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/versioning/src/workspace/operations/batch-update.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAOjD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAA;IAE3C,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IAExC,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IAEtB,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB,2BAA2B;IAC3B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAEhC,uBAAuB;IACvB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAEhC,kBAAkB;IAClB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA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