Skip to content

Commit

Permalink
🐛 (init): Create deno.json from scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
wojpawlik committed Nov 27, 2024
1 parent d0fbe89 commit a5bdcee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"files": [
"lib/",
"tsconfig.json",
"!lib/**/*.test.*"
],
"scripts": {
Expand All @@ -27,9 +28,9 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/fromdeno/deno2node.git"
"url": "git+https://github.com/wojpawlik/deno2node.git"
},
"homepage": "https://fromdeno.org",
"homepage": "https://t.me/fromdeno",
"keywords": [
"typescript",
"transpile",
Expand Down
4 changes: 2 additions & 2 deletions src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as fs from "node:fs/promises";

const shimFile = "// See https://github.com/fromdeno/deno2node#shimming";
const gitignore = "/lib/\n/node_modules/\n/src/vendor/";
const denoJson = '{ "exclude": ["lib/"] }';

async function download(url: URL, target: string) {
const response = await fetch(url);
Expand Down Expand Up @@ -45,13 +46,12 @@ async function createPackageJson() {
}

export async function initializeProject() {
const denoJsonUrl = new URL("../deno.json", import.meta.url);
const tsconfigUrl = new URL("../tsconfig.json", import.meta.url);
await fs.mkdir("src/");
await Promise.all([
createPackageJson(),
download(denoJsonUrl, "deno.json"),
download(tsconfigUrl, "tsconfig.json"),
fs.writeFile("deno.json", denoJson, { flag: "wx" }),
fs.writeFile(".gitignore", gitignore, { flag: "wx" }),
fs.writeFile("src/shim.node.ts", shimFile, { flag: "wx" }),
]);
Expand Down

0 comments on commit a5bdcee

Please sign in to comment.