@digia-engage/core 2.3.1 → 2.3.2
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 +70 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -266,6 +266,76 @@ react-native/ios/ iOS bridge
|
|
|
266
266
|
|
|
267
267
|
---
|
|
268
268
|
|
|
269
|
+
## Build & publishing (hybrid model)
|
|
270
|
+
|
|
271
|
+
This package is published using the **hybrid** React Native library layout (the
|
|
272
|
+
[`react-native-builder-bob`](https://github.com/callstack/react-native-builder-bob)
|
|
273
|
+
convention): the npm tarball ships **both** the compiled output (`lib/`) **and**
|
|
274
|
+
the original TypeScript source (`src/`).
|
|
275
|
+
|
|
276
|
+
### What the entry fields mean
|
|
277
|
+
|
|
278
|
+
| `package.json` field | Points to | Used by |
|
|
279
|
+
|---|---|---|
|
|
280
|
+
| `main` | `lib/commonjs/index` | Node / CommonJS consumers, Jest |
|
|
281
|
+
| `module` | `lib/module/index` | Bundlers that understand ESM |
|
|
282
|
+
| `types` | `lib/typescript/index.d.ts` | TypeScript |
|
|
283
|
+
| `react-native` / `source` | `src/index` | **Metro** — RN apps bundle straight from source |
|
|
284
|
+
|
|
285
|
+
Because Metro resolves the `react-native`/`source` field, a React Native app that
|
|
286
|
+
consumes this package bundles the **actual `.ts` source**. That gives our users
|
|
287
|
+
the best developer experience:
|
|
288
|
+
|
|
289
|
+
- **Stack traces** point at real `src/*.ts` lines, not transpiled output.
|
|
290
|
+
- **Step-debugging** walks through the real source.
|
|
291
|
+
- **Go-to-definition** lands on the real source — we ship `.d.ts` **and**
|
|
292
|
+
`.d.ts.map` (declaration maps) alongside `src/`, so an IDE jumps from the type
|
|
293
|
+
definition through to the `.ts` it came from.
|
|
294
|
+
|
|
295
|
+
The compiled `lib/` is a robust fallback for any tool that does *not* honour the
|
|
296
|
+
`react-native` field (Node, Jest, web bundlers, type resolvers), so the package
|
|
297
|
+
never breaks outside Metro.
|
|
298
|
+
|
|
299
|
+
### Why not ship raw `src/` only?
|
|
300
|
+
|
|
301
|
+
Shipping only `src/*.ts` works in RN (Metro strips the types) but breaks
|
|
302
|
+
everywhere else — bundlers skip `node_modules` transpilation by default, and a
|
|
303
|
+
consumer's stricter `tsconfig` would re-type-check our source and surface errors
|
|
304
|
+
they can't fix. The hybrid layout keeps the great RN DX *and* stays safe for
|
|
305
|
+
every other consumer.
|
|
306
|
+
|
|
307
|
+
### Build config that makes this work
|
|
308
|
+
|
|
309
|
+
`tsconfig.build.json` (used only to generate type definitions):
|
|
310
|
+
|
|
311
|
+
- `declaration: true` — emit `.d.ts`
|
|
312
|
+
- `declarationMap: true` — emit `.d.ts.map` so go-to-definition reaches `src/`
|
|
313
|
+
- `sourceMap: true` + `inlineSources: true` — map compiled JS back to source
|
|
314
|
+
- `rootDir: "src"` — keeps `index.d.ts` at the top of `lib/typescript/`
|
|
315
|
+
- **No** `declarationDir` / `noEmit` here — `bob` sets those via the CLI; leaving
|
|
316
|
+
them in the config produces conflict warnings
|
|
317
|
+
|
|
318
|
+
`files` includes both `src` and `lib` so the maps resolve on the consumer's disk.
|
|
319
|
+
|
|
320
|
+
### Publishing
|
|
321
|
+
|
|
322
|
+
The `prepare` script runs `bob build` automatically on install and publish, so
|
|
323
|
+
the build toolchain (`typescript`, `react-native-builder-bob`) must be installed
|
|
324
|
+
first:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
npm install # installs devDeps AND runs prepare → bob build
|
|
328
|
+
npm pack --dry-run # verify lib/ + src/ + maps are in the tarball
|
|
329
|
+
npm publish
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
> **Heads-up:** `package-lock.json` is **gitignored** for this library (a lib's
|
|
333
|
+
> lockfile is ignored by consumers and only hides dependency-range drift). On a
|
|
334
|
+
> fresh CI clone there is no lockfile, so use `npm install` — **not** `npm ci`,
|
|
335
|
+
> which requires one.
|
|
336
|
+
|
|
337
|
+
**Never hand-edit `lib/`** — it is generated. Edit `src/` and rebuild.
|
|
338
|
+
|
|
269
339
|
## License
|
|
270
340
|
|
|
271
341
|
Business Source License 1.1 (BUSL-1.1) © Digia Technology Private Limited — see [LICENSE](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digia-engage/core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "React Native bridge for Digia Engage – renders native Android Compose UI inside React Native apps",
|
|
5
|
-
"main": "
|
|
6
|
-
"module": "
|
|
7
|
-
"types": "
|
|
8
|
-
"react-native": "src/index
|
|
9
|
-
"source": "src/index
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
10
|
"files": [
|
|
11
11
|
"src",
|
|
12
12
|
"lib",
|