-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from ndxbn/development
- Loading branch information
Showing
4 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
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,11 @@ | ||
## Need Conventional Commit | ||
see https://conventionalcommits.org/ | ||
|
||
feat: A new feature | ||
fix: A bug fix | ||
docs: Documentation only changes | ||
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) | ||
refactor: A code change that neither fixes a bug nor adds a feature | ||
perf: A code change that improves performance | ||
test: Adding missing or correcting existing tests | ||
chore: Changes to the build process or auxiliary tools and libraries such as documentation generation |
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 |
---|---|---|
@@ -1,6 +1,33 @@ | ||
import { $ } from "bun"; | ||
import type { PackageJson } from "type-fest"; | ||
import packageJson from "../package.json" with { type: "json" }; | ||
|
||
if (process.env.NODE_ENV === "development") { | ||
await Promise.all([$`bunx lefthook install`]); | ||
console.log("To get started developing: edit src/server.ts and `bun start`"); | ||
if (process.env.NODE_ENV !== "development") { | ||
console.error("NODE_ENV is not development."); | ||
process.exit(1); | ||
} | ||
|
||
await Promise.all([ | ||
$`bunx lefthook install`, | ||
$`git config commit.template .gitmessage.txt`, | ||
]); | ||
// main tasks | ||
const repoName: string | undefined = new URL(import.meta.url).href | ||
.split("/") | ||
// [..., -3: project root dir, -2: "scripts", -1: "dev.ts"] | ||
.at(-3); | ||
if (repoName == null) { | ||
throw new Error("cannot get cwd name"); | ||
} | ||
|
||
const newPackageJson: PackageJson = {}; | ||
// name | ||
if (packageJson.name == null || packageJson.name === "<default>") { | ||
newPackageJson.name = repoName; | ||
} | ||
|
||
await $`bun fmt`; | ||
await $`git add .`; | ||
await $`git commit --amend-m "Initial commit (via bun create)"`; | ||
|
||
console.log("To get started developing: edit src/server.ts and `bun start`"); |