Skip to content

Commit

Permalink
Merge pull request #22 from ndxbn/development
Browse files Browse the repository at this point in the history
  • Loading branch information
ndxbn authored Nov 4, 2024
2 parents 426c6fc + e5fe73c commit 5ea62c8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
11 changes: 11 additions & 0 deletions .gitmessage.txt
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
Binary file modified bun.lockb
Binary file not shown.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"name": "bun",
"name": "<default>",
"version": "0.0.0",
"type": "module",
"main": "index.js",
Expand All @@ -13,7 +13,8 @@
"@types/bun": "latest",
"lefthook": "1.8.2",
"textlint": "14.3.0",
"textlint-rule-preset-ja-technical-writing": "10.0.1"
"textlint-rule-preset-ja-technical-writing": "10.0.1",
"type-fest": "^4.26.1"
},
"peerDependencies": {
"typescript": "5.6.3"
Expand Down
33 changes: 30 additions & 3 deletions scripts/dev.ts
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`");

0 comments on commit 5ea62c8

Please sign in to comment.