@smoothbricks/cli 0.1.1 → 0.3.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 +161 -32
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +110 -10
- 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/generate/index.d.ts +20 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +47 -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 +6 -0
- package/dist/lib/run.d.ts.map +1 -1
- package/dist/lib/run.js +32 -0
- package/dist/lib/workspace.d.ts +25 -1
- package/dist/lib/workspace.d.ts.map +1 -1
- package/dist/lib/workspace.js +79 -17
- 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/lockfile.d.ts.map +1 -1
- package/dist/monorepo/lockfile.js +9 -0
- 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 +13 -4
- package/dist/monorepo/package-policy.d.ts.map +1 -1
- package/dist/monorepo/package-policy.js +208 -113
- 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 +7 -15
- 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 +25 -0
- package/dist/nx/index.d.ts.map +1 -0
- package/dist/nx/index.js +112 -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 +4 -1
- package/dist/release/core.d.ts.map +1 -1
- package/dist/release/core.js +76 -9
- package/dist/release/github-release.d.ts +1 -0
- package/dist/release/github-release.d.ts.map +1 -1
- package/dist/release/github-release.js +3 -3
- package/dist/release/index.d.ts +32 -1
- package/dist/release/index.d.ts.map +1 -1
- package/dist/release/index.js +488 -64
- 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 +11 -2
- package/dist/release/orchestration.d.ts.map +1 -1
- package/dist/release/orchestration.js +41 -3
- 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 +4 -2
- package/package.json +15 -8
- package/src/cli.ts +153 -22
- package/src/devenv/index.test.ts +49 -0
- package/src/devenv/index.ts +38 -0
- package/src/generate/index.ts +92 -0
- package/src/lib/cli-package.ts +18 -0
- package/src/lib/run.ts +44 -0
- package/src/lib/workspace.ts +112 -17
- 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/lockfile.ts +9 -0
- 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 +1130 -0
- package/src/monorepo/package-policy.ts +237 -114
- 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 +10 -19
- 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 +73 -0
- package/src/nx/index.ts +139 -0
- package/src/release/__tests__/bootstrap-npm-packages.test.ts +127 -0
- package/src/release/__tests__/candidates.test.ts +262 -0
- package/src/release/__tests__/core-properties.test.ts +6 -6
- package/src/release/__tests__/core-scenarios.test.ts +27 -20
- package/src/release/__tests__/core.test.ts +52 -5
- package/src/release/__tests__/fixture-repo.test.ts +90 -31
- package/src/release/__tests__/github-release.test.ts +22 -24
- 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 +142 -12
- package/src/release/__tests__/publish-plan.test.ts +9 -3
- package/src/release/__tests__/retag-unpublished.test.ts +10 -10
- package/src/release/__tests__/trust-publisher.test.ts +165 -0
- package/src/release/bootstrap-npm-packages.ts +88 -0
- package/src/release/candidates.ts +225 -0
- package/src/release/core.ts +96 -10
- package/src/release/github-release.ts +3 -3
- package/src/release/index.ts +658 -74
- package/src/release/npm-auth.ts +4 -33
- package/src/release/orchestration.ts +60 -5
- package/src/release/publish-plan.ts +1 -1
- package/dist/nx-version-actions.cjs +0 -25
- package/dist/nx-version-actions.d.cts +0 -6
- package/dist/nx-version-actions.d.cts.map +0 -1
- package/managed/raw/.git-format-staged.yml +0 -47
- package/src/nx-version-actions.cts +0 -36
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lockfile.d.ts","sourceRoot":"","sources":["../../src/monorepo/lockfile.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,8BAA8B;IAC7C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"lockfile.d.ts","sourceRoot":"","sources":["../../src/monorepo/lockfile.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,8BAA8B;IAC7C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAWD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,8BAAmC,GAAG,MAAM,CA0C1G;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA6BhE"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { escapeRegex, getWorkspacePackages } from '../lib/workspace.js';
|
|
4
|
+
// Temporary Bun workaround. Delete this sync function, validateBunLockfileVersions,
|
|
5
|
+
// the `smoo monorepo sync-bun-lockfile-versions` command, and the matching Nx
|
|
6
|
+
// versionActions hook once supported Bun versions stop leaving workspace package
|
|
7
|
+
// versions stale in bun.lock after manifest bumps. Until then, `bun pm pack`
|
|
8
|
+
// rewrites `workspace:*` dependencies using those stale lockfile versions instead
|
|
9
|
+
// of the current package.json versions. Track removal against:
|
|
10
|
+
// - https://github.com/oven-sh/bun/issues/18906
|
|
11
|
+
// - https://github.com/oven-sh/bun/issues/20477
|
|
12
|
+
// - https://github.com/oven-sh/bun/issues/20829
|
|
4
13
|
export function syncBunLockfileVersions(root, options = {}) {
|
|
5
14
|
const log = options.log ?? true;
|
|
6
15
|
const lockfilePath = join(root, 'bun.lock');
|
|
@@ -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,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type PackageTargetPolicyOptions, type ResolvedProjectTargets } from '@smoothbricks/nx-plugin/package-target-policy';
|
|
2
|
+
import { SMOO_NX_RELEASE_TAG_PATTERN, SMOO_NX_VERSION_ACTIONS } from '@smoothbricks/nx-plugin/release-config-policy';
|
|
3
|
+
export type { PackageTargetPolicyOptions as WorkspaceDependencyDefaultOptions, ResolvedProjectTargets };
|
|
4
|
+
export { SMOO_NX_RELEASE_TAG_PATTERN, SMOO_NX_VERSION_ACTIONS };
|
|
5
|
+
export declare function applyFixableMonorepoDefaults(root: string): void;
|
|
6
|
+
export declare function applyRootScriptDefaults(root: string): void;
|
|
7
|
+
export declare function applyNxPluginDefaults(root: string): void;
|
|
3
8
|
export declare function applyPublicPackageDefaults(root: string): void;
|
|
4
|
-
export declare function applyWorkspaceDependencyDefaults(root: string): void;
|
|
9
|
+
export declare function applyWorkspaceDependencyDefaults(root: string, options?: PackageTargetPolicyOptions): void;
|
|
5
10
|
export declare function applyNxReleaseDefaults(root: string): void;
|
|
11
|
+
export declare function applyNxProjectNameDefaults(root: string): void;
|
|
12
|
+
export declare function listValidCommitScopes(root: string): ReadonlySet<string>;
|
|
13
|
+
export declare function listNxProjectNames(root: string): string[];
|
|
6
14
|
export declare function validateRootPackagePolicy(root: string): number;
|
|
7
15
|
export declare function validateNxReleaseConfig(root: string): number;
|
|
16
|
+
export declare function validateNxProjectNames(root: string): number;
|
|
8
17
|
export declare function validatePublicTags(root: string): number;
|
|
9
18
|
export declare function validatePublicPackageMetadata(root: string): number;
|
|
10
|
-
export declare function validateWorkspaceDependencies(root: string): number;
|
|
19
|
+
export declare function validateWorkspaceDependencies(root: string, options?: PackageTargetPolicyOptions): number;
|
|
11
20
|
//# 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":"AAKA,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC5B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAGL,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,+CAA+C,CAAC;AA6BvD,YAAY,EAAE,0BAA0B,IAAI,iCAAiC,EAAE,sBAAsB,EAAE,CAAC;AACxG,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,CAAC;AAUhE,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,CAMxD;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAuC7D;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,0BAA+B,GAAG,IAAI,CAwB7G;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAMzD;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAoB7D;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,CAW5D;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,0BAA+B,GAAG,MAAM,CAiC5G"}
|