mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 12:18:35 -07:00
JS: Transform SDK name for cross compatibility
This commit is contained in:
@@ -10,6 +10,9 @@ import json5 from "json5";
|
|||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
const cfwSdkName = "@next-flip/fz-sdk-mntm/";
|
||||||
|
const ofwSdkName = "@flipperdevices/fz-sdk/";
|
||||||
|
|
||||||
async function build(config) {
|
async function build(config) {
|
||||||
await esbuild.build({
|
await esbuild.build({
|
||||||
entryPoints: ["./dist/index.js"],
|
entryPoints: ["./dist/index.js"],
|
||||||
@@ -74,7 +77,8 @@ async function build(config) {
|
|||||||
let outContents = fs.readFileSync(config.output, "utf8");
|
let outContents = fs.readFileSync(config.output, "utf8");
|
||||||
outContents = "let exports = {};\n" + outContents;
|
outContents = "let exports = {};\n" + outContents;
|
||||||
|
|
||||||
// TODO: Transform CFW SDK name to OFW SDK name so all firmwares understand it
|
// Transform CFW SDK name to OFW SDK name so all firmwares understand it
|
||||||
|
outContents = outContents.replaceAll(`require("${cfwSdkName}`, `require("${ofwSdkName}`);
|
||||||
|
|
||||||
if (config.enforceSdkVersion) {
|
if (config.enforceSdkVersion) {
|
||||||
const version = json5.parse(fs.readFileSync(path.join(__dirname, "package.json"), "utf8")).version;
|
const version = json5.parse(fs.readFileSync(path.join(__dirname, "package.json"), "utf8")).version;
|
||||||
|
|||||||
Reference in New Issue
Block a user