@oniroproject/core 0.9.0 → 0.11.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/README.md +33 -0
- package/dist/index.cjs +1761 -399
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +306 -2
- package/dist/index.d.ts +306 -2
- package/dist/index.js +1749 -399
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -265,6 +265,39 @@ The injection-safe primitives every device operation builds on (`spawn` with `sh
|
|
|
265
265
|
| `decideInstallMethod` / `decideReboot` | — | The pure (tested) decision functions behind `applyChanges`. |
|
|
266
266
|
| `diffHapAssets` / `diffEntryNames` | — | Diff two HAP archives' file manifests (drives the cache-invalidation reboot). |
|
|
267
267
|
|
|
268
|
+
### HarmonyOS
|
|
269
|
+
|
|
270
|
+
HarmonyOS support is additive: a project is HarmonyOS only when its product declares
|
|
271
|
+
`runtimeOS: "HarmonyOS"`, and every OpenHarmony API behaves as before. `buildHap`,
|
|
272
|
+
`runHvigorw` and `createScaffold` pick the HarmonyOS SDK for such projects themselves.
|
|
273
|
+
|
|
274
|
+
| Export | Description |
|
|
275
|
+
| --- | --- |
|
|
276
|
+
| `detectRuntimeOs(projectDir, productName?)` | `'HarmonyOS'` or `'OpenHarmony'`, from `build-profile.json5`. |
|
|
277
|
+
| `findHarmonyOsSdk({ config, logger? })` / `requireHarmonyOsSdk(...)` | Locate a HarmonyOS SDK (`harmonyosSdkPath`, then DevEco Studio's default location, then `cmdToolsPath` when it is the HarmonyOS edition), with its release as `version`, e.g. `6.1.1(24)`; `null` or an actionable error when there is none. |
|
|
278
|
+
| `harmonyOsSdkLabelForApi(api)`, `HARMONYOS_SDK_VERSIONS` | The `"<version>(<api>)"` label HarmonyOS products declare. |
|
|
279
|
+
| `createHarmonyOsSession(opts)` | `login` / `logout` / `getUserInfo` / `listTeams` / `resolveAgcAuth` / `getDeveloperAgreement` for a Huawei developer account. The token is stored encrypted, with the account's region. |
|
|
280
|
+
| `harmonyOsAutoSign(opts)` | Keystore + CSR → AGC debug certificate → device registration → debug profile → `build-profile.json5`, reusing still-valid material. |
|
|
281
|
+
| `readProvisionProfile(path)` | Bundle name, team, expiry, devices and ACLs of a `.p7b`. |
|
|
282
|
+
| `HUAWEI_SITES` | Each region's sign-in and AppGallery Connect hosts. |
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
import { createHarmonyOsSession, harmonyOsAutoSign, staticConfig } from '@oniroproject/core';
|
|
286
|
+
|
|
287
|
+
const config = staticConfig();
|
|
288
|
+
const session = createHarmonyOsSession({ config, onLoginUrl: (url) => console.log(url) });
|
|
289
|
+
if (!(await session.getUserInfo())) await session.login();
|
|
290
|
+
|
|
291
|
+
const result = await harmonyOsAutoSign({ config, session, projectDir: '/path/to/project' });
|
|
292
|
+
console.log(result.paths.profilePath, result.deviceIds);
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Signing calls private, undocumented AppGallery Connect APIs, and needs a Huawei developer
|
|
296
|
+
account that is real-name verified or has accepted the HUAWEI Developer Basic Service
|
|
297
|
+
Agreement. Accounts from every region work: calls go to the account's own region, as in
|
|
298
|
+
DevEco Studio. Parts of this subtree are adapted from the MIT-licensed
|
|
299
|
+
`openharmony-sig/deveco-cli`; see [`src/harmonyos/NOTICE.md`](src/harmonyos/NOTICE.md).
|
|
300
|
+
|
|
268
301
|
## Conventions
|
|
269
302
|
|
|
270
303
|
- **Configuration.** Pass a `ConfigProvider`. `staticConfig({...})` is the quick path; a frontend can read settings, env vars, etc. Unset keys fall back to `defaultPaths`.
|