@glassly/miniapp-cli 0.1.8 → 0.1.9-beta.0
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/package.json +1 -1
- package/src/api.ts +1 -1
- package/src/pack.ts +6 -2
- package/src/release.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glassly/miniapp-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9-beta.0",
|
|
4
4
|
"description": "Build tooling for Glassly miniapps: dev server, packer, manifest validation, and JSON Schema. The `glassly` command that drives it ships in @glassly/cli.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
package/src/api.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { buildProduction } from './build.js';
|
|
2
2
|
export { dev, type DevAttestationInput, type DevOptions } from './dev.js';
|
|
3
|
-
export { pack, type PackOptions } from './pack.js';
|
|
3
|
+
export { pack, PACK_EXTENSION, type PackOptions } from './pack.js';
|
|
4
4
|
export { release, type ReleaseOptions } from './release.js';
|
|
5
5
|
export { runManifestWizard } from './manifest-wizard.js';
|
|
6
6
|
export { addPermissionCmd, listPermissionsCmd, removePermissionCmd } from './permission.js';
|
package/src/pack.ts
CHANGED
|
@@ -15,9 +15,12 @@ export interface PackOptions {
|
|
|
15
15
|
silent?: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/** Extension of a packed miniapp: a zip the Glassly App registers as its own file type. */
|
|
19
|
+
export const PACK_EXTENSION = 'gls';
|
|
20
|
+
|
|
18
21
|
/**
|
|
19
22
|
* Validate manifest, copy manifest+icon into dist/, zip dist/ into
|
|
20
|
-
* `build/<packageName>-<version>.
|
|
23
|
+
* `build/<packageName>-<version>.gls`. Returns the absolute path of the file.
|
|
21
24
|
*
|
|
22
25
|
* `build/` is self-ignoring: a `.gitignore` containing `*` is written into
|
|
23
26
|
* it on creation (the Cargo `target/` trick), so packed zips stay out of
|
|
@@ -101,7 +104,7 @@ export async function pack(opts: PackOptions = {}): Promise<string> {
|
|
|
101
104
|
|
|
102
105
|
const packageName = manifest.packageName as string;
|
|
103
106
|
const version = manifest.version as string;
|
|
104
|
-
const outputName = `${packageName}-${version}
|
|
107
|
+
const outputName = `${packageName}-${version}.${PACK_EXTENSION}`;
|
|
105
108
|
const outDir = resolve(cwd, opts.outDir ?? 'build');
|
|
106
109
|
if (!existsSync(outDir)) {
|
|
107
110
|
mkdirSync(outDir, { recursive: true });
|
|
@@ -126,6 +129,7 @@ export async function pack(opts: PackOptions = {}): Promise<string> {
|
|
|
126
129
|
|
|
127
130
|
if (!opts.silent) {
|
|
128
131
|
console.log(`\nPacked: ${outputPath}`);
|
|
132
|
+
console.log('Share this file: the Glassly App installs it when opened, or from Settings › Miniapp Developer › Install Miniapp from File.');
|
|
129
133
|
}
|
|
130
134
|
return outputPath;
|
|
131
135
|
}
|
package/src/release.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Flow:
|
|
5
5
|
* 1. Detect package manager, run `<pm> run build` so the user's bundler
|
|
6
6
|
* produces dist/.
|
|
7
|
-
* 2. Validate manifest + pack dist/ → build/<pkg>-<v>.
|
|
7
|
+
* 2. Validate manifest + pack dist/ → build/<pkg>-<v>.gls (uses pack()).
|
|
8
8
|
* 3. Spin up a tiny HTTP server on the LAN that serves the zip and
|
|
9
9
|
* manifest at fixed paths.
|
|
10
10
|
* 4. Print a QR with `miniapp://release?url=<lan-base>&...`.
|
|
@@ -26,7 +26,7 @@ import {readFileSync, existsSync, statSync, readdirSync, unlinkSync} from 'fs'
|
|
|
26
26
|
import os from 'os'
|
|
27
27
|
import {resolve, join} from 'path'
|
|
28
28
|
import {buildProduction} from './build.js'
|
|
29
|
-
import {pack} from './pack.js'
|
|
29
|
+
import {pack, PACK_EXTENSION} from './pack.js'
|
|
30
30
|
import {printQR, writeQRPng, type QRSize} from './qr.js'
|
|
31
31
|
import {getLanIp} from './lan.js'
|
|
32
32
|
import {validateManifest} from './manifest.js'
|
|
@@ -76,7 +76,7 @@ export async function release(opts: ReleaseOptions = {}): Promise<void> {
|
|
|
76
76
|
|
|
77
77
|
// ---- 2. Build (or skip via cache) -----------------------------------
|
|
78
78
|
const cacheDir = resolve(cwd, 'build')
|
|
79
|
-
const cachedZipName = `${packageName}-${version}
|
|
79
|
+
const cachedZipName = `${packageName}-${version}.${PACK_EXTENSION}`
|
|
80
80
|
const cachedZipPath = join(cacheDir, cachedZipName)
|
|
81
81
|
|
|
82
82
|
const cacheValid = !opts.noCache && isCacheFresh(cachedZipPath, cwd)
|
|
@@ -85,7 +85,7 @@ export async function release(opts: ReleaseOptions = {}): Promise<void> {
|
|
|
85
85
|
} else {
|
|
86
86
|
await buildProduction(cwd)
|
|
87
87
|
|
|
88
|
-
// Pack into build/<pkg>-<v>.
|
|
88
|
+
// Pack into build/<pkg>-<v>.gls
|
|
89
89
|
const packStart = Date.now()
|
|
90
90
|
const zipPath = await pack({outDir: 'build', silent: true})
|
|
91
91
|
const sizeKb = Math.round(statSync(zipPath).size / 1024)
|