Skip to content

Commit

Permalink
Merge pull request #14 from hanabi-rest/fix-gitignore
Browse files Browse the repository at this point in the history
fix: .gitignore to gitignore
  • Loading branch information
moons-14 authored Mar 16, 2024
2 parents fee75f0 + f8da679 commit 56f4554
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-gorillas-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hanabi.rest/cli": patch
---

fix gitignore
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"files": [
"dist",
"dist/templates/**/.gitignore"
"dist/templates/**/gitignore"
],
"keywords": [
"sqlite",
Expand Down Expand Up @@ -66,4 +66,4 @@
"typescript": "^5.3.3",
"vitest": "^1.2.2"
}
}
}
36 changes: 25 additions & 11 deletions templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,29 @@ export const installTemplate = async ({

fs.mkdirSync(root, { recursive: true });

fs.copy(
path.join(path.dirname(fileURLToPath(import.meta.url)), "templates", "workers"),
root,
(err) => {
if (err) {
console.error("Failed to copy files. Please check permissions.", err);
process.exit(1);
}
const fileCopyError = (err: NodeJS.ErrnoException | null | undefined) => {
if (err) {
console.error("Failed to copy files. Please check permissions.", err);
process.exit(1);
}
}

fs.copy(
path.join(path.dirname(fileURLToPath(import.meta.url)), "templates", "workers", "wrangler.toml"),
path.join(root, "wrangler.toml"),
fileCopyError
);

fs.copy(
path.join(path.dirname(fileURLToPath(import.meta.url)), "templates", "workers", "tsconfig.json"),
path.join(root, "tsconfig.json"),
fileCopyError
);

fs.copy(
path.join(path.dirname(fileURLToPath(import.meta.url)), "templates", "workers", "gitignore"),
path.join(root, ".gitignore"),
fileCopyError
);

process.chdir(root);
Expand All @@ -61,7 +75,7 @@ export const installTemplate = async ({
deploy: "wrangler deploy --minify src/index.ts",
migrate: "wrangler d1 migrations apply my-database --local",
"migrate:prod": "wrangler d1 migrations apply my-database",
},
},
dependencies: {
hono: "^3.12.7",
},
Expand Down Expand Up @@ -89,7 +103,7 @@ export const installTemplate = async ({
console.info(`- ${chalk.cyan(dependency)}`);

console.info();

if (!skipCodePackage) {
const res = await prompts({
type: "confirm",
Expand All @@ -102,7 +116,7 @@ export const installTemplate = async ({
console.info("Skip...");
return;
}

}

await install(packageManager, skipCodePackage ? [] : dependencies);
Expand Down
File renamed without changes.

0 comments on commit 56f4554

Please sign in to comment.