Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (starter): remove --no-warnings flag #435

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/angry-guests-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-electric-app": patch
---

Remove NodeJS --no-warnings flag
14 changes: 9 additions & 5 deletions examples/starter/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node --no-warnings
#!/usr/bin/env node

// Usage: npx create-electric-app my-app

Expand Down Expand Up @@ -41,10 +41,14 @@ await fs.rename(
envrcFile
)

// import package.json and deep copy it
// otherwise we can't edit it because
// the JSON object is not extensible
const projectPackageJson = (await import(path.join(projectDir, 'package.json'), { assert: { type: "json" } })).default
// read package.json file and parse it as JSON
// we could import it but then we get a warning
// that importing JSON is an experimental feature
// we can hide that warning using the --no-warnings flag
// with nodeJS but the parsing of that flag
// leads to problems on certain env implementations
const packageJsonFile = path.join(projectDir, 'package.json')
const projectPackageJson = JSON.parse(await fs.readFile(packageJsonFile, 'utf8'))

// Update the project's package.json with the new project name
projectPackageJson.name = projectName
Expand Down