Initial JS CFW SDK changes

TODO: Check documentation and other package options

TODO: Transform CFW SDK name to OFW SDK name in build step so all firmwares understand it
This commit is contained in:
Willy-JL
2024-11-01 13:57:28 +00:00
parent 2dd9b848c2
commit bbe69e77c3
10 changed files with 18 additions and 16 deletions

View File

@@ -5,7 +5,7 @@ applications in JavaScript.
## Getting started
Create your application using the interactive wizard:
```shell
npx @flipperdevices/create-fz-app@latest
npx @next-flip/create-fz-app-mntm@latest
```
Then, enter the directory with your application and launch it:

View File

@@ -26,7 +26,7 @@ export declare function getBatteryCharge(): number;
* @warning Do **NOT** use this to check the presence or absence of features. If
* you do, I'm gonna be sad :( Instead, refer to `checkSdkFeatures` and
* other similar mechanisms.
* @note Original firmware reports `"flipperdevices"`.
* @note Momentum firmware reports `"momentum"`.
* @version Added in JS SDK 0.1
*/
export declare const firmwareVendor: string;

View File

@@ -1,5 +1,5 @@
{
"name": "@flipperdevices/fz-sdk",
"name": "@next-flip/fz-sdk-mntm",
"version": "0.1.1",
"description": "Type declarations and documentation for native JS modules available on Flipper Zero",
"keywords": [
@@ -11,7 +11,7 @@
"license": "GPL-3.0-only",
"repository": {
"type": "git",
"url": "git+https://github.com/flipperdevices/flipperzero-firmware.git",
"url": "git+https://github.com/Next-Flip/Momentum-Firmware.git",
"directory": "applications/system/js_app/packages/fz-sdk"
},
"type": "module",

View File

@@ -19,7 +19,7 @@ async function build(config) {
bundle: true,
minify: config.minify,
external: [
"@flipperdevices/fz-sdk/*"
"@next-flip/fz-sdk-mntm/*"
],
supported: {
"array-spread": false,
@@ -74,6 +74,8 @@ async function build(config) {
let outContents = fs.readFileSync(config.output, "utf8");
outContents = "let exports = {};\n" + outContents;
// TODO: Transform CFW SDK name to OFW SDK name so all firmwares understand it
if (config.enforceSdkVersion) {
const version = json5.parse(fs.readFileSync(path.join(__dirname, "package.json"), "utf8")).version;
let [major, minor, _] = version.split(".");