@grekt/cli 6.40.0 → 6.40.2
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/dist/index.js +38 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -102329,6 +102329,24 @@ async function loadWorkspace(cwd) {
|
|
|
102329
102329
|
artifacts: discovered.artifacts
|
|
102330
102330
|
};
|
|
102331
102331
|
}
|
|
102332
|
+
function generateWorkspaceFile(root, artifacts) {
|
|
102333
|
+
const workspacePath = join29(root, "pnpm-workspace.yaml");
|
|
102334
|
+
const rootPackageJsonPath = join29(root, "package.json");
|
|
102335
|
+
const relativePaths = artifacts.map((artifact) => artifact.relativePath);
|
|
102336
|
+
fs.writeFile(workspacePath, $stringify2({ packages: relativePaths }));
|
|
102337
|
+
fs.writeFile(rootPackageJsonPath, JSON.stringify({ name: "workspace-root", private: true }, null, 2) + `
|
|
102338
|
+
`);
|
|
102339
|
+
}
|
|
102340
|
+
function cleanWorkspaceFile(root) {
|
|
102341
|
+
const workspacePath = join29(root, "pnpm-workspace.yaml");
|
|
102342
|
+
const rootPackageJsonPath = join29(root, "package.json");
|
|
102343
|
+
if (fs.exists(workspacePath)) {
|
|
102344
|
+
fs.unlink(workspacePath);
|
|
102345
|
+
}
|
|
102346
|
+
if (fs.exists(rootPackageJsonPath)) {
|
|
102347
|
+
fs.unlink(rootPackageJsonPath);
|
|
102348
|
+
}
|
|
102349
|
+
}
|
|
102332
102350
|
function generatePackageJsonFiles(artifacts) {
|
|
102333
102351
|
for (const artifact of artifacts) {
|
|
102334
102352
|
const packageJsonPath = join29(artifact.path, "package.json");
|
|
@@ -103271,11 +103289,12 @@ async function handleExecMode(options2) {
|
|
|
103271
103289
|
info(`Would run: ${command}`);
|
|
103272
103290
|
return;
|
|
103273
103291
|
}
|
|
103274
|
-
const genSpin = spinner("Generating
|
|
103292
|
+
const genSpin = spinner("Generating workspace config files...");
|
|
103275
103293
|
genSpin.start();
|
|
103294
|
+
generateWorkspaceFile(cwd, workspace.artifacts);
|
|
103276
103295
|
generatePackageJsonFiles(workspace.artifacts);
|
|
103277
103296
|
genSpin.stop();
|
|
103278
|
-
success(
|
|
103297
|
+
success("Generated workspace config files");
|
|
103279
103298
|
log("");
|
|
103280
103299
|
info(`Running: ${command}`);
|
|
103281
103300
|
log("");
|
|
@@ -103285,6 +103304,7 @@ async function handleExecMode(options2) {
|
|
|
103285
103304
|
stdio: "inherit"
|
|
103286
103305
|
});
|
|
103287
103306
|
if (result.status !== 0) {
|
|
103307
|
+
cleanWorkspaceFile(cwd);
|
|
103288
103308
|
cleanPackageJsonFiles(workspace.artifacts);
|
|
103289
103309
|
error(`Command failed with exit code ${result.status}`);
|
|
103290
103310
|
process.exit(result.status ?? 1);
|
|
@@ -103295,6 +103315,7 @@ async function handleExecMode(options2) {
|
|
|
103295
103315
|
const updatedWorkspace = await loadWorkspace(cwd);
|
|
103296
103316
|
if (!updatedWorkspace) {
|
|
103297
103317
|
syncSpin.stop();
|
|
103318
|
+
cleanWorkspaceFile(cwd);
|
|
103298
103319
|
cleanPackageJsonFiles(workspace.artifacts);
|
|
103299
103320
|
error("Failed to reload workspace");
|
|
103300
103321
|
process.exit(1);
|
|
@@ -103308,9 +103329,10 @@ async function handleExecMode(options2) {
|
|
|
103308
103329
|
}
|
|
103309
103330
|
const cleanSpin = spinner("Cleaning up...");
|
|
103310
103331
|
cleanSpin.start();
|
|
103332
|
+
cleanWorkspaceFile(cwd);
|
|
103311
103333
|
cleanPackageJsonFiles(workspace.artifacts);
|
|
103312
103334
|
cleanSpin.stop();
|
|
103313
|
-
success("Removed temporary
|
|
103335
|
+
success("Removed temporary config files");
|
|
103314
103336
|
log("");
|
|
103315
103337
|
success("Version update complete");
|
|
103316
103338
|
}
|
|
@@ -103473,16 +103495,20 @@ function mapFilesToArtifacts(changedFiles, artifacts) {
|
|
|
103473
103495
|
import { join as join31 } from "path";
|
|
103474
103496
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
103475
103497
|
var CHANGESET_DIR = ".changeset";
|
|
103476
|
-
function
|
|
103498
|
+
function generateChangesetFiles(artifacts, workspaceRoot) {
|
|
103477
103499
|
const changesetDir = join31(workspaceRoot, CHANGESET_DIR);
|
|
103478
103500
|
if (!fs.exists(changesetDir)) {
|
|
103479
103501
|
fs.mkdir(changesetDir, { recursive: true });
|
|
103480
103502
|
}
|
|
103481
|
-
const
|
|
103482
|
-
const
|
|
103483
|
-
|
|
103484
|
-
|
|
103485
|
-
|
|
103503
|
+
const paths = [];
|
|
103504
|
+
for (const artifact of artifacts) {
|
|
103505
|
+
const filename = `${randomBytes3(4).toString("hex")}.md`;
|
|
103506
|
+
const filepath = join31(changesetDir, filename);
|
|
103507
|
+
const content = buildChangesetContent([artifact]);
|
|
103508
|
+
fs.writeFile(filepath, content);
|
|
103509
|
+
paths.push(filepath);
|
|
103510
|
+
}
|
|
103511
|
+
return paths;
|
|
103486
103512
|
}
|
|
103487
103513
|
function buildChangesetContent(artifacts) {
|
|
103488
103514
|
const frontmatterLines = [];
|
|
@@ -103668,9 +103694,9 @@ function outputResult(artifactChangelogs, baseRef, cwd, options2) {
|
|
|
103668
103694
|
log(previewChangesetContent(artifactChangelogs));
|
|
103669
103695
|
return;
|
|
103670
103696
|
}
|
|
103671
|
-
const
|
|
103697
|
+
const paths = generateChangesetFiles(artifactChangelogs, cwd);
|
|
103672
103698
|
newline();
|
|
103673
|
-
success(`
|
|
103699
|
+
success(`Generated ${paths.length} changeset file(s)`);
|
|
103674
103700
|
}
|
|
103675
103701
|
// src/commands/workspace/workspace.ts
|
|
103676
103702
|
var listSubcommand = new Command("list").description("List all artifacts in the workspace").action(async () => {
|
|
@@ -104336,7 +104362,7 @@ var whoamiCommand = new Command("whoami").description("Show current user").actio
|
|
|
104336
104362
|
// package.json
|
|
104337
104363
|
var package_default = {
|
|
104338
104364
|
name: "@grekt/cli",
|
|
104339
|
-
version: "6.40.
|
|
104365
|
+
version: "6.40.2",
|
|
104340
104366
|
description: "AI tools versioned, synced, and shared across tools and teams",
|
|
104341
104367
|
type: "module",
|
|
104342
104368
|
bin: {
|