@supersdk/supercli 0.1.2 → 0.2.0-staging.13
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/commands/createApp.js +274 -7
- package/dist/commands/createApp.js.map +1 -1
- package/dist/commands/publishSite.js +218 -91
- package/dist/commands/publishSite.js.map +1 -1
- package/dist/config/appConfig.js +187 -0
- package/dist/config/appConfig.js.map +1 -0
- package/dist/createApp/copyTemplate.js +337 -45
- package/dist/createApp/copyTemplate.js.map +1 -1
- package/dist/publish/siteConfig.js +352 -165
- package/dist/publish/siteConfig.js.map +1 -1
- package/dist/publish/siteZip.js +7 -2
- package/dist/publish/siteZip.js.map +1 -1
- package/dist/template/README.md +59 -9
- package/dist/template/android/app/src/main/java/com/supersdk/simple/SimpleApplication.java +1 -1
- package/dist/template/ios/Sources/App/AppDelegate.swift +1 -1
- package/dist/template/scripts/android_snapshot_canary.py +1 -1
- package/dist/template/scripts/build_android.sh +1 -1
- package/dist/template/scripts/build_ios.sh +5 -10
- package/dist/template/scripts/serve_web.py +15 -3
- package/dist/template/scripts/supersdk_template.py +164 -140
- package/dist/template/scripts/web_package.py +65 -8
- package/dist/template/super_build.sh +2 -2
- package/dist/template/supersdk.json +23 -0
- package/dist/template/web/src/js/app.js +5 -2
- package/dist/util/prompt.js +23 -0
- package/dist/util/prompt.js.map +1 -1
- package/dist/util/shell.js +21 -0
- package/dist/util/shell.js.map +1 -0
- package/package.json +1 -1
- package/dist/template/supersdk.yaml +0 -16
package/dist/publish/siteZip.js
CHANGED
|
@@ -42,7 +42,9 @@ exports.buildSiteZip = buildSiteZip;
|
|
|
42
42
|
//
|
|
43
43
|
// Rules:
|
|
44
44
|
// - REQUIRE a root index.html (else a local error, no upload).
|
|
45
|
-
// - exclude
|
|
45
|
+
// - exclude the root supersdk.json (SITE_CONFIG_FILENAME — the retired
|
|
46
|
+
// super-site.yml is no longer a thing) + dotfiles/dotdirs, but KEEP
|
|
47
|
+
// .well-known/.
|
|
46
48
|
// - reject symlinks + path traversal + case-insensitive duplicate paths.
|
|
47
49
|
// - per-entry <= 25 MiB, file count <= 2000, compressed archive <= 50 MiB.
|
|
48
50
|
const fs = __importStar(require("node:fs"));
|
|
@@ -87,7 +89,10 @@ function collectEntries(root, limits) {
|
|
|
87
89
|
if (name === '..' || name === '.' || name.includes('\\') || name.includes('/')) {
|
|
88
90
|
throw new ZipBuildError('PATH_TRAVERSAL', `非法的路径条目: ${rel}`);
|
|
89
91
|
}
|
|
90
|
-
// Exclusions: root
|
|
92
|
+
// Exclusions: root supersdk.json + dotfiles/dotdirs (keep .well-known/).
|
|
93
|
+
// The root config carries spid/orgId — packaging it would publish the
|
|
94
|
+
// project's identity to a public site whenever the publish dir IS the
|
|
95
|
+
// repo root (single-page site repos).
|
|
91
96
|
if (relPrefix === '' && name === siteConfig_1.SITE_CONFIG_FILENAME)
|
|
92
97
|
continue;
|
|
93
98
|
if (isExcludedSegment(name))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siteZip.js","sourceRoot":"","sources":["../../src/publish/siteZip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"siteZip.js","sourceRoot":"","sources":["../../src/publish/siteZip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0IA,oCA2DC;AArMD,iFAAiF;AACjF,+EAA+E;AAC/E,8EAA8E;AAC9E,uDAAuD;AACvD,EAAE;AACF,SAAS;AACT,iEAAiE;AACjE,yEAAyE;AACzE,wEAAwE;AACxE,oBAAoB;AACpB,2EAA2E;AAC3E,6EAA6E;AAC7E,4CAA8B;AAC9B,gDAAkC;AAClC,2CAA6B;AAC7B,6CAAoD;AAEpD,MAAM,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAUX,QAAA,kBAAkB,GAAc;IAC3C,YAAY,EAAE,EAAE,GAAG,GAAG;IACtB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CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;AAC7F,CAAC"}
|
package/dist/template/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# SuperSDK Simple App Template
|
|
2
2
|
|
|
3
3
|
This directory is the copy-ready `app_repo_example` template scaffold for
|
|
4
|
-
Android, iOS, and Web hosts. Edit one root `supersdk.
|
|
4
|
+
Android, iOS, and Web hosts. Edit one root `supersdk.json`, run plan or build
|
|
5
5
|
from this directory, and use the root ordered summary to inspect platform
|
|
6
6
|
results.
|
|
7
7
|
|
|
@@ -18,7 +18,7 @@ through the root build orchestration described below.
|
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
No arguments are equivalent to `./super_build.sh --plan`. Plan mode validates
|
|
21
|
-
`supersdk.
|
|
21
|
+
`supersdk.json` and prints Android -> iOS -> Web helper order without invoking
|
|
22
22
|
platform build helpers or emitting `SUPERSDK_BUILD_SUMMARY_JSON=`.
|
|
23
23
|
|
|
24
24
|
Build mode validates and injects managed config first, then runs selected
|
|
@@ -29,23 +29,73 @@ rewritten.
|
|
|
29
29
|
|
|
30
30
|
## Configuration Checklist
|
|
31
31
|
|
|
32
|
-
- Edit `supersdk.
|
|
33
|
-
- Keep `
|
|
32
|
+
- Edit `supersdk.json`. It is standard JSON: no comments, no trailing commas.
|
|
33
|
+
- Keep `"schemaVersion": 2`.
|
|
34
34
|
- Set `spid`, `environment`, and `name`. Replace the example `demo0001` with
|
|
35
35
|
the real 8-character lowercase alphanumeric spid issued by the console.
|
|
36
|
-
- Keep `environment: prod` for production, or use an explicit 1–10 character
|
|
36
|
+
- Keep `"environment": "prod"` for production, or use an explicit 1–10 character
|
|
37
37
|
lowercase alphanumeric environment such as `staging`.
|
|
38
|
-
- Set `android.package` for Android builds.
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
- Set `android.package` for Android builds. It is required whenever Android is
|
|
39
|
+
built and must differ from the fixed `com.supersdk.simple` namespace.
|
|
40
|
+
- Set `ios.bundleId` for iOS builds. It is required whenever iOS is built: the
|
|
41
|
+
app identity is never derived from `spid`, so a missing value fails the build
|
|
42
|
+
instead of shipping under the SDK's own reverse-domain namespace. The default
|
|
43
|
+
`"spmMode": "mock"` uses the bundled `ios/MockSuperSDKPackage`.
|
|
41
44
|
- Set `web.host` for Web packaging.
|
|
42
45
|
- Run `./super_build.sh --plan`.
|
|
43
46
|
- Run `./super_build.sh --build` or a single-platform build.
|
|
44
47
|
|
|
48
|
+
`orgId` and `sites` are owned by `supercli`. The template type-checks them
|
|
49
|
+
(`orgId` a string, `sites` an array) and otherwise ignores them, so site-side
|
|
50
|
+
changes can never break an App build. Any other unrecognized root key is kept
|
|
51
|
+
as-is. The retired `supersdk.yaml` / `supersdk.yml` / `super-site.yml` files are
|
|
52
|
+
rejected with a copy-pasteable migration command; there is no silent fallback.
|
|
53
|
+
The command matches the situation: with no usable `supersdk.json` it writes the
|
|
54
|
+
full skeleton first and deletes the legacy file last, and when `supersdk.json` is
|
|
55
|
+
already valid it only offers `rm <legacy>` so pasting it cannot overwrite real
|
|
56
|
+
values.
|
|
57
|
+
|
|
58
|
+
`supersdk.json` must be standard JSON in the strict sense. `NaN`, `Infinity`, and
|
|
59
|
+
`-Infinity` are rejected even though Python's parser accepts them, because
|
|
60
|
+
`supercli` reads the same file with `JSON.parse`, which does not.
|
|
61
|
+
|
|
62
|
+
Note that the top-level `environment` is the App's own SDK runtime environment
|
|
63
|
+
(injected into all three native configs), while `sites[].env` is the project
|
|
64
|
+
environment a site publishes into. They are not asserted to be equal: building
|
|
65
|
+
with a `staging` SDK config and publishing to a `prod` site is a legal
|
|
66
|
+
combination.
|
|
67
|
+
|
|
45
68
|
Generated files live under each platform `.supersdk/managed/` directory and
|
|
46
69
|
are safe to overwrite only when they contain `managed_by: supersdk-template`.
|
|
47
70
|
Use `--force` only when intentionally replacing unmanaged target files.
|
|
48
71
|
|
|
72
|
+
## Web Output And Publishing
|
|
73
|
+
|
|
74
|
+
`web/src` is authored input. The Web build renders the single publishable
|
|
75
|
+
package root at `web/dist`:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
./super_build.sh --platform web --build
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
That writes `web/dist/` (static assets plus the generated
|
|
82
|
+
`web/dist/supersdk-config.json` the browser fallback reads) and the offline
|
|
83
|
+
package `output/<host>@<version>@<md5>.zip`, both from the same tree. The zip is
|
|
84
|
+
not a byte-identical copy of `web/dist`: it also carries the offline manifest
|
|
85
|
+
`__super_meta.json`, which belongs to the offline package only. `web/dist`
|
|
86
|
+
is the directory to hand to the site publisher:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
supercli publish-site web/dist --spid <spid> --slug <slug> --env <env> --version <x.y.z>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`web/dist` is a build output: it is gitignored and replaced wholesale on every
|
|
93
|
+
build. Never edit it by hand, and never point the publisher at `web/src` — that
|
|
94
|
+
tree has no runtime config and still carries `js/supersdk.provenance.json`.
|
|
95
|
+
|
|
96
|
+
For local debugging, `python3 scripts/serve_web.py` serves `web/dist` when it
|
|
97
|
+
exists and falls back to the unbuilt `web/src` with a warning.
|
|
98
|
+
|
|
49
99
|
## Ordered Summary
|
|
50
100
|
|
|
51
101
|
Build mode writes exactly one root-owned machine-readable stdout line:
|
|
@@ -133,7 +183,7 @@ python3 supersimples/tests/e2e/build_orchestration_smoke.py
|
|
|
133
183
|
```
|
|
134
184
|
|
|
135
185
|
The canonical smoke copies this template to a temporary directory outside the
|
|
136
|
-
monorepo, edits `supersdk.
|
|
186
|
+
monorepo, edits `supersdk.json`, verifies platform entry assets, pins Android
|
|
137
187
|
SNAPSHOT metadata to a local fixture, forces Android deterministic test mode,
|
|
138
188
|
forces deterministic iOS `SKIP_XCODEGEN_MISSING`, runs the root build, checks
|
|
139
189
|
the ordered summary, checks all three managed configs, verifies a real Web zip
|
|
@@ -15,7 +15,7 @@ public class SimpleApplication extends Application {
|
|
|
15
15
|
try {
|
|
16
16
|
SuperSDK.init(this, BuildConfig.SUPERSDK_SPID, BuildConfig.SUPERSDK_ENVIRONMENT, new SuperSDKProvider() {});
|
|
17
17
|
} catch (RuntimeException exception) {
|
|
18
|
-
Log.e(TAG, "SuperSDK init failed; check supersdk.
|
|
18
|
+
Log.e(TAG, "SuperSDK init failed; check supersdk.json and the resolved SDK dependency.", exception);
|
|
19
19
|
throw exception;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -9,7 +9,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
9
9
|
do {
|
|
10
10
|
try SimpleSDKBootstrap.initialize()
|
|
11
11
|
} catch {
|
|
12
|
-
fatalError("SuperSDK init failed; check supersdk.
|
|
12
|
+
fatalError("SuperSDK init failed; check supersdk.json identity: \(error)")
|
|
13
13
|
}
|
|
14
14
|
return true
|
|
15
15
|
}
|
|
@@ -95,7 +95,7 @@ def effective_android_version(root, config_path):
|
|
|
95
95
|
version = managed_android_version(root)
|
|
96
96
|
if version is not None:
|
|
97
97
|
return version
|
|
98
|
-
normalized = supersdk_template.load_and_validate(config_path
|
|
98
|
+
normalized = supersdk_template.load_and_validate(config_path)
|
|
99
99
|
supersdk_template.require_android_config(normalized)
|
|
100
100
|
return normalized["sdk"]["androidVersion"]
|
|
101
101
|
|
|
@@ -4,7 +4,7 @@ set -euo pipefail
|
|
|
4
4
|
APP_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
5
5
|
ANDROID_ROOT="$APP_ROOT/android"
|
|
6
6
|
PYTHON_BIN="${PYTHON_BIN:-python3}"
|
|
7
|
-
CONFIG="$APP_ROOT/supersdk.
|
|
7
|
+
CONFIG="$APP_ROOT/supersdk.json"
|
|
8
8
|
|
|
9
9
|
usage() {
|
|
10
10
|
echo "Usage: scripts/build_android.sh --build [--config path]" >&2
|
|
@@ -34,12 +34,6 @@ def swift_string(value):
|
|
|
34
34
|
return json.dumps(str(value))
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def sanitize_spid(spid):
|
|
38
|
-
value = re.sub(r"[^a-z0-9-]+", "-", spid.lower())
|
|
39
|
-
value = re.sub(r"-+", "-", value).strip("-")
|
|
40
|
-
return value or "app"
|
|
41
|
-
|
|
42
|
-
|
|
43
37
|
def load_template_contract(app_root):
|
|
44
38
|
helper_path = app_root / "scripts" / "supersdk_template.py"
|
|
45
39
|
spec = importlib.util.spec_from_file_location("supersdk_template_contract", helper_path)
|
|
@@ -116,11 +110,12 @@ version_code = version.get("code")
|
|
|
116
110
|
if not template_contract.is_positive_int(version_code):
|
|
117
111
|
fail_invalid("version.code must be a positive integer")
|
|
118
112
|
|
|
113
|
+
# No derived fallback: the app identity comes from ios.bundleId or the build fails.
|
|
119
114
|
bundle_id = platform_config.get("bundleId")
|
|
120
|
-
if bundle_id is
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
115
|
+
if bundle_id is None:
|
|
116
|
+
fail_invalid(f"platform_config.bundleId is required; set ios.bundleId in {template_contract.CONFIG_FILENAME}")
|
|
117
|
+
if not isinstance(bundle_id, str) or not re.fullmatch(template_contract.BUNDLE_ID_PATTERN, bundle_id):
|
|
118
|
+
fail_invalid("platform_config.bundleId must be a bundle identifier")
|
|
124
119
|
mock_package = (ios_dir / "MockSuperSDKPackage").resolve()
|
|
125
120
|
source_spec = ios_dir / "project.yml"
|
|
126
121
|
|
|
@@ -23,9 +23,21 @@ def main(argv=None):
|
|
|
23
23
|
args = parser.parse_args(argv)
|
|
24
24
|
|
|
25
25
|
root = args.root.resolve()
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
# Prefer the built package root: only web/dist carries the generated
|
|
27
|
+
# supersdk-config.json that the browser fallback path reads.
|
|
28
|
+
entry = None
|
|
29
|
+
for relative in ("web/dist/index.html", "web/src/index.html"):
|
|
30
|
+
if (root / relative).is_file():
|
|
31
|
+
entry = relative
|
|
32
|
+
break
|
|
33
|
+
if entry is None:
|
|
34
|
+
print(f"web/dist/index.html or web/src/index.html not found under {root}", file=sys.stderr)
|
|
28
35
|
return 1
|
|
36
|
+
if entry.startswith("web/src/"):
|
|
37
|
+
print(
|
|
38
|
+
"warning: serving unbuilt web/src; run scripts/build_web.sh --build for the browser config fallback",
|
|
39
|
+
file=sys.stderr,
|
|
40
|
+
)
|
|
29
41
|
|
|
30
42
|
remote_bind = args.host not in {"127.0.0.1", "localhost", "::1"}
|
|
31
43
|
if remote_bind and not args.allow_remote:
|
|
@@ -37,7 +49,7 @@ def main(argv=None):
|
|
|
37
49
|
handler = functools.partial(http.server.SimpleHTTPRequestHandler, directory=str(root))
|
|
38
50
|
server = http.server.ThreadingHTTPServer((args.host, args.port), handler)
|
|
39
51
|
host, port = server.server_address
|
|
40
|
-
print(f"http://{host}:{port}/
|
|
52
|
+
print(f"http://{host}:{port}/{entry}", flush=True)
|
|
41
53
|
try:
|
|
42
54
|
server.serve_forever()
|
|
43
55
|
except KeyboardInterrupt:
|