Skip to content

Commit

Permalink
fix(cli): replace "workspace:*" to "latest"
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Jul 21, 2024
1 parent 30b6aa4 commit 8e1cc38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-months-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@steinjs/cli": patch
---

Replace "Workspace:\*" to "latest" when cloning examples.
11 changes: 11 additions & 0 deletions packages/cli/src/modules/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ const setupWizard = async (templateLink: string): Promise<void> => {
const projectDirectory = await cloneTemplate(name, templateLink);
await updatePackageJSON(projectDirectory, async (pkg) => {
pkg.name = name;

for (const key of ['devDependencies', 'dependencies']) {
if (!pkg[key]) continue;

// Replace all "workspace:*" to "latest".
for (const [packageName, version] of Object.entries(pkg[key])) {
if (version === "workspace:*") {
pkg[key][packageName] = "latest";
}
}
}
});

if (!typeScriptEnabled) {
Expand Down

0 comments on commit 8e1cc38

Please sign in to comment.