mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Replace JSON config import
This commit is contained in:
@@ -10,7 +10,7 @@ import mustache from "mustache";
|
||||
import pkg from "pkg";
|
||||
import yargs from "yargs";
|
||||
|
||||
import config from "../config.json" assert { type: "json" };
|
||||
import config from "./lib/config.js";
|
||||
import * as paths from "./lib/paths.js";
|
||||
|
||||
const argv = await yargs()
|
||||
|
||||
35
app/bin/lib/config.js
Normal file
35
app/bin/lib/config.js
Normal file
@@ -0,0 +1,35 @@
|
||||
// @ts-check
|
||||
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import url from "url";
|
||||
|
||||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
|
||||
/**
|
||||
* @typedef {object} Config
|
||||
* @prop {string} author
|
||||
* @prop {string} homepageUrl
|
||||
* @prop {string} applicationName
|
||||
* @prop {string} applicationVersion
|
||||
* @prop {string} applicationDirectoryName
|
||||
* @prop {string} applicationExecutableName
|
||||
* @prop {string} extensionId
|
||||
*/
|
||||
|
||||
/** @type {Config} */
|
||||
//
|
||||
let config;
|
||||
|
||||
try {
|
||||
config = JSON.parse(
|
||||
fs.readFileSync(path.join(__dirname, "../../config.json"), {
|
||||
encoding: "utf-8"
|
||||
})
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("Error: Failed to load build config!", err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
export default config;
|
||||
@@ -3,7 +3,7 @@
|
||||
import path from "path";
|
||||
import url from "url";
|
||||
|
||||
import config from "../../config.json" assert { type: "json" };
|
||||
import config from "./config.js";
|
||||
|
||||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
const rootPath = path.join(__dirname, "../../../");
|
||||
|
||||
Reference in New Issue
Block a user