Skip to content

Commit

Permalink
Merge pull request #18 from FriendsOfREDAXO/schuer-update-deno
Browse files Browse the repository at this point in the history
Build: update Deno packages and scripts
  • Loading branch information
schuer authored Sep 22, 2024
2 parents 5f51fd7 + 45bba07 commit 0667154
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 111 deletions.
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"imports": {
"std/": "https://deno.land/std@0.217.0/"
"@std/fs": "jsr:@std/fs@^1.0.3",
"@std/yaml": "jsr:@std/yaml@^1.0.5"
},
"tasks": {
"lint": "deno lint",
Expand Down
128 changes: 27 additions & 101 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions scripts/generate-image-files.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import { isArray, isObject } from "std/yaml/_utils.ts";
import { parse, stringify } from "std/yaml/mod.ts";
import { emptyDirSync, ensureDirSync, copySync } from "std/fs/mod.ts";
import { parse, stringify } from "@std/yaml";
import { emptyDirSync, ensureDirSync, copySync } from "@std/fs";

const sourceDirectory = 'source';
const imagesDirectory = 'images';

/**
* Prepare image configuration
*/
const imageConfiguration = parse(Deno.readTextFileSync(`${sourceDirectory}/images.yml`));
const imageConfiguration = parse(Deno.readTextFileSync(`${sourceDirectory}/images.yml`)) as { images: [] };

if (!isObject(imageConfiguration)) {
if (imageConfiguration === null && typeof imageConfiguration !== "object") {
console.error("Invalid image configuration!");
Deno.exit(1);
}

const images = imageConfiguration["images"];

if (!isArray(images)) {
if (!Array.isArray(images)) {
console.error("Invalid images array!");
Deno.exit(1);
}
Expand Down

0 comments on commit 0667154

Please sign in to comment.