From f9e8aa8b038b769c590105b133e5d9a4f8eeb732 Mon Sep 17 00:00:00 2001 From: Adam Josefus <1031370+adamjosefus@users.noreply.github.com> Date: Sat, 11 Dec 2021 22:34:22 +0100 Subject: [PATCH 1/3] Create bundle.ts --- bin/bundle.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 bin/bundle.ts diff --git a/bin/bundle.ts b/bin/bundle.ts new file mode 100644 index 0000000..8f00b5c --- /dev/null +++ b/bin/bundle.ts @@ -0,0 +1,29 @@ +import { join } from "https://deno.land/std@0.117.0/path/mod.ts"; + + +const name = 'pkg.bundled.js'; +const path = join(Deno.cwd(), name); + +const cmd = [ + `deno`, + `bundle`, + `./main.ts`, + `./${name}` +]; + +console.log("\n"); +console.log(`Bundle to %c${path}`, "font-weight: bold;"); +console.log(`%c> ${cmd.join(' ')}`, "color: grey"); + +const process = await Deno.run({ + cmd: cmd, + stdout: 'piped', + stderr: 'piped', +}) + +const { success } = await process.status(); + +if (success) console.log(`%c> Succeed`, "color: grey"); +else console.log(`%c> Failed`, "color: grey"); + +console.log("\n"); \ No newline at end of file From 91d6612a75a8ee058563497b04bdf0786c01c8ca Mon Sep 17 00:00:00 2001 From: Adam Josefus <1031370+adamjosefus@users.noreply.github.com> Date: Sat, 11 Dec 2021 22:34:24 +0100 Subject: [PATCH 2/3] Create .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7cccc83 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +pkg.macos +pkg.exe +pkg.linux +pkg.bundled.js \ No newline at end of file From 220636ef41aac364a263cec765522c929b22a9d7 Mon Sep 17 00:00:00 2001 From: Adam Josefus <1031370+adamjosefus@users.noreply.github.com> Date: Sat, 11 Dec 2021 22:34:26 +0100 Subject: [PATCH 3/3] Update README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 7c18407..c299699 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,17 @@ deno run -A ./bin/compile.ts Compile to /some/path/pkg/pkg.macos > deno --unstable compile --output=pkg.macos --allow-all ./main.ts > Succeed +``` + + + +## Bundle to jednoho javavascript souboru + +```bash +deno run -A ./bin/bundle.ts.ts +``` +```bash +Bundle to /some/path/pkg/pkg.bundled.js +> deno bundle ./main.ts ./pkg.bundled.js +> Succeed ``` \ No newline at end of file