@smoothbricks/cli 0.1.1 → 0.2.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/README.md +155 -30
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +91 -7
- package/dist/devenv/index.d.ts +10 -0
- package/dist/devenv/index.d.ts.map +1 -0
- package/dist/devenv/index.js +27 -0
- package/dist/lib/cli-package.d.ts +4 -0
- package/dist/lib/cli-package.d.ts.map +1 -0
- package/dist/lib/cli-package.js +15 -0
- package/dist/lib/run.d.ts +5 -0
- package/dist/lib/run.d.ts.map +1 -1
- package/dist/lib/run.js +13 -0
- package/dist/lib/workspace.d.ts +15 -1
- package/dist/lib/workspace.d.ts.map +1 -1
- package/dist/lib/workspace.js +25 -2
- package/dist/monorepo/commit-msg.d.ts +8 -1
- package/dist/monorepo/commit-msg.d.ts.map +1 -1
- package/dist/monorepo/commit-msg.js +85 -7
- package/dist/monorepo/index.d.ts +19 -2
- package/dist/monorepo/index.d.ts.map +1 -1
- package/dist/monorepo/index.js +104 -16
- package/dist/monorepo/managed-files.js +1 -1
- package/dist/monorepo/nx-sync.d.ts +2 -1
- package/dist/monorepo/nx-sync.d.ts.map +1 -1
- package/dist/monorepo/nx-sync.js +8 -2
- package/dist/monorepo/package-hygiene.d.ts +6 -2
- package/dist/monorepo/package-hygiene.d.ts.map +1 -1
- package/dist/monorepo/package-hygiene.js +12 -4
- package/dist/monorepo/package-policy.d.ts +22 -2
- package/dist/monorepo/package-policy.d.ts.map +1 -1
- package/dist/monorepo/package-policy.js +1167 -8
- package/dist/monorepo/packed-package.d.ts +3 -0
- package/dist/monorepo/packed-package.d.ts.map +1 -1
- package/dist/monorepo/packed-package.js +68 -36
- package/dist/monorepo/packs/index.d.ts +20 -1
- package/dist/monorepo/packs/index.d.ts.map +1 -1
- package/dist/monorepo/packs/index.js +238 -19
- package/dist/monorepo/publish-workflow.d.ts +0 -4
- package/dist/monorepo/publish-workflow.d.ts.map +1 -1
- package/dist/monorepo/publish-workflow.js +5 -12
- package/dist/monorepo/tool-validation.d.ts +22 -0
- package/dist/monorepo/tool-validation.d.ts.map +1 -0
- package/dist/monorepo/tool-validation.js +399 -0
- package/dist/nx/index.d.ts +24 -0
- package/dist/nx/index.d.ts.map +1 -0
- package/dist/nx/index.js +94 -0
- package/dist/release/bootstrap-npm-packages.d.ts +19 -0
- package/dist/release/bootstrap-npm-packages.d.ts.map +1 -0
- package/dist/release/bootstrap-npm-packages.js +58 -0
- package/dist/release/candidates.d.ts +11 -0
- package/dist/release/candidates.d.ts.map +1 -0
- package/dist/release/candidates.js +181 -0
- package/dist/release/core.d.ts +1 -0
- package/dist/release/core.d.ts.map +1 -1
- package/dist/release/github-release.js +2 -2
- package/dist/release/index.d.ts +25 -0
- package/dist/release/index.d.ts.map +1 -1
- package/dist/release/index.js +247 -49
- package/dist/release/npm-auth.d.ts +0 -1
- package/dist/release/npm-auth.d.ts.map +1 -1
- package/dist/release/npm-auth.js +4 -16
- package/dist/release/orchestration.d.ts +2 -1
- package/dist/release/orchestration.d.ts.map +1 -1
- package/dist/release/orchestration.js +9 -1
- package/dist/release/publish-plan.js +1 -1
- package/managed/raw/git-format-staged.yml +54 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +1 -1
- package/managed/templates/github/actions/setup-devenv/action.yml +1 -7
- package/managed/templates/github/workflows/ci.yml +1 -0
- package/package.json +15 -3
- package/src/cli.ts +134 -20
- package/src/devenv/index.test.ts +49 -0
- package/src/devenv/index.ts +38 -0
- package/src/lib/cli-package.ts +18 -0
- package/src/lib/run.ts +19 -0
- package/src/lib/workspace.ts +41 -2
- package/src/monorepo/__tests__/publish-workflow.test.ts +16 -9
- package/src/monorepo/commit-msg.test.ts +45 -0
- package/src/monorepo/commit-msg.ts +107 -7
- package/src/monorepo/index.ts +142 -16
- package/src/monorepo/managed-files.ts +1 -1
- package/src/monorepo/nx-sync.ts +9 -2
- package/src/monorepo/package-hygiene.test.ts +34 -0
- package/src/monorepo/package-hygiene.ts +26 -4
- package/src/monorepo/package-policy.test.ts +902 -0
- package/src/monorepo/package-policy.ts +1393 -7
- package/src/monorepo/packed-package.ts +89 -37
- package/src/monorepo/packs/index.test.ts +189 -0
- package/src/monorepo/packs/index.ts +311 -20
- package/src/monorepo/publish-workflow.ts +8 -16
- package/src/monorepo/setup-test-tracing.test.ts +120 -0
- package/src/monorepo/tool-validation.test.ts +261 -0
- package/src/monorepo/tool-validation.ts +462 -0
- package/src/nx/index.test.ts +64 -0
- package/src/nx/index.ts +119 -0
- package/src/release/__tests__/bootstrap-npm-packages.test.ts +127 -0
- package/src/release/__tests__/candidates.test.ts +217 -0
- package/src/release/__tests__/core-properties.test.ts +4 -4
- package/src/release/__tests__/core-scenarios.test.ts +15 -5
- package/src/release/__tests__/core.test.ts +2 -2
- package/src/release/__tests__/fixture-repo.test.ts +22 -13
- package/src/release/__tests__/github-release.test.ts +13 -8
- package/src/release/__tests__/helpers/fixture-repo.ts +1 -0
- package/src/release/__tests__/npm-auth.test.ts +12 -21
- package/src/release/__tests__/orchestration.test.ts +51 -7
- package/src/release/__tests__/publish-plan.test.ts +9 -3
- package/src/release/__tests__/retag-unpublished.test.ts +1 -1
- package/src/release/__tests__/trust-publisher.test.ts +133 -0
- package/src/release/bootstrap-npm-packages.ts +88 -0
- package/src/release/candidates.ts +225 -0
- package/src/release/core.ts +1 -0
- package/src/release/github-release.ts +2 -2
- package/src/release/index.ts +346 -56
- package/src/release/npm-auth.ts +4 -33
- package/src/release/orchestration.ts +12 -2
- package/src/release/publish-plan.ts +1 -1
- package/managed/raw/.git-format-staged.yml +0 -47
package/dist/lib/workspace.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export interface PackageInfo {
|
|
2
2
|
name: string;
|
|
3
|
+
projectName: string;
|
|
3
4
|
version: string;
|
|
4
5
|
private: boolean;
|
|
5
6
|
tags: string[];
|
|
@@ -7,20 +8,33 @@ export interface PackageInfo {
|
|
|
7
8
|
packageJsonPath: string;
|
|
8
9
|
json: Record<string, unknown>;
|
|
9
10
|
}
|
|
11
|
+
export interface PackageJson extends Record<string, unknown> {
|
|
12
|
+
name?: string;
|
|
13
|
+
version?: string;
|
|
14
|
+
private?: boolean;
|
|
15
|
+
workspaces?: unknown;
|
|
16
|
+
devDependencies?: unknown;
|
|
17
|
+
dependencies?: unknown;
|
|
18
|
+
nx?: unknown;
|
|
19
|
+
repository?: unknown;
|
|
20
|
+
}
|
|
10
21
|
export interface RepositoryInfo {
|
|
11
22
|
type: string;
|
|
12
23
|
url: string;
|
|
13
24
|
}
|
|
14
|
-
export declare const workspaceDependencyFields: readonly ["dependencies", "devDependencies", "optionalDependencies"];
|
|
25
|
+
export declare const workspaceDependencyFields: readonly ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
|
|
15
26
|
export declare function listPublicPackages(root: string): PackageInfo[];
|
|
16
27
|
export declare function listReleasePackages(root: string, rootPackage?: PackageInfo | null): PackageInfo[];
|
|
17
28
|
export declare function rootRepositoryInfo(root: string): RepositoryInfo | null;
|
|
29
|
+
export declare function rootPackageName(root: string): string | null;
|
|
30
|
+
export declare function isSmoothBricksCodebase(root: string): boolean;
|
|
18
31
|
export declare function packageRepositoryInfo(pkg: PackageInfo): RepositoryInfo | null;
|
|
19
32
|
export declare function isOwnedPackage(rootRepository: RepositoryInfo, pkg: PackageInfo): boolean;
|
|
20
33
|
export declare function getWorkspacePackages(root: string): PackageInfo[];
|
|
21
34
|
export declare function listPackageJsonRecords(root: string): PackageInfo[];
|
|
22
35
|
export declare function getWorkspacePatterns(root: string): string[];
|
|
23
36
|
export declare function readPackageJson(path: string): PackageInfo | null;
|
|
37
|
+
export declare function readPackageJsonObject(path: string): PackageJson | null;
|
|
24
38
|
export declare function getNxTags(pkg: Record<string, unknown>): string[];
|
|
25
39
|
export declare function repositoryInfo(pkg: Record<string, unknown>): RepositoryInfo | null;
|
|
26
40
|
export declare function sameRepositoryAfterNormalization(left: string, right: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/lib/workspace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/lib/workspace.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,WAAY,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,yBAAyB,0FAK5B,CAAC;AAEX,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAE9D;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,WAAW,qBAA8C,GACxD,WAAW,EAAE,CAWf;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAGtE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG3D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,WAAW,GAAG,cAAc,GAAG,IAAI,CAE7E;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAGxF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAMhE;AAiCD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CASlE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAG3D;AAgBD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAiBhE;AAOD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAGtE;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAKhE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,cAAc,GAAG,IAAI,CAalF;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAErF;AA4BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
package/dist/lib/workspace.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { readdirSync, statSync } from 'node:fs';
|
|
2
2
|
import { dirname, join, relative } from 'node:path';
|
|
3
|
+
import { isSmoothBricksCodebasePackageName } from './cli-package.js';
|
|
3
4
|
import { hasOwn, hasOwnString, isRecord, readJson, readJsonObject, stringProperty } from './json.js';
|
|
4
|
-
export const workspaceDependencyFields = [
|
|
5
|
+
export const workspaceDependencyFields = [
|
|
6
|
+
'dependencies',
|
|
7
|
+
'devDependencies',
|
|
8
|
+
'peerDependencies',
|
|
9
|
+
'optionalDependencies',
|
|
10
|
+
];
|
|
5
11
|
export function listPublicPackages(root) {
|
|
6
12
|
return getWorkspacePackages(root).filter((pkg) => !pkg.private && pkg.tags.includes('npm:public'));
|
|
7
13
|
}
|
|
@@ -19,6 +25,13 @@ export function rootRepositoryInfo(root) {
|
|
|
19
25
|
const rootPackage = readJsonObject(join(root, 'package.json'));
|
|
20
26
|
return rootPackage ? repositoryInfo(rootPackage) : null;
|
|
21
27
|
}
|
|
28
|
+
export function rootPackageName(root) {
|
|
29
|
+
const rootPackage = readPackageJsonObject(join(root, 'package.json'));
|
|
30
|
+
return rootPackage ? stringProperty(rootPackage, 'name') : null;
|
|
31
|
+
}
|
|
32
|
+
export function isSmoothBricksCodebase(root) {
|
|
33
|
+
return isSmoothBricksCodebasePackageName(rootPackageName(root) ?? undefined);
|
|
34
|
+
}
|
|
22
35
|
export function packageRepositoryInfo(pkg) {
|
|
23
36
|
return repositoryInfo(pkg.json);
|
|
24
37
|
}
|
|
@@ -51,6 +64,7 @@ function getWorkspacePackagesForPatterns(root, workspacePatterns) {
|
|
|
51
64
|
}
|
|
52
65
|
packages.push({
|
|
53
66
|
name: pkg.name,
|
|
67
|
+
projectName: pkg.projectName,
|
|
54
68
|
version: pkg.version,
|
|
55
69
|
private: pkg.private,
|
|
56
70
|
tags: pkg.tags,
|
|
@@ -90,7 +104,7 @@ function getWorkspacePatternsFromPackageJson(pkg) {
|
|
|
90
104
|
return ['packages/*'];
|
|
91
105
|
}
|
|
92
106
|
export function readPackageJson(path) {
|
|
93
|
-
const parsed =
|
|
107
|
+
const parsed = readPackageJsonObject(path);
|
|
94
108
|
if (!isRecord(parsed) || !hasOwnString(parsed, 'name') || !hasOwnString(parsed, 'version')) {
|
|
95
109
|
return null;
|
|
96
110
|
}
|
|
@@ -98,6 +112,7 @@ export function readPackageJson(path) {
|
|
|
98
112
|
const tags = getNxTags(parsed);
|
|
99
113
|
return {
|
|
100
114
|
name: parsed.name,
|
|
115
|
+
projectName: packageNxProjectName(parsed),
|
|
101
116
|
version: parsed.version,
|
|
102
117
|
private: privateValue,
|
|
103
118
|
tags,
|
|
@@ -106,6 +121,14 @@ export function readPackageJson(path) {
|
|
|
106
121
|
json: parsed,
|
|
107
122
|
};
|
|
108
123
|
}
|
|
124
|
+
function packageNxProjectName(pkg) {
|
|
125
|
+
const nx = isRecord(pkg.nx) ? pkg.nx : null;
|
|
126
|
+
return (nx ? stringProperty(nx, 'name') : null) ?? stringProperty(pkg, 'name') ?? '';
|
|
127
|
+
}
|
|
128
|
+
export function readPackageJsonObject(path) {
|
|
129
|
+
const parsed = readJsonObject(path);
|
|
130
|
+
return parsed;
|
|
131
|
+
}
|
|
109
132
|
export function getNxTags(pkg) {
|
|
110
133
|
if (!hasOwn(pkg, 'nx') || !isRecord(pkg.nx) || !hasOwn(pkg.nx, 'tags') || !Array.isArray(pkg.nx.tags)) {
|
|
111
134
|
return [];
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface FormatCommitMessageOptions {
|
|
2
|
+
wrapBody?: (paragraph: string) => string;
|
|
3
|
+
}
|
|
4
|
+
export interface ValidateCommitMessageOptions {
|
|
5
|
+
validScopes?: ReadonlySet<string>;
|
|
6
|
+
}
|
|
7
|
+
export declare function validateCommitMessage(message: string, options?: ValidateCommitMessageOptions): string | null;
|
|
8
|
+
export declare function formatCommitMessage(message: string, options?: FormatCommitMessageOptions): string;
|
|
2
9
|
//# sourceMappingURL=commit-msg.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit-msg.d.ts","sourceRoot":"","sources":["../../src/monorepo/commit-msg.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commit-msg.d.ts","sourceRoot":"","sources":["../../src/monorepo/commit-msg.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1C;AAED,MAAM,WAAW,4BAA4B;IAC3C,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACnC;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,4BAAiC,GAAG,MAAM,GAAG,IAAI,CA+BhH;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,0BAA+B,GAAG,MAAM,CA2CrG"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
1
2
|
const validCommitTypes = new Set([
|
|
2
3
|
'build',
|
|
3
4
|
'chore',
|
|
@@ -10,25 +11,102 @@ const validCommitTypes = new Set([
|
|
|
10
11
|
'revert',
|
|
11
12
|
'style',
|
|
12
13
|
'test',
|
|
14
|
+
'types',
|
|
13
15
|
]);
|
|
14
|
-
export function validateCommitMessage(message) {
|
|
16
|
+
export function validateCommitMessage(message, options = {}) {
|
|
15
17
|
const subject = message.split('\n', 1)[0]?.trim() ?? '';
|
|
16
18
|
if (!subject) {
|
|
17
19
|
return 'Commit message subject is empty.';
|
|
18
20
|
}
|
|
19
|
-
if (
|
|
21
|
+
if (isGitGeneratedSubject(subject)) {
|
|
20
22
|
return null;
|
|
21
23
|
}
|
|
22
|
-
const match = /^(?<type>[a-z]+)(\([a-z0-9._
|
|
24
|
+
const match = /^(?<type>[a-z]+)(\((?<scope>[a-z0-9._/@-]+(?:,[a-z0-9._/@-]+)*)\))?(?<breaking>!)?: .+$/.exec(subject);
|
|
23
25
|
const type = match?.groups?.type;
|
|
24
|
-
if (type
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
return `Invalid conventional commit subject: ${subject}
|
|
26
|
+
if (!type || !validCommitTypes.has(type)) {
|
|
27
|
+
return `Invalid conventional commit subject: ${subject}
|
|
28
28
|
|
|
29
29
|
Expected examples:
|
|
30
30
|
feat(statebus-core): add optimistic transactions
|
|
31
31
|
fix(money): round negative amounts consistently
|
|
32
32
|
chore(release): publish 1.2.3
|
|
33
33
|
feat!: remove deprecated API`;
|
|
34
|
+
}
|
|
35
|
+
const scope = match.groups?.scope;
|
|
36
|
+
if (scope && options.validScopes) {
|
|
37
|
+
const invalidScopes = scope.split(',').filter((entry) => !options.validScopes?.has(entry));
|
|
38
|
+
if (invalidScopes.length > 0) {
|
|
39
|
+
return `Invalid conventional commit scope: ${invalidScopes.join(',')}
|
|
40
|
+
|
|
41
|
+
Use package.json nx.name values, for example:
|
|
42
|
+
feat(statebus-core): add optimistic transactions
|
|
43
|
+
fix(money): round negative amounts consistently`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
export function formatCommitMessage(message, options = {}) {
|
|
49
|
+
const wrapBody = options.wrapBody ?? wrapBodyWithFmt;
|
|
50
|
+
const normalized = message.replace(/\r\n?/g, '\n');
|
|
51
|
+
const lines = normalized.split('\n');
|
|
52
|
+
const subject = lines.shift()?.trimEnd() ?? '';
|
|
53
|
+
const formatted = [subject];
|
|
54
|
+
let paragraph = [];
|
|
55
|
+
let inFence = false;
|
|
56
|
+
const flushParagraph = () => {
|
|
57
|
+
if (paragraph.length === 0) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
formatted.push(wrapBody(paragraph.join('\n')).trimEnd());
|
|
61
|
+
paragraph = [];
|
|
62
|
+
};
|
|
63
|
+
for (const line of lines) {
|
|
64
|
+
const trimmedEnd = line.trimEnd();
|
|
65
|
+
if (trimmedEnd.startsWith('```') || trimmedEnd.startsWith('~~~')) {
|
|
66
|
+
flushParagraph();
|
|
67
|
+
inFence = !inFence;
|
|
68
|
+
formatted.push(trimmedEnd);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (inFence || shouldPreserveLine(trimmedEnd)) {
|
|
72
|
+
flushParagraph();
|
|
73
|
+
formatted.push(trimmedEnd);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (trimmedEnd === '') {
|
|
77
|
+
flushParagraph();
|
|
78
|
+
formatted.push('');
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
paragraph.push(trimmedEnd);
|
|
82
|
+
}
|
|
83
|
+
flushParagraph();
|
|
84
|
+
while (formatted.length > 1 && formatted.at(-1) === '') {
|
|
85
|
+
formatted.pop();
|
|
86
|
+
}
|
|
87
|
+
return `${formatted.join('\n')}\n`;
|
|
88
|
+
}
|
|
89
|
+
function wrapBodyWithFmt(paragraph) {
|
|
90
|
+
const result = spawnSync('fmt', ['-w', '72'], { input: `${paragraph}\n`, encoding: 'utf8' });
|
|
91
|
+
if (result.error) {
|
|
92
|
+
throw new Error(`fmt is required to format commit messages. Install it through devenv and retry.\n${result.error.message}`);
|
|
93
|
+
}
|
|
94
|
+
if (result.status !== 0) {
|
|
95
|
+
throw new Error([result.stderr.trim(), result.stdout.trim()].filter(Boolean).join('\n') ||
|
|
96
|
+
'fmt failed to wrap commit message body.');
|
|
97
|
+
}
|
|
98
|
+
return result.stdout;
|
|
99
|
+
}
|
|
100
|
+
function shouldPreserveLine(line) {
|
|
101
|
+
return (line.startsWith('#') ||
|
|
102
|
+
line.startsWith('>') ||
|
|
103
|
+
/^\s/.test(line) ||
|
|
104
|
+
/^[-*+]\s+/.test(line) ||
|
|
105
|
+
/^\d+\.\s+/.test(line) ||
|
|
106
|
+
/^https?:\/\//.test(line) ||
|
|
107
|
+
/^[A-Za-z][A-Za-z0-9-]*: /.test(line) ||
|
|
108
|
+
/^BREAKING CHANGE: /.test(line));
|
|
109
|
+
}
|
|
110
|
+
function isGitGeneratedSubject(subject) {
|
|
111
|
+
return /^(Merge|Revert ")/.test(subject) || /^(fixup|squash)! /.test(subject);
|
|
34
112
|
}
|
package/dist/monorepo/index.d.ts
CHANGED
|
@@ -7,18 +7,35 @@ export interface InitOptions {
|
|
|
7
7
|
export interface ValidateOptions {
|
|
8
8
|
failFast?: boolean;
|
|
9
9
|
onlyIfNewWorkspacePackage?: boolean;
|
|
10
|
+
fix?: boolean;
|
|
11
|
+
verbose?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ValidateCommitMessageOptions {
|
|
14
|
+
fix?: boolean;
|
|
10
15
|
}
|
|
11
16
|
export interface ListReleasePackagesOptions {
|
|
12
17
|
failEmpty?: boolean;
|
|
13
18
|
githubOutput?: string;
|
|
14
19
|
}
|
|
20
|
+
export interface SetupTestTracingOptions {
|
|
21
|
+
all?: boolean;
|
|
22
|
+
projects?: string;
|
|
23
|
+
opContextExport?: string;
|
|
24
|
+
tracerModule?: string;
|
|
25
|
+
dryRun?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface SetupTestTracingShell {
|
|
28
|
+
run(command: string, args: string[], cwd: string): Promise<void>;
|
|
29
|
+
log(message: string): void;
|
|
30
|
+
}
|
|
15
31
|
export declare function initMonorepo(root: string, options: InitOptions): Promise<void>;
|
|
16
32
|
export declare function validateMonorepo(root: string, options?: ValidateOptions): Promise<void>;
|
|
17
33
|
export declare function updateManagedFiles(root: string): void;
|
|
18
34
|
export declare function checkManagedFiles(root: string): void;
|
|
19
35
|
export declare function diffManagedFiles(root: string): void;
|
|
20
|
-
export declare function validateCommitMessageFile(path: string | undefined): void;
|
|
21
|
-
export declare function
|
|
36
|
+
export declare function validateCommitMessageFile(path: string | undefined, options?: ValidateCommitMessageOptions, root?: string): void;
|
|
37
|
+
export declare function listReleaseProjectNamesForNx(root: string, options?: ListReleasePackagesOptions): string;
|
|
22
38
|
export declare function validatePublicPackageTags(root: string): void;
|
|
39
|
+
export declare function setupTestTracing(root: string, options: SetupTestTracingOptions, shell?: SetupTestTracingShell): Promise<void>;
|
|
23
40
|
export { applyWorkspaceGitConfig, syncBunLockfileVersions };
|
|
24
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/monorepo/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAMxD,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/monorepo/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAMxD,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,4BAA4B;IAC3C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAQpF;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBjG;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAErD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAMpD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,GAAE,4BAAiC,EAC1C,IAAI,SAAgB,GACnB,IAAI,CAgBN;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,0BAA+B,GAAG,MAAM,CAW3G;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI5D;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,uBAAuB,EAChC,KAAK,GAAE,qBAAoD,GAC1D,OAAO,CAAC,IAAI,CAAC,CA8Bf;AAED,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,CAAC"}
|
package/dist/monorepo/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { appendFileSync, readFileSync } from 'node:fs';
|
|
1
|
+
import { appendFileSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { $ } from 'bun';
|
|
3
|
-
import { decode } from '../lib/run.js';
|
|
4
|
-
import { escapeRegex, getWorkspacePatterns, listReleasePackages } from '../lib/workspace.js';
|
|
5
|
-
import { validateCommitMessage } from './commit-msg.js';
|
|
3
|
+
import { decode, run } from '../lib/run.js';
|
|
4
|
+
import { escapeRegex, getWorkspacePackages, getWorkspacePatterns, listReleasePackages } from '../lib/workspace.js';
|
|
5
|
+
import { formatCommitMessage, validateCommitMessage } from './commit-msg.js';
|
|
6
6
|
import { applyWorkspaceGitConfig } from './git-config.js';
|
|
7
7
|
import { syncBunLockfileVersions } from './lockfile.js';
|
|
8
8
|
import { applyManagedFiles, printResults } from './managed-files.js';
|
|
9
|
-
import { validatePublicTags } from './package-policy.js';
|
|
9
|
+
import { listValidCommitScopes, validatePublicTags } from './package-policy.js';
|
|
10
10
|
import { runInitPacks, runValidatePacks } from './packs/index.js';
|
|
11
11
|
import { syncRootRuntimeVersions } from './runtime.js';
|
|
12
12
|
export async function initMonorepo(root, options) {
|
|
@@ -21,13 +21,19 @@ export async function validateMonorepo(root, options = {}) {
|
|
|
21
21
|
if (options.onlyIfNewWorkspacePackage && !(await hasNewWorkspacePackage(root))) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
if (failures > 0) {
|
|
26
|
-
const
|
|
27
|
-
|
|
24
|
+
const result = await runValidatePacks({ root, syncRuntime: false, verbose: options.verbose === true }, options);
|
|
25
|
+
if (result.failures > 0) {
|
|
26
|
+
const checkNoun = result.failedChecks === 1 ? 'check' : 'checks';
|
|
27
|
+
const problemNoun = result.failures === 1 ? 'problem' : 'problems';
|
|
28
|
+
throw new Error(`\n🔴 Monorepo validation failed: ${result.failedChecks} ${checkNoun} failed with ${result.failures} ${problemNoun}.`);
|
|
29
|
+
}
|
|
30
|
+
if (options.verbose) {
|
|
31
|
+
console.log('\n== summary ==');
|
|
32
|
+
console.log('Monorepo configuration is valid.');
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
console.log('🟢 Monorepo configuration is valid.');
|
|
28
36
|
}
|
|
29
|
-
console.log('\n== summary ==');
|
|
30
|
-
console.log('Monorepo configuration is valid.');
|
|
31
37
|
}
|
|
32
38
|
export function updateManagedFiles(root) {
|
|
33
39
|
printResults(applyManagedFiles(root, 'update'));
|
|
@@ -42,19 +48,26 @@ export function checkManagedFiles(root) {
|
|
|
42
48
|
export function diffManagedFiles(root) {
|
|
43
49
|
printResults(applyManagedFiles(root, 'diff'));
|
|
44
50
|
}
|
|
45
|
-
export function validateCommitMessageFile(path) {
|
|
51
|
+
export function validateCommitMessageFile(path, options = {}, root = process.cwd()) {
|
|
46
52
|
if (!path) {
|
|
47
53
|
throw new Error('Usage: smoo monorepo validate-commit-msg <commit-msg-file>');
|
|
48
54
|
}
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
let message = readFileSync(path, 'utf8');
|
|
56
|
+
if (options.fix) {
|
|
57
|
+
const formatted = formatCommitMessage(message);
|
|
58
|
+
if (formatted !== message) {
|
|
59
|
+
writeFileSync(path, formatted);
|
|
60
|
+
message = formatted;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const error = validateCommitMessage(message, { validScopes: listValidCommitScopes(root) });
|
|
51
64
|
if (error) {
|
|
52
65
|
throw new Error(error);
|
|
53
66
|
}
|
|
54
67
|
}
|
|
55
|
-
export function
|
|
68
|
+
export function listReleaseProjectNamesForNx(root, options = {}) {
|
|
56
69
|
const packages = listReleasePackages(root)
|
|
57
|
-
.map((pkg) => pkg.
|
|
70
|
+
.map((pkg) => pkg.projectName)
|
|
58
71
|
.join(',');
|
|
59
72
|
if (!packages && options.failEmpty) {
|
|
60
73
|
throw new Error('No owned release packages found.');
|
|
@@ -69,7 +82,82 @@ export function validatePublicPackageTags(root) {
|
|
|
69
82
|
throw new Error('npm:public tag validation failed.');
|
|
70
83
|
}
|
|
71
84
|
}
|
|
85
|
+
export async function setupTestTracing(root, options, shell = defaultSetupTestTracingShell) {
|
|
86
|
+
const selectedPackages = selectTestTracingPackages(root, options);
|
|
87
|
+
const opContextExport = options.opContextExport ?? 'opContext';
|
|
88
|
+
const tracerModule = options.tracerModule ?? '@smoothbricks/lmao/testing/bun';
|
|
89
|
+
if (selectedPackages.length === 0) {
|
|
90
|
+
throw new Error('No workspace packages matched LMAO test tracing setup selection.');
|
|
91
|
+
}
|
|
92
|
+
for (const pkg of selectedPackages) {
|
|
93
|
+
const args = [
|
|
94
|
+
'g',
|
|
95
|
+
'@smoothbricks/nx-plugin:bun-test-tracing',
|
|
96
|
+
'--project',
|
|
97
|
+
pkg.projectName,
|
|
98
|
+
'--opContextModule',
|
|
99
|
+
pkg.name,
|
|
100
|
+
'--opContextExport',
|
|
101
|
+
opContextExport,
|
|
102
|
+
'--tracerModule',
|
|
103
|
+
tracerModule,
|
|
104
|
+
];
|
|
105
|
+
const commandPreview = `nx ${args.join(' ')}`;
|
|
106
|
+
if (options.dryRun) {
|
|
107
|
+
shell.log(`would run ${commandPreview}`);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
shell.log(`running ${commandPreview}`);
|
|
111
|
+
await shell.run('nx', args, root);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
72
114
|
export { applyWorkspaceGitConfig, syncBunLockfileVersions };
|
|
115
|
+
const defaultSetupTestTracingShell = {
|
|
116
|
+
run,
|
|
117
|
+
log(message) {
|
|
118
|
+
console.log(message);
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
function selectTestTracingPackages(root, options) {
|
|
122
|
+
const packages = getWorkspacePackages(root);
|
|
123
|
+
const requested = splitCommaList(options.projects);
|
|
124
|
+
if (options.all && requested.length > 0) {
|
|
125
|
+
throw new Error('Use either --all or --projects, not both.');
|
|
126
|
+
}
|
|
127
|
+
if (!options.all && requested.length === 0) {
|
|
128
|
+
throw new Error('Pass --all or --projects <projects> to select packages for LMAO test tracing setup.');
|
|
129
|
+
}
|
|
130
|
+
if (options.all) {
|
|
131
|
+
return packages;
|
|
132
|
+
}
|
|
133
|
+
const bySelector = new Map();
|
|
134
|
+
for (const pkg of packages) {
|
|
135
|
+
bySelector.set(pkg.projectName, pkg);
|
|
136
|
+
bySelector.set(pkg.name, pkg);
|
|
137
|
+
bySelector.set(pkg.path, pkg);
|
|
138
|
+
}
|
|
139
|
+
const selected = [];
|
|
140
|
+
const missing = [];
|
|
141
|
+
for (const selector of requested) {
|
|
142
|
+
const pkg = bySelector.get(selector);
|
|
143
|
+
if (pkg) {
|
|
144
|
+
selected.push(pkg);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
missing.push(selector);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (missing.length > 0) {
|
|
151
|
+
throw new Error(`Unknown workspace package selection for LMAO test tracing setup: ${missing.join(', ')}`);
|
|
152
|
+
}
|
|
153
|
+
return selected;
|
|
154
|
+
}
|
|
155
|
+
function splitCommaList(value) {
|
|
156
|
+
return (value ?? '')
|
|
157
|
+
.split(',')
|
|
158
|
+
.map((entry) => entry.trim())
|
|
159
|
+
.filter(Boolean);
|
|
160
|
+
}
|
|
73
161
|
async function hasNewWorkspacePackage(root) {
|
|
74
162
|
const result = await $ `git diff --cached --name-only --diff-filter=A -- ${'*/package.json'}`
|
|
75
163
|
.cwd(root)
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function fixNxSync(root: string, verbose?: boolean): Promise<void>;
|
|
2
|
+
export declare function validateNxSync(root: string, verbose?: boolean): Promise<number>;
|
|
2
3
|
//# sourceMappingURL=nx-sync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-sync.d.ts","sourceRoot":"","sources":["../../src/monorepo/nx-sync.ts"],"names":[],"mappings":"AAEA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"nx-sync.d.ts","sourceRoot":"","sources":["../../src/monorepo/nx-sync.ts"],"names":[],"mappings":"AAEA,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAK5E;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnF"}
|
package/dist/monorepo/nx-sync.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { runStatus } from '../lib/run.js';
|
|
2
|
-
export async function
|
|
3
|
-
const status = await runStatus('nx', ['sync
|
|
2
|
+
export async function fixNxSync(root, verbose = false) {
|
|
3
|
+
const status = await runStatus('nx', ['sync'], root, !verbose);
|
|
4
|
+
if (status !== 0) {
|
|
5
|
+
throw new Error(`nx sync failed with exit code ${status}`);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export async function validateNxSync(root, verbose = false) {
|
|
9
|
+
const status = await runStatus('nx', ['sync:check'], root, !verbose);
|
|
4
10
|
return status === 0 ? 0 : 1;
|
|
5
11
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export interface PackageHygieneShell {
|
|
2
|
+
run(command: string, args: string[], cwd: string): Promise<void>;
|
|
3
|
+
runStatus(command: string, args: string[], cwd: string, quiet?: boolean): Promise<number>;
|
|
4
|
+
}
|
|
5
|
+
export declare function fixPackageHygiene(root: string, verboseOrShell?: boolean | PackageHygieneShell, maybeShell?: PackageHygieneShell): Promise<void>;
|
|
6
|
+
export declare function validatePackageHygiene(root: string, verboseOrShell?: boolean | PackageHygieneShell, maybeShell?: PackageHygieneShell): Promise<number>;
|
|
3
7
|
//# sourceMappingURL=package-hygiene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-hygiene.d.ts","sourceRoot":"","sources":["../../src/monorepo/package-hygiene.ts"],"names":[],"mappings":"AAEA,wBAAsB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"package-hygiene.d.ts","sourceRoot":"","sources":["../../src/monorepo/package-hygiene.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3F;AAID,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,cAAc,GAAE,OAAO,GAAG,mBAA2B,EACrD,UAAU,GAAE,mBAAkC,GAC7C,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,cAAc,GAAE,OAAO,GAAG,mBAA2B,EACrD,UAAU,GAAE,mBAAkC,GAC7C,OAAO,CAAC,MAAM,CAAC,CASjB"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { run, runStatus } from '../lib/run.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const defaultShell = { run, runStatus };
|
|
3
|
+
export async function fixPackageHygiene(root, verboseOrShell = false, maybeShell = defaultShell) {
|
|
4
|
+
const verbose = typeof verboseOrShell === 'boolean' ? verboseOrShell : false;
|
|
5
|
+
const shell = typeof verboseOrShell === 'boolean' ? maybeShell : verboseOrShell;
|
|
6
|
+
const status = await shell.runStatus('sherif', ['-f', '--select', 'highest'], root, !verbose);
|
|
7
|
+
if (status !== 0) {
|
|
8
|
+
throw new Error(`sherif -f --select highest failed with exit code ${status}`);
|
|
9
|
+
}
|
|
4
10
|
}
|
|
5
|
-
export async function validatePackageHygiene(root) {
|
|
6
|
-
const
|
|
11
|
+
export async function validatePackageHygiene(root, verboseOrShell = false, maybeShell = defaultShell) {
|
|
12
|
+
const verbose = typeof verboseOrShell === 'boolean' ? verboseOrShell : false;
|
|
13
|
+
const shell = typeof verboseOrShell === 'boolean' ? maybeShell : verboseOrShell;
|
|
14
|
+
const status = await shell.runStatus('sherif', ['--fail-on-warnings'], root, !verbose);
|
|
7
15
|
if (status !== 0) {
|
|
8
16
|
console.error('sherif package hygiene validation failed');
|
|
9
17
|
return 1;
|
|
@@ -1,11 +1,31 @@
|
|
|
1
|
+
export interface WorkspaceDependencyDefaultOptions {
|
|
2
|
+
resolvedTargetsByProject?: ReadonlyMap<string, ReadonlySet<string> | ResolvedProjectTargets>;
|
|
3
|
+
}
|
|
4
|
+
export interface ResolvedProjectTargets {
|
|
5
|
+
targets: ReadonlySet<string>;
|
|
6
|
+
buildDependsOn?: readonly string[];
|
|
7
|
+
}
|
|
1
8
|
export declare const SMOO_NX_VERSION_ACTIONS = "@smoothbricks/cli/nx-version-actions";
|
|
2
9
|
export declare const SMOO_NX_RELEASE_TAG_PATTERN = "{projectName}@{version}";
|
|
10
|
+
export declare function applyFixableMonorepoDefaults(root: string): void;
|
|
11
|
+
export declare function applyRootScriptDefaults(root: string): void;
|
|
12
|
+
export declare function applyNxPluginDefaults(root: string): void;
|
|
3
13
|
export declare function applyPublicPackageDefaults(root: string): void;
|
|
4
|
-
export declare function applyWorkspaceDependencyDefaults(root: string): void;
|
|
14
|
+
export declare function applyWorkspaceDependencyDefaults(root: string, options?: WorkspaceDependencyDefaultOptions): void;
|
|
5
15
|
export declare function applyNxReleaseDefaults(root: string): void;
|
|
16
|
+
export declare function applyNxProjectNameDefaults(root: string): void;
|
|
17
|
+
export declare function listValidCommitScopes(root: string): ReadonlySet<string>;
|
|
18
|
+
export declare function listNxProjectNames(root: string): string[];
|
|
6
19
|
export declare function validateRootPackagePolicy(root: string): number;
|
|
7
20
|
export declare function validateNxReleaseConfig(root: string): number;
|
|
21
|
+
export declare function validateNxProjectNames(root: string): number;
|
|
8
22
|
export declare function validatePublicTags(root: string): number;
|
|
9
23
|
export declare function validatePublicPackageMetadata(root: string): number;
|
|
10
|
-
export declare function validateWorkspaceDependencies(root: string): number;
|
|
24
|
+
export declare function validateWorkspaceDependencies(root: string, options?: WorkspaceDependencyDefaultOptions): number;
|
|
25
|
+
export declare function applyPackageScriptPolicy(pkg: Record<string, unknown>, _packagePath: string, workspaceNames: ReadonlySet<string>, options?: {
|
|
26
|
+
resolvedTargets?: ReadonlySet<string>;
|
|
27
|
+
}): boolean;
|
|
28
|
+
export declare function validatePackageScriptPolicy(pkg: Record<string, unknown>, packagePath: string, workspaceNames: ReadonlySet<string>, options?: {
|
|
29
|
+
resolvedTargets?: ReadonlySet<string>;
|
|
30
|
+
}): number;
|
|
11
31
|
//# sourceMappingURL=package-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-policy.d.ts","sourceRoot":"","sources":["../../src/monorepo/package-policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-policy.d.ts","sourceRoot":"","sources":["../../src/monorepo/package-policy.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,iCAAiC;IAChD,wBAAwB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,sBAAsB,CAAC,CAAC;CAC9F;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,eAAO,MAAM,uBAAuB,yCAAyC,CAAC;AAC9E,eAAO,MAAM,2BAA2B,4BAA4B,CAAC;AAoBrE,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI/D;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAuB1D;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAwBxD;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAuC7D;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,iCAAsC,GAAG,IAAI,CAqBpH;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAqCzD;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAmB7D;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAEvE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAezD;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAsC9D;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmF5D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAyB3D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAcvD;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA0DlE;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,iCAAsC,GAAG,MAAM,CA+BnH;AAED,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,EACnC,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAO,GACtD,OAAO,CAkET;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,EACnC,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAO,GACtD,MAAM,CAgFR"}
|