@screenly/edge-apps 0.0.16 → 0.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/dist/utils/buffer-shim.d.ts +2 -0
- package/dist/utils/buffer-shim.d.ts.map +1 -0
- package/dist/utils/buffer-shim.js +21 -0
- package/dist/utils/error-handling.d.ts +1 -4
- package/dist/utils/error-handling.d.ts.map +1 -1
- package/dist/utils/error-handling.js +2 -4
- package/package.json +3 -2
- package/scripts/cli.ts +11 -3
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @screenly/edge-apps
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@screenly/edge-apps)
|
|
4
|
+
|
|
3
5
|
A TypeScript library for interfacing with the Screenly Edge Apps API.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
@@ -68,7 +70,13 @@ signalReady()
|
|
|
68
70
|
### Metadata
|
|
69
71
|
|
|
70
72
|
- `getMetadata()` - Get all screen metadata
|
|
71
|
-
- `getScreenName()
|
|
73
|
+
- `getScreenName()`
|
|
74
|
+
- `getHostname()`
|
|
75
|
+
- `getLocation()`
|
|
76
|
+
- `getScreenlyVersion()`
|
|
77
|
+
- `getTags()`
|
|
78
|
+
- `hasTag(tag)`
|
|
79
|
+
- `getFormattedCoordinates()`
|
|
72
80
|
- `getHardware()` - Get hardware type as `Hardware` enum (`Anywhere`, `RaspberryPi`, or `ScreenlyPlayerMax`)
|
|
73
81
|
|
|
74
82
|
### Location & Localization
|
|
@@ -87,6 +95,10 @@ signalReady()
|
|
|
87
95
|
- `addUTMParams(url, params?)` - Add UTM parameters to URL
|
|
88
96
|
- `addUTMParamsIf(url, enabled, params?)` - Conditionally add UTM parameters
|
|
89
97
|
|
|
98
|
+
## Web Components
|
|
99
|
+
|
|
100
|
+
This library includes reusable web components for building consistent Edge Apps. See the [components documentation](https://github.com/Screenly/edge-apps-library/blob/master/docs/components.md) for usage details.
|
|
101
|
+
|
|
90
102
|
## Edge Apps Scripts CLI
|
|
91
103
|
|
|
92
104
|
This package provides the `edge-apps-scripts` CLI tool for running shared development commands across all Edge Apps. It includes centralized ESLint configuration to avoid duplication.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-shim.d.ts","sourceRoot":"","sources":["../../src/utils/buffer-shim.ts"],"names":[],"mappings":"AAIA,wBAAgB,iBAAiB,IAAI,IAAI,CAyBxC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Minimal Buffer shim for browser environments. Required because panic-overlay →
|
|
2
|
+
// stacktracey → get-source → data-uri-to-buffer (v2) uses Node's Buffer API, which
|
|
3
|
+
// doesn't exist in browsers. This can be removed once get-source ships a version
|
|
4
|
+
// that depends on data-uri-to-buffer v4+, which uses Uint8Array instead.
|
|
5
|
+
export function installBufferShim() {
|
|
6
|
+
if (typeof globalThis.Buffer !== 'undefined')
|
|
7
|
+
return;
|
|
8
|
+
globalThis.Buffer = {
|
|
9
|
+
from(data, encoding) {
|
|
10
|
+
if (encoding === 'base64') {
|
|
11
|
+
const bin = atob(data);
|
|
12
|
+
const bytes = new Uint8Array(bin.length);
|
|
13
|
+
for (let i = 0; i < bin.length; i++)
|
|
14
|
+
bytes[i] = bin.charCodeAt(i);
|
|
15
|
+
return bytes;
|
|
16
|
+
}
|
|
17
|
+
return new TextEncoder().encode(data);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
installBufferShim();
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
* Set up error handling with panic-overlay
|
|
3
|
-
* Configures panic-overlay to display errors on screen if the display_errors setting is enabled
|
|
4
|
-
*/
|
|
1
|
+
import './buffer-shim.js';
|
|
5
2
|
export declare function setupErrorHandling(): void;
|
|
6
3
|
//# sourceMappingURL=error-handling.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/utils/error-handling.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/utils/error-handling.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,CAAA;AAIzB,wBAAgB,kBAAkB,IAAI,IAAI,CASzC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
// Must be imported before panic-overlay to ensure Buffer is defined at module load time.
|
|
2
|
+
import './buffer-shim.js';
|
|
1
3
|
import panic from 'panic-overlay';
|
|
2
4
|
import { getSettingWithDefault, signalReady } from './settings.js';
|
|
3
|
-
/**
|
|
4
|
-
* Set up error handling with panic-overlay
|
|
5
|
-
* Configures panic-overlay to display errors on screen if the display_errors setting is enabled
|
|
6
|
-
*/
|
|
7
5
|
export function setupErrorHandling() {
|
|
8
6
|
const displayErrors = getSettingWithDefault('display_errors', false);
|
|
9
7
|
panic.configure({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@screenly/edge-apps",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.1.0-rc.1",
|
|
4
4
|
"description": "A TypeScript library for interfacing with Screenly Edge Apps API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"./test/screenshots": {
|
|
40
40
|
"import": "./dist/test/screenshots.js",
|
|
41
41
|
"types": "./dist/test/screenshots.d.ts"
|
|
42
|
-
}
|
|
42
|
+
},
|
|
43
|
+
"./tsconfig.json": "./tsconfig.json"
|
|
43
44
|
},
|
|
44
45
|
"files": [
|
|
45
46
|
"dist",
|
package/scripts/cli.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* CLI command dispatcher for edge-apps-scripts
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { execSync, spawn, type ChildProcess } from 'child_process'
|
|
6
|
+
import { execSync, execFileSync, spawn, type ChildProcess } from 'child_process'
|
|
7
7
|
import fs from 'fs'
|
|
8
8
|
import path from 'path'
|
|
9
9
|
import { fileURLToPath } from 'url'
|
|
@@ -151,9 +151,17 @@ async function devCommand(args: string[]) {
|
|
|
151
151
|
async function buildCommand(args: string[]) {
|
|
152
152
|
try {
|
|
153
153
|
const { viteBin, configPath } = getVitePaths()
|
|
154
|
-
const
|
|
154
|
+
const sourcemaps = args.includes('--sourcemaps')
|
|
155
|
+
const filteredArgs = args.filter((arg) => arg !== '--sourcemaps')
|
|
156
|
+
const viteArgs = [
|
|
157
|
+
'build',
|
|
158
|
+
'--config',
|
|
159
|
+
configPath,
|
|
160
|
+
...(sourcemaps ? ['--sourcemap'] : []),
|
|
161
|
+
...filteredArgs,
|
|
162
|
+
]
|
|
155
163
|
|
|
156
|
-
|
|
164
|
+
execFileSync(viteBin, viteArgs, {
|
|
157
165
|
stdio: 'inherit',
|
|
158
166
|
cwd: process.cwd(),
|
|
159
167
|
env: {
|