Skip to content

Commit

Permalink
Forgot to rename main and update docs (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-h-a-d-o-w authored Nov 12, 2024
1 parent e6c2d89 commit 6855d08
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[![npm version](https://img.shields.io/npm/v/create-nodew-exe.svg)](https://www.npmjs.com/package/create-nodew-exe)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

# create-nodew-exe (use v1 for legacy node versions!)
# create-nodew-exe

**_Use v1 for legacy node versions!_**

Creates an executable based on node.exe that will not show
a terminal on launch (sometimes also called "silent mode").
Expand All @@ -13,20 +15,22 @@ Credit for originally discovering how to do this goes to: [@ukoloff](https://git

The conversion can be done on any platform, Windows is **not** required.

Either through the CLI:
```
yarn global add create-nodew-exe
Either through the CLI, e.g.:
```bash
pnpm add --global create-nodew-exe
create-nodew-exe <src> <dst>
```

... or locally in your project:
```bash
pnpm add -D create-nodew-exe
```
yarn add create-nodew-exe
```
```
require('create-nodew-exe')({
src: 'path/to/source',
dst: 'path/to/destination',
```ts
import { createNodewExe } from "create-nodew-exe";

createNodewExe({
src: 'path/to/source',
dst: 'path/to/destination',
});
```

Expand Down
4 changes: 2 additions & 2 deletions bin/cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { main } from "../src/main.js";
import { createNodewExe } from "../src/main.js";

const argv = yargs(hideBin(process.argv))
.usage(
Expand All @@ -19,7 +19,7 @@ const argv = yargs(hideBin(process.argv))
.parseSync();

console.log("Generating: ", argv._[1]);
main({
createNodewExe({
src: String(argv._[0]),
dst: String(argv._[1]),
});
Expand Down
4 changes: 2 additions & 2 deletions e2e/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import screenshot from "screenshot-desktop";
import { Canvas, loadImage } from "skia-canvas";
import { mkdir, unlink, writeFile } from "node:fs/promises";
import { basename } from "path";
import { main } from "../src/main.js";
import { createNodewExe } from "../src/main.js";
import { execa } from "execa";
import { execPath } from "node:process";

Expand Down Expand Up @@ -68,7 +68,7 @@ await mkdir("e2e-output");

const regularExecutable = execPath;
const silentExecutable = "bin\\testData\\nodew.exe";
main({
createNodewExe({
src: regularExecutable,
dst: silentExecutable,
});
Expand Down
6 changes: 3 additions & 3 deletions src/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// The case of successful file conversion is covered in cli.test.js
import { main } from "./main.js";
import { createNodewExe } from "./main.js";

test("input file doesn't exist", () => {
try {
main({
createNodewExe({
src: "doesntexist",
dst: "doesntmatter",
});
Expand All @@ -16,7 +16,7 @@ test("input file doesn't exist", () => {

test("input file is invalid", () => {
try {
main({
createNodewExe({
src: "./package.json",
dst: "doesntmatter",
});
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import fs from "fs";
import { toInt } from "./hex.js";

export function main({ src, dst }: { src: string; dst: string }) {
export function createNodewExe({ src, dst }: { src: string; dst: string }) {
let buffer: Buffer;
let pos = 0; // current position within buffer

Expand Down

0 comments on commit 6855d08

Please sign in to comment.