-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add package.json file generation on init (#61)
* feat: add package.json file on init * format * refactor * format * refactor the file generation * format
- Loading branch information
1 parent
6b9ea4f
commit eff8453
Showing
5 changed files
with
62 additions
and
44 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import * as path from "node:path" | ||
import { writeFileIfNotExists } from "./write-file-if-not-exists" | ||
|
||
export const generatePackageJson = (dir: string) => { | ||
const packageJsonPath = path.join(dir, "package.json") | ||
const packageJsonContent = { | ||
name: path.basename(dir), | ||
version: "1.0.0", | ||
description: "A TSCircuit project", | ||
main: "index.tsx", | ||
keywords: ["tscircuit", "electronics"], | ||
scripts: { | ||
dev: "tsci dev", | ||
build: "tsci build", | ||
}, | ||
} | ||
|
||
writeFileIfNotExists( | ||
packageJsonPath, | ||
JSON.stringify(packageJsonContent, null, 2), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters