🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@fedify/init

Package Overview
Dependencies
Maintainers
1
Versions
233
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fedify/init - npm Package Compare versions

Comparing version
2.1.0-dev.408
to
2.1.0-dev.411
+74
-11
dist/action/configs.js

@@ -8,2 +8,4 @@ import { merge } from "../utils.js";

import { uniq } from "es-toolkit";
import { execFileSync } from "node:child_process";
import { getLogger } from "@logtape/logtape";
import { realpathSync } from "node:fs";

@@ -14,2 +16,8 @@ import { join, relative } from "node:path";

//#region src/action/configs.ts
const logger = getLogger([
"fedify",
"init",
"action",
"configs"
]);
/**

@@ -22,14 +30,69 @@ * Loads Deno configuration object with compiler options, unstable features, and tasks.

*/
const loadDenoConfig = (data) => ({
path: "deno.json",
data: {
...pick(["compilerOptions", "tasks"], data.initializer),
unstable: getUnstable(data),
nodeModulesDir: "auto",
imports: joinDepsReg("deno")(getDependencies(data)),
lint: { plugins: ["jsr:@fedify/lint"] },
...data.testMode ? { links: getLinks(data) } : {}
const loadDenoConfig = (data) => {
const unstable = getUnstable(data);
return {
path: "deno.json",
data: {
...pick(["compilerOptions", "tasks"], data.initializer),
...unstable.length > 0 ? { unstable } : {},
nodeModulesDir: "auto",
imports: joinDepsReg("deno")(getDependencies(data)),
lint: { plugins: ["jsr:@fedify/lint"] },
...data.testMode ? { links: getLinks(data) } : {}
}
};
};
const getUnstable = ({ kv: { denoUnstable: kv = [] }, mq: { denoUnstable: mq = [] } }) => pipe(needsUnstableTemporal() ? ["temporal"] : [], concat(kv), concat(mq), toArray, uniq);
const TEMPORAL_STABLE_FROM = [
2,
7,
0
];
const needsUnstableTemporal = () => {
const version = getInstalledDenoVersion();
if (version == null) return true;
return compareVersions(version, TEMPORAL_STABLE_FROM) < 0;
};
const getInstalledDenoVersion = () => {
const deno = getDenoVersionFromRuntime();
if (deno != null) return deno;
try {
const output = execFileSync("deno", ["--version"], {
encoding: "utf8",
stdio: [
"ignore",
"pipe",
"ignore"
]
});
const version = output.match(/^deno\s+(\d+)\.(\d+)\.(\d+)/m);
if (version == null) return null;
return [
Number(version[1]),
Number(version[2]),
Number(version[3])
];
} catch (error) {
logger.debug("Failed to get Deno version by executing `deno --version`: {error}", { error });
return null;
}
});
const getUnstable = ({ kv: { denoUnstable: kv = [] }, mq: { denoUnstable: mq = [] } }) => pipe(["temporal"], concat(kv), concat(mq), toArray, uniq);
};
const getDenoVersionFromRuntime = () => {
const deno = globalThis.Deno?.version?.deno;
if (deno == null) return null;
const version = deno.match(/^(\d+)\.(\d+)\.(\d+)/);
if (version == null) return null;
return [
Number(version[1]),
Number(version[2]),
Number(version[3])
];
};
const compareVersions = (a, b) => {
for (let i = 0; i < a.length; i++) {
if (a[i] < b[i]) return -1;
if (a[i] > b[i]) return 1;
}
return 0;
};
const getLinks = ({ kv, mq, initializer, dir }) => pipe({ "@fedify/fedify": "" }, merge(initializer.dependencies), merge(kv.dependencies), merge(mq.dependencies), keys, filter((dep) => dep.includes("@fedify/")), map((dep) => dep.replace("@fedify/", "")), map((dep) => join(PACKAGES_PATH, dep)), map((absolutePath) => realpathSync(absolutePath)), map((realAbsolutePath) => relative(realpathSync(dir), realAbsolutePath)), toArray);

@@ -36,0 +99,0 @@ /**

+1
-1
//#region deno.json
var name = "@fedify/init";
var version = "2.1.0-dev.408+5c3c9d78";
var version = "2.1.0-dev.411+13731841";
var license = "MIT";

@@ -5,0 +5,0 @@ var exports = "./src/mod.ts";

{
"name": "@fedify/init",
"version": "2.1.0-dev.408+5c3c9d78",
"version": "2.1.0-dev.411+13731841",
"description": "Project initializer for Fedify",

@@ -5,0 +5,0 @@ "keywords": [