Skip to content

Commit

Permalink
fix: issues with cli reading from package.json (#981)
Browse files Browse the repository at this point in the history
fix for #978 (comment)

Also fixed an issue where the default folder name was not showing on
conflict

---------

Co-authored-by: Tyler <[email protected]>
  • Loading branch information
tylersayshi and Tyler authored Oct 21, 2024
1 parent b6bced7 commit 82dea92
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/create-waku/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,12 @@ async function doPrompts() {
type: 'text',
message: 'Project Name',
initial: defaultProjectName,
onState: (state: any) =>
(targetDir = String(state.value).trim() || defaultProjectName),
onState: (state: any) => (targetDir = String(state.value).trim()),
},
{
name: 'shouldOverwrite',
type: () => (canSafelyOverwrite(targetDir) ? null : 'confirm'),
message: `${targetDir} is not empty. Remove existing files and continue?`,
message: `${targetDir || defaultProjectName} is not empty. Remove existing files and continue?`,
},
{
name: 'overwriteChecker',
Expand Down Expand Up @@ -161,7 +160,9 @@ Options:
}

async function notifyUpdate() {
const packageJson = JSON.parse(readFileSync('../package.json', 'utf8'));
const packageJson = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
);
const result = await checkForUpdate(packageJson).catch(() => {});
if (result?.latest) {
console.log(`A new version of 'create-waku' is available!`);
Expand Down

0 comments on commit 82dea92

Please sign in to comment.