@tomorrowos/sdk 0.1.4 → 0.1.5
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/dist/cli.js +21 -0
- package/package.json +1 -1
- package/templates/cms-starter/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -6,6 +6,24 @@ function packageRoot() {
|
|
|
6
6
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
return path.resolve(here, "..");
|
|
8
8
|
}
|
|
9
|
+
function getSdkVersion() {
|
|
10
|
+
const pkgPath = path.join(packageRoot(), "package.json");
|
|
11
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
12
|
+
return pkg.version ?? "0.0.0";
|
|
13
|
+
}
|
|
14
|
+
/** Align generated cms-starter package.json with the installed SDK version. */
|
|
15
|
+
function patchStarterPackageJson(destDir) {
|
|
16
|
+
const pkgPath = path.join(path.resolve(destDir), "package.json");
|
|
17
|
+
if (!fs.existsSync(pkgPath))
|
|
18
|
+
return;
|
|
19
|
+
const ver = getSdkVersion();
|
|
20
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
21
|
+
pkg.version = ver;
|
|
22
|
+
if (pkg.dependencies?.["@tomorrowos/sdk"]) {
|
|
23
|
+
pkg.dependencies["@tomorrowos/sdk"] = `^${ver}`;
|
|
24
|
+
}
|
|
25
|
+
fs.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
26
|
+
}
|
|
9
27
|
function copyStarter(destDir, force) {
|
|
10
28
|
const src = path.join(packageRoot(), "templates", "cms-starter");
|
|
11
29
|
if (!fs.existsSync(src)) {
|
|
@@ -24,7 +42,10 @@ function copyStarter(destDir, force) {
|
|
|
24
42
|
fs.mkdirSync(resolved, { recursive: true });
|
|
25
43
|
}
|
|
26
44
|
fs.cpSync(src, resolved, { recursive: true });
|
|
45
|
+
patchStarterPackageJson(resolved);
|
|
46
|
+
const sdkVer = getSdkVersion();
|
|
27
47
|
console.log(`[tomorrowos] Created CMS project at ${resolved}`);
|
|
48
|
+
console.log(`[tomorrowos] @tomorrowos/sdk dependency: ^${sdkVer}`);
|
|
28
49
|
console.log("Next: cd there, run npm install, then npm run dev");
|
|
29
50
|
}
|
|
30
51
|
function cmdBuild(argv) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomorrowos/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "TomorrowOS CMS server SDK — WebSocket transport, pairing, device commands, optional static CMS UI. Includes CLI (tomorrowos init / build) and starter templates.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-cms",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "CMS server on @tomorrowos/sdk. Add your UI (React, static files, etc.) alongside this server.",
|
|
5
5
|
"private": true,
|
|
6
6
|
"type": "module",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build-player": "tomorrowos build --platform tizen"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@tomorrowos/sdk": "^0.1.
|
|
13
|
+
"@tomorrowos/sdk": "^0.1.5"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "^20.0.0",
|