@benev/turtle
Advanced tools
Comparing version 0.6.0-5 to 0.6.0-6
{ | ||
"name": "@benev/turtle", | ||
"version": "0.6.0-5", | ||
"version": "0.6.0-6", | ||
"description": "static site generator", | ||
@@ -24,2 +24,4 @@ "license": "MIT", | ||
"demo": "node x/turtle.js ssg --in=s/demo,x/demo --out=x/demo --exclude=\"**/*.partial.html.js\" -v", | ||
"devlinks": "run-s devlinks-argv", | ||
"devlinks-argv": "rm -rf node_modules/@benev/argv && ln -s \"$(realpath ../argv)\" node_modules/@benev/argv", | ||
"help": "node x/turtle.js --help", | ||
@@ -29,3 +31,3 @@ "test": "cynic node x/tests.test.js" | ||
"dependencies": { | ||
"@benev/argv": "^0.3.4", | ||
"@benev/argv": "^0.3.7", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
@@ -39,3 +41,3 @@ "@rollup/plugin-terser": "^0.4.4", | ||
"importly": "^0.2.3", | ||
"rollup": "^4.18.0", | ||
"rollup": "^4.18.1", | ||
"terser": "^5.31.1", | ||
@@ -42,0 +44,0 @@ "zx": "^8.1.4" |
import {$} from "zx" | ||
import {OnDeath} from "@benev/argv" | ||
import {BuildInputs} from "../../parts/stdparams.js" | ||
export async function turtleBuildWatch({}: BuildInputs) { | ||
$.spawn("tsc", ["-w"], {stdio: "inherit"}) | ||
export async function turtleBuildWatch({}: BuildInputs, onDeath: OnDeath) { | ||
const process = $.spawn("tsc", ["-w"], {stdio: "inherit"}) | ||
onDeath(() => process.kill()) | ||
} | ||
import {OnDeath} from "@benev/argv" | ||
import {turtleCopy} from "../turtle-copy.js" | ||
@@ -9,3 +11,3 @@ import {watch} from "../../../utils/watch.js" | ||
export async function turtleSsgWatch(o: SsgInputs) { | ||
export async function turtleSsgWatch(o: SsgInputs, onDeath: OnDeath) { | ||
const {params} = o | ||
@@ -18,3 +20,3 @@ | ||
await watch(patterns, ignored, async() => { | ||
await watch(patterns, ignored, onDeath, async() => { | ||
await turtleCopy(o) | ||
@@ -21,0 +23,0 @@ await turtleScripts(o) |
#!/usr/bin/env node | ||
import {$} from "zx" | ||
import {cli, command} from "@benev/argv" | ||
import {cli, command, deathWithDignity} from "@benev/argv" | ||
import {handleZxErrors} from "./errors/handle-zx-errors.js" | ||
@@ -14,2 +14,4 @@ import {turtleCopy} from "./build/procedures/turtle-copy.js" | ||
const {onDeath} = deathWithDignity() | ||
await cli(process.argv, { | ||
@@ -58,4 +60,4 @@ name: "turtle", | ||
await Promise.all([ | ||
turtleBuildWatch(o), | ||
turtleSsgWatch(o), | ||
turtleBuildWatch(o, onDeath), | ||
turtleSsgWatch(o, onDeath), | ||
]) | ||
@@ -69,3 +71,3 @@ }, | ||
async execute(o) { | ||
await turtleBuildWatch(o) | ||
await turtleBuildWatch(o, onDeath) | ||
}, | ||
@@ -78,3 +80,3 @@ }), | ||
async execute(o) { | ||
await turtleSsgWatch(o) | ||
await turtleSsgWatch(o, onDeath) | ||
}, | ||
@@ -81,0 +83,0 @@ }), |
import chokidar from "chokidar" | ||
import {debounce} from "./debounce/debounce.js" | ||
import { OnDeath } from "@benev/argv" | ||
@@ -8,2 +9,3 @@ export async function watch( | ||
ignored: string[], | ||
onDeath: OnDeath, | ||
fn: () => Promise<void>, | ||
@@ -14,3 +16,3 @@ ) { | ||
chokidar.watch(patterns, {ignored}) | ||
const watcher = chokidar.watch(patterns, {ignored}) | ||
.on("all", debounce(500, async() => { | ||
@@ -23,3 +25,5 @@ if (!busy) { | ||
})) | ||
onDeath(() => watcher.close()) | ||
} | ||
@@ -0,2 +1,3 @@ | ||
import { OnDeath } from "@benev/argv"; | ||
import { BuildInputs } from "../../parts/stdparams.js"; | ||
export declare function turtleBuildWatch({}: BuildInputs): Promise<void>; | ||
export declare function turtleBuildWatch({}: BuildInputs, onDeath: OnDeath): Promise<void>; |
import { $ } from "zx"; | ||
export async function turtleBuildWatch({}) { | ||
$.spawn("tsc", ["-w"], { stdio: "inherit" }); | ||
export async function turtleBuildWatch({}, onDeath) { | ||
const process = $.spawn("tsc", ["-w"], { stdio: "inherit" }); | ||
onDeath(() => process.kill()); | ||
} | ||
//# sourceMappingURL=turtle-build-watch.js.map |
@@ -0,2 +1,3 @@ | ||
import { OnDeath } from "@benev/argv"; | ||
import { SsgInputs } from "../../parts/stdparams.js"; | ||
export declare function turtleSsgWatch(o: SsgInputs): Promise<void>; | ||
export declare function turtleSsgWatch(o: SsgInputs, onDeath: OnDeath): Promise<void>; |
@@ -6,3 +6,3 @@ import { turtleCopy } from "../turtle-copy.js"; | ||
import { turtleScripts } from "../turtle-scripts.js"; | ||
export async function turtleSsgWatch(o) { | ||
export async function turtleSsgWatch(o, onDeath) { | ||
const { params } = o; | ||
@@ -13,3 +13,3 @@ const ignored = stdignore([]); | ||
.map(dir => `${dir}/**/*.{js,json,css}`); | ||
await watch(patterns, ignored, async () => { | ||
await watch(patterns, ignored, onDeath, async () => { | ||
await turtleCopy(o); | ||
@@ -16,0 +16,0 @@ await turtleScripts(o); |
#!/usr/bin/env node | ||
import { $ } from "zx"; | ||
import { cli, command } from "@benev/argv"; | ||
import { cli, command, deathWithDignity } from "@benev/argv"; | ||
import { handleZxErrors } from "./errors/handle-zx-errors.js"; | ||
@@ -12,2 +12,3 @@ import { turtleCopy } from "./build/procedures/turtle-copy.js"; | ||
import { turtleBuildWatch } from "./build/procedures/watches/turtle-build-watch.js"; | ||
const { onDeath } = deathWithDignity(); | ||
await cli(process.argv, { | ||
@@ -53,4 +54,4 @@ name: "turtle", | ||
await Promise.all([ | ||
turtleBuildWatch(o), | ||
turtleSsgWatch(o), | ||
turtleBuildWatch(o, onDeath), | ||
turtleSsgWatch(o, onDeath), | ||
]); | ||
@@ -63,3 +64,3 @@ }, | ||
async execute(o) { | ||
await turtleBuildWatch(o); | ||
await turtleBuildWatch(o, onDeath); | ||
}, | ||
@@ -71,3 +72,3 @@ }), | ||
async execute(o) { | ||
await turtleSsgWatch(o); | ||
await turtleSsgWatch(o, onDeath); | ||
}, | ||
@@ -74,0 +75,0 @@ }), |
@@ -1,1 +0,2 @@ | ||
export declare function watch(patterns: string[], ignored: string[], fn: () => Promise<void>): Promise<void>; | ||
import { OnDeath } from "@benev/argv"; | ||
export declare function watch(patterns: string[], ignored: string[], onDeath: OnDeath, fn: () => Promise<void>): Promise<void>; |
import chokidar from "chokidar"; | ||
import { debounce } from "./debounce/debounce.js"; | ||
export async function watch(patterns, ignored, fn) { | ||
export async function watch(patterns, ignored, onDeath, fn) { | ||
let busy = false; | ||
chokidar.watch(patterns, { ignored }) | ||
const watcher = chokidar.watch(patterns, { ignored }) | ||
.on("all", debounce(500, async () => { | ||
@@ -13,3 +13,4 @@ if (!busy) { | ||
})); | ||
onDeath(() => watcher.close()); | ||
} | ||
//# sourceMappingURL=watch.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
161345
2942
Updated@benev/argv@^0.3.7
Updatedrollup@^4.18.1