@benev/turtle
Advanced tools
Comparing version 0.1.2 to 0.2.0
{ | ||
"name": "@benev/turtle", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "static site generator", | ||
@@ -21,3 +21,3 @@ "license": "MIT", | ||
"watch": "tsc -w", | ||
"demo": "node x/cli.js --in s/demo:x/demo --out x/demo --excludes **/*.partial.html.js +verbose", | ||
"demo": "node x/cli.js --in s/demo:x/demo --out x/demo --exclude **/*.partial.html.js +verbose", | ||
"help": "node x/cli.js +help", | ||
@@ -30,3 +30,2 @@ "test": "cynic node x/tests.test.js" | ||
"glob": "^10.2.6", | ||
"globby": "^13.1.3", | ||
"shelljs": "^0.8.5" | ||
@@ -33,0 +32,0 @@ }, |
@@ -37,3 +37,3 @@ | ||
![image: turtle help page](https://i.imgur.com/zT8mtFO.png) | ||
![image: turtle help page](https://i.imgur.com/Zpf4Iqk.png) | ||
@@ -150,6 +150,1 @@ <br/> | ||
<br/> | ||
### i'm thinking of adding more turtle functionality later.. | ||
- some smart way to add custom build scripts that can, like, build a whole directory of yamls or markdowns or whatever, and generate a ton of pages (as opposed to being limited to just one `.html.js` per generated page) | ||
@@ -10,3 +10,3 @@ | ||
context, | ||
excludes, | ||
exclude, | ||
output_directory, | ||
@@ -19,3 +19,3 @@ input_directories, | ||
context: xContext | ||
excludes: string[] | ||
exclude: string[] | ||
output_directory: string | ||
@@ -28,3 +28,3 @@ input_directories: string[] | ||
input_directories, | ||
excludes, | ||
exclude, | ||
"**/*.turtle.js", | ||
@@ -34,3 +34,3 @@ ), | ||
input_directories, | ||
[...excludes, "**/*.{ts,html.js,turtle.js}"], | ||
[...exclude, "**/*.{ts,html.js,turtle.js}"], | ||
"**/*", | ||
@@ -40,3 +40,3 @@ ), | ||
input_directories, | ||
excludes, | ||
exclude, | ||
"**/*.html.js", | ||
@@ -43,0 +43,0 @@ ), |
@@ -7,2 +7,3 @@ | ||
export function make_template_basics({ | ||
destination, | ||
template_path, | ||
@@ -12,2 +13,3 @@ input_directory, | ||
}: { | ||
destination: string | ||
template_path: string | ||
@@ -18,3 +20,3 @@ input_directory: string | ||
let base = relative(dirname(template_path), input_directory) | ||
let base = relative(dirname(destination), "") | ||
@@ -21,0 +23,0 @@ base = base === "" |
@@ -31,2 +31,3 @@ | ||
const basics = make_template_basics({ | ||
destination, | ||
template_path, | ||
@@ -33,0 +34,0 @@ output_directory, |
@@ -7,2 +7,3 @@ | ||
import {OutputLogger, TurtleScriptLogger} from "../types/loggers.js" | ||
import { dirname } from "path" | ||
@@ -37,4 +38,6 @@ export async function run_all_turtle_scripts( | ||
const script = await import(path.absolute) | ||
const script_directory = dirname(path.partial) | ||
const meta: ScriptMeta = { | ||
path, | ||
script_directory, | ||
on_file_written, | ||
@@ -41,0 +44,0 @@ output_directory, |
@@ -8,2 +8,3 @@ | ||
path: Path | ||
script_directory: string | ||
output_directory: string | ||
@@ -10,0 +11,0 @@ on_file_written: OutputLogger |
@@ -15,3 +15,3 @@ #!/usr/bin/env node | ||
out: string | ||
excludes: string | ||
exclude: string | ||
verbose: boolean | ||
@@ -46,3 +46,3 @@ } | ||
}, | ||
excludes: { | ||
exclude: { | ||
type: String, | ||
@@ -93,5 +93,5 @@ mode: "option", | ||
output_directory: params.out, | ||
excludes: params.excludes?.split(":") ?? [], | ||
exclude: params.exclude?.split(":") ?? [], | ||
...loggers, | ||
}) | ||
import {webpage, html} from "../../index.js" | ||
export default webpage<{x: number}>(async({v}, {x}) => html` | ||
export default webpage<{x: number}>(async({v, base}, {x}) => html` | ||
@@ -11,3 +11,3 @@ <!doctype html> | ||
<title>@benev/turtle - stamp test</title> | ||
<link rel="stylesheet" href="${v("/style.css")}"/> | ||
<link rel="stylesheet" href="${v(`${base}/style.css`)}"/> | ||
</head> | ||
@@ -14,0 +14,0 @@ <body> |
@@ -26,3 +26,3 @@ | ||
// to this build script | ||
destination: `${x}.html`, | ||
destination: `lol/${x}.html`, | ||
}) | ||
@@ -29,0 +29,0 @@ })) |
@@ -8,3 +8,3 @@ | ||
directories: string[], | ||
excludes: string[], | ||
exclude: string[], | ||
pattern: string, | ||
@@ -16,3 +16,3 @@ ) { | ||
const fullpattern = directory + "/" + pattern | ||
const ignore = excludes.map(exclude => join(directory, exclude)) | ||
const ignore = exclude.map(exclude => join(directory, exclude)) | ||
const full_paths = await glob(fullpattern, {ignore, nodir: true}) | ||
@@ -19,0 +19,0 @@ return full_paths.map(relative => ({ |
@@ -21,3 +21,3 @@ | ||
lines.push(color.red(error.name)) | ||
lines.push(color.red(error.name) + " " + color.yellow(error.message)) | ||
@@ -28,6 +28,6 @@ { | ||
if (activity) | ||
origin += color.blue(activity) + " " | ||
origin += color.magenta("while " + activity) + " " | ||
if (path) | ||
origin += color.magenta(path) | ||
origin += color.cyan(path) | ||
@@ -38,5 +38,14 @@ if (origin.length) | ||
lines.push(indent(" ", 1, color.yellow(error.message))) | ||
if (error.stack) | ||
lines.push( | ||
...error.stack | ||
.split("\n") | ||
.slice(1) | ||
.map(line => line.trim()) | ||
.map(line => color.red(line)) | ||
.map(line => indent(" ", 1, line.trim())) | ||
) | ||
return lines.join("\n") | ||
} | ||
import { WebsiteLoggers } from "./types/loggers.js"; | ||
export declare function build_website<xContext extends {}>({ context, excludes, output_directory, input_directories, on_file_copied, on_file_written, on_turtle_script_executed, }: { | ||
export declare function build_website<xContext extends {}>({ context, exclude, output_directory, input_directories, on_file_copied, on_file_written, on_turtle_script_executed, }: { | ||
context: xContext; | ||
excludes: string[]; | ||
exclude: string[]; | ||
output_directory: string; | ||
input_directories: string[]; | ||
} & WebsiteLoggers): Promise<void>; |
@@ -5,7 +5,7 @@ import { find_files } from "../utils/find_files.js"; | ||
import { run_all_turtle_scripts } from "./routines/run_all_turtle_scripts.js"; | ||
export async function build_website({ context, excludes, output_directory, input_directories, on_file_copied = () => { }, on_file_written = () => { }, on_turtle_script_executed = () => { }, }) { | ||
export async function build_website({ context, exclude, output_directory, input_directories, on_file_copied = () => { }, on_file_written = () => { }, on_turtle_script_executed = () => { }, }) { | ||
const paths = { | ||
turtle_scripts: await find_files(input_directories, excludes, "**/*.turtle.js"), | ||
copyables: await find_files(input_directories, [...excludes, "**/*.{ts,html.js,turtle.js}"], "**/*"), | ||
templates: await find_files(input_directories, excludes, "**/*.html.js"), | ||
turtle_scripts: await find_files(input_directories, exclude, "**/*.turtle.js"), | ||
copyables: await find_files(input_directories, [...exclude, "**/*.{ts,html.js,turtle.js}"], "**/*"), | ||
templates: await find_files(input_directories, exclude, "**/*.html.js"), | ||
}; | ||
@@ -12,0 +12,0 @@ await copy_all_files(paths.copyables, output_directory, on_file_copied); |
import { TemplateBasics } from "../types/template_basics.js"; | ||
export declare function make_template_basics({ template_path, input_directory, output_directory, }: { | ||
export declare function make_template_basics({ destination, template_path, input_directory, output_directory, }: { | ||
destination: string; | ||
template_path: string; | ||
@@ -4,0 +5,0 @@ input_directory: string; |
import { dirname, relative, resolve } from "path"; | ||
import { make_hash_versioner } from "../../utils/hash_versioner.js"; | ||
export function make_template_basics({ template_path, input_directory, output_directory, }) { | ||
let base = relative(dirname(template_path), input_directory); | ||
export function make_template_basics({ destination, template_path, input_directory, output_directory, }) { | ||
let base = relative(dirname(destination), ""); | ||
base = base === "" | ||
@@ -6,0 +6,0 @@ ? "." |
@@ -9,2 +9,3 @@ import { join, resolve } from "path"; | ||
const basics = make_template_basics({ | ||
destination, | ||
template_path, | ||
@@ -11,0 +12,0 @@ output_directory, |
import { log_error } from "../../utils/log_error.js"; | ||
import { write_webpage } from "../parts/write_webpage.js"; | ||
import { dirname } from "path"; | ||
export async function run_all_turtle_scripts(paths, output_directory, on_file_written, on_turtle_script_executed) { | ||
@@ -22,4 +23,6 @@ const handy_write_webpage = (path) => (async ({ template, context, destination }) => { | ||
const script = await import(path.absolute); | ||
const script_directory = dirname(path.partial); | ||
const meta = { | ||
path, | ||
script_directory, | ||
on_file_written, | ||
@@ -26,0 +29,0 @@ output_directory, |
@@ -6,2 +6,3 @@ import { Path } from "../../utils/path.js"; | ||
path: Path; | ||
script_directory: string; | ||
output_directory: string; | ||
@@ -8,0 +9,0 @@ on_file_written: OutputLogger; |
@@ -6,4 +6,4 @@ #!/usr/bin/env node | ||
out: string; | ||
excludes: string; | ||
exclude: string; | ||
verbose: boolean; | ||
}; |
@@ -31,3 +31,3 @@ #!/usr/bin/env node | ||
}, | ||
excludes: { | ||
exclude: { | ||
type: String, | ||
@@ -73,5 +73,5 @@ mode: "option", | ||
output_directory: params.out, | ||
excludes: (_c = (_b = params.excludes) === null || _b === void 0 ? void 0 : _b.split(":")) !== null && _c !== void 0 ? _c : [], | ||
exclude: (_c = (_b = params.exclude) === null || _b === void 0 ? void 0 : _b.split(":")) !== null && _c !== void 0 ? _c : [], | ||
...loggers, | ||
}); | ||
//# sourceMappingURL=cli.js.map |
import { webpage, html } from "../../index.js"; | ||
export default webpage(async ({ v }, { x }) => html ` | ||
export default webpage(async ({ v, base }, { x }) => html ` | ||
@@ -9,3 +9,3 @@ <!doctype html> | ||
<title>@benev/turtle - stamp test</title> | ||
<link rel="stylesheet" href="${v("/style.css")}"/> | ||
<link rel="stylesheet" href="${v(`${base}/style.css`)}"/> | ||
</head> | ||
@@ -12,0 +12,0 @@ <body> |
@@ -17,3 +17,3 @@ import { turtle_script } from "../../build/turtle_script.js"; | ||
// to this build script | ||
destination: `${x}.html`, | ||
destination: `lol/${x}.html`, | ||
}); | ||
@@ -20,0 +20,0 @@ })); |
@@ -1,2 +0,2 @@ | ||
export declare function find_files(directories: string[], excludes: string[], pattern: string): Promise<{ | ||
export declare function find_files(directories: string[], exclude: string[], pattern: string): Promise<{ | ||
relative: string; | ||
@@ -3,0 +3,0 @@ directory: string; |
import { glob } from "glob"; | ||
import { join, resolve } from "path"; | ||
import { debase_path } from "../build/parts/debase_path.js"; | ||
export async function find_files(directories, excludes, pattern) { | ||
export async function find_files(directories, exclude, pattern) { | ||
return (await Promise.all(directories.map(async (directory) => { | ||
const fullpattern = directory + "/" + pattern; | ||
const ignore = excludes.map(exclude => join(directory, exclude)); | ||
const ignore = exclude.map(exclude => join(directory, exclude)); | ||
const full_paths = await glob(fullpattern, { ignore, nodir: true }); | ||
@@ -9,0 +9,0 @@ return full_paths.map(relative => ({ |
@@ -12,15 +12,21 @@ import { color } from "@benev/argv"; | ||
const lines = []; | ||
lines.push(color.red(error.name)); | ||
lines.push(color.red(error.name) + " " + color.yellow(error.message)); | ||
{ | ||
let origin = ""; | ||
if (activity) | ||
origin += color.blue(activity) + " "; | ||
origin += color.magenta("while " + activity) + " "; | ||
if (path) | ||
origin += color.magenta(path); | ||
origin += color.cyan(path); | ||
if (origin.length) | ||
lines.push(indent(" ", 1, origin)); | ||
} | ||
lines.push(indent(" ", 1, color.yellow(error.message))); | ||
if (error.stack) | ||
lines.push(...error.stack | ||
.split("\n") | ||
.slice(1) | ||
.map(line => line.trim()) | ||
.map(line => color.red(line)) | ||
.map(line => indent(" ", 1, line.trim()))); | ||
return lines.join("\n"); | ||
} | ||
//# sourceMappingURL=log_error.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
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
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
99823
4
1843
149
- Removedglobby@^13.1.3
- Removed@nodelib/fs.scandir@2.1.5(transitive)
- Removed@nodelib/fs.stat@2.0.5(transitive)
- Removed@nodelib/fs.walk@1.2.8(transitive)
- Removedbraces@3.0.3(transitive)
- Removeddir-glob@3.0.1(transitive)
- Removedfast-glob@3.3.2(transitive)
- Removedfastq@1.17.1(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedglobby@13.2.2(transitive)
- Removedignore@5.3.2(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-glob@4.0.3(transitive)
- Removedis-number@7.0.0(transitive)
- Removedmerge2@1.4.1(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedpath-type@4.0.0(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedqueue-microtask@1.2.3(transitive)
- Removedreusify@1.0.4(transitive)
- Removedrun-parallel@1.2.0(transitive)
- Removedslash@4.0.0(transitive)
- Removedto-regex-range@5.0.1(transitive)