Skip to content

Commit

Permalink
Move the scripts to the "tool" folder
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Jan 22, 2024
1 parent 2fec50a commit 7e92a18
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
7 changes: 0 additions & 7 deletions scripts/Dist.hx

This file was deleted.

File renamed without changes.
6 changes: 6 additions & 0 deletions tool/dist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {shebang} from "./tools.js";

/**
* Packages the project.
*/
shebang("bin/belin_card.js");
File renamed without changes.
File renamed without changes.
12 changes: 11 additions & 1 deletion scripts/tools.js → tool/tools.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {readFileSync, readdirSync, rmSync} from "node:fs";
import {readFileSync, readdirSync, rmSync, writeFileSync} from "node:fs";
import {EOL} from "node:os";
import {join} from "node:path";

/**
Expand All @@ -17,3 +18,12 @@ export function cleanDirectory(directory) {
export function parseJson(path) {
return JSON.parse(readFileSync(new URL(path, import.meta.url), {encoding: "utf8"}));
}

/**
* Adds a shebang to the specified source file.
* @param {string} path The path to the source file.
* @param {string} executable The name of the executable to prepend.
*/
export function shebang(path, executable = "node") {
writeFileSync(path, `#!/usr/bin/env ${executable}${EOL}${readFileSync(path, {encoding: "utf8"})}`);
}

0 comments on commit 7e92a18

Please sign in to comment.