html2apk 0.1.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.
Files changed (36) hide show
  1. package/README.md +472 -0
  2. package/bin/html2apk-desktop.js +23 -0
  3. package/bin/html2apk.js +19 -0
  4. package/examples/minimal/app.json +27 -0
  5. package/examples/minimal/dist/MeuApp-1.0.0-debug.apk +0 -0
  6. package/examples/minimal/index.html +41 -0
  7. package/html2apk.png +0 -0
  8. package/index.js +3 -0
  9. package/package.json +76 -0
  10. package/src/android/README.md +7 -0
  11. package/src/bridge/install-bridge.js +16 -0
  12. package/src/cli/index.js +163 -0
  13. package/src/cordova/apk-finder.js +45 -0
  14. package/src/cordova/config-xml.js +110 -0
  15. package/src/cordova/project.js +56 -0
  16. package/src/core/build-apk.js +189 -0
  17. package/src/core/config.js +99 -0
  18. package/src/core/defaults.js +37 -0
  19. package/src/core/validation.js +58 -0
  20. package/src/desktop/main.js +522 -0
  21. package/src/desktop/preload.js +30 -0
  22. package/src/desktop/renderer/index.html +323 -0
  23. package/src/desktop/renderer/renderer.js +1074 -0
  24. package/src/desktop/renderer/styles.css +1208 -0
  25. package/src/index.js +12 -0
  26. package/src/runtime-manager/doctor.js +164 -0
  27. package/src/runtime-manager/index.js +190 -0
  28. package/src/templates/cordova-plugin-html2apk-bridge/package.json +16 -0
  29. package/src/templates/cordova-plugin-html2apk-bridge/plugin.xml +39 -0
  30. package/src/templates/cordova-plugin-html2apk-bridge/src/android/BootReceiver.java +20 -0
  31. package/src/templates/cordova-plugin-html2apk-bridge/src/android/Html2ApkBridge.java +375 -0
  32. package/src/templates/cordova-plugin-html2apk-bridge/src/android/NotificationReceiver.java +112 -0
  33. package/src/templates/cordova-plugin-html2apk-bridge/src/android/NotificationStore.java +91 -0
  34. package/src/templates/cordova-plugin-html2apk-bridge/www/html2apk-bridge.js +129 -0
  35. package/src/utils/command-runner.js +124 -0
  36. package/src/utils/fs-extra.js +111 -0
package/README.md ADDED
@@ -0,0 +1,472 @@
1
+ # html2apk
2
+
3
+ `html2apk` transforma uma pasta com HTML, CSS, JS e assets em um APK Android usando Cordova.
4
+
5
+ Use ele quando voce ja tem um app web, por exemplo uma pasta com `index.html`, `style.css`, `app.js` e imagens, e quer gerar um `.apk` instalavel no Android.
6
+
7
+ ## O Mais Importante
8
+
9
+ Na pratica, voce vai usar estes comandos:
10
+
11
+ ```bash
12
+ html2apk init
13
+ html2apk doctor
14
+ html2apk build
15
+ ```
16
+
17
+ `doctor` e `build` fazem coisas diferentes:
18
+
19
+ | Comando | O que faz | Quando usar |
20
+ | --- | --- | --- |
21
+ | `html2apk doctor` | Confere se o computador esta pronto para gerar APK. Ele verifica Java, Gradle, Cordova e Android SDK. | Use antes do primeiro build, depois de instalar ferramentas Android ou quando o build falhar por ambiente. |
22
+ | `html2apk build` | Gera o APK de verdade a partir da sua pasta HTML. | Use quando o `doctor` estiver OK e voce quiser criar/atualizar o APK. |
23
+
24
+ O `doctor` nao gera APK. Ele so diagnostica o ambiente.
25
+
26
+ O `build` gera APK. Ele cria um projeto Cordova temporario, copia seu HTML/CSS/JS, compila Android e salva o resultado em `dist/`.
27
+
28
+ ## Instalar
29
+
30
+ Se estiver usando como pacote global:
31
+
32
+ ```bash
33
+ npm install -g html2apk
34
+ ```
35
+
36
+ Durante desenvolvimento deste repositorio:
37
+
38
+ ```bash
39
+ npm install
40
+ npm link
41
+ ```
42
+
43
+ Tambem da para rodar localmente sem link:
44
+
45
+ ```bash
46
+ node bin/html2apk.js doctor
47
+ node bin/html2apk.js build
48
+ ```
49
+
50
+ ## Requisitos Do Computador
51
+
52
+ Para gerar APK, o computador precisa ter:
53
+
54
+ - Node.js 18 ou superior
55
+ - JDK
56
+ - Android SDK ou Android Studio
57
+ - Android command line tools
58
+ - Gradle
59
+ - Cordova CLI
60
+
61
+ Este projeto usa `cordova-android@15.0.0` por padrao. Por isso, o Android SDK precisa ter:
62
+
63
+ - Android Platform 36
64
+ - Android Build Tools 36.0.0
65
+
66
+ Com `sdkmanager`, os pacotes principais sao:
67
+
68
+ ```bash
69
+ sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0"
70
+ ```
71
+
72
+ Variaveis de ambiente comuns:
73
+
74
+ ```bash
75
+ export JAVA_HOME=/path/to/jdk
76
+ export ANDROID_HOME=/path/to/android-sdk
77
+ export ANDROID_SDK_ROOT=/path/to/android-sdk
78
+ ```
79
+
80
+ No Windows, o `html2apk doctor` tenta encontrar automaticamente o SDK em:
81
+
82
+ ```text
83
+ C:\Users\SEU_USUARIO\AppData\Local\Android\Sdk
84
+ ```
85
+
86
+ ## Passo A Passo
87
+
88
+ Entre na pasta do seu app web:
89
+
90
+ ```bash
91
+ cd caminho/da/minha-pasta-html
92
+ ```
93
+
94
+ Sua pasta deve ter pelo menos um arquivo de entrada, normalmente:
95
+
96
+ ```text
97
+ index.html
98
+ ```
99
+
100
+ Crie a configuracao inicial:
101
+
102
+ ```bash
103
+ html2apk init
104
+ ```
105
+
106
+ Esse comando cria dois arquivos quando eles ainda nao existem:
107
+
108
+ - `app.json`
109
+ - `index.html`
110
+
111
+ Edite o `app.json` com o nome do app, pacote Android e preferencias.
112
+
113
+ Depois confira o ambiente:
114
+
115
+ ```bash
116
+ html2apk doctor
117
+ ```
118
+
119
+ Se tudo aparecer como `OK`, gere o APK:
120
+
121
+ ```bash
122
+ html2apk build
123
+ ```
124
+
125
+ O arquivo final sera criado em:
126
+
127
+ ```text
128
+ dist/NomeDoApp-1.0.0-debug.apk
129
+ ```
130
+
131
+ ## Comandos Da CLI
132
+
133
+ ### `html2apk init`
134
+
135
+ Cria uma configuracao inicial para seu app.
136
+
137
+ Use quando voce ainda nao tem `app.json`:
138
+
139
+ ```bash
140
+ html2apk init
141
+ ```
142
+
143
+ Ele nao apaga seu `app.json` nem seu `index.html` se eles ja existirem.
144
+
145
+ ### `html2apk doctor`
146
+
147
+ Verifica se o computador esta pronto para compilar Android:
148
+
149
+ ```bash
150
+ html2apk doctor
151
+ ```
152
+
153
+ Exemplo de saida boa:
154
+
155
+ ```text
156
+ OK java
157
+ OK javac
158
+ OK gradle
159
+ OK cordova
160
+ OK Android build-tools 36.0.0
161
+ OK Android platform android-36
162
+ Environment looks ready.
163
+ ```
164
+
165
+ Se aparecer `ERR`, resolva esse item antes de rodar `build`.
166
+
167
+ ### `html2apk build`
168
+
169
+ Gera o APK:
170
+
171
+ ```bash
172
+ html2apk build
173
+ ```
174
+
175
+ Opcoes comuns:
176
+
177
+ ```bash
178
+ html2apk build --debug
179
+ html2apk build --release
180
+ html2apk build --mode fullscreen
181
+ html2apk build --mode standalone
182
+ html2apk build --entry-file index.html
183
+ html2apk build --web-root .
184
+ html2apk build --app-name MeuApp
185
+ html2apk build --package-id com.seuapp.meuapp
186
+ html2apk build --android-platform android@15.0.0
187
+ ```
188
+
189
+ Com `--debug`, a pasta Cordova temporaria fica salva para inspecao caso voce queira investigar arquivos gerados.
190
+
191
+ Sem `--debug`, a pasta temporaria e limpa no fim do build.
192
+
193
+ ## Configuracao Com `app.json`
194
+
195
+ O `app.json` fica na raiz do seu app. Se ele nao existir, `config.json` e usado como fallback.
196
+
197
+ Exemplo completo:
198
+
199
+ ```json
200
+ {
201
+ "_editMe": "Edite os campos abaixo e rode: html2apk doctor && html2apk build",
202
+ "appName": "MeuApp",
203
+ "packageId": "com.seuapp.meuapp",
204
+ "version": "1.0.0",
205
+ "mode": "fullscreen",
206
+ "icon": "",
207
+ "splash": "",
208
+ "permissions": ["INTERNET", "CAMERA", "POST_NOTIFICATIONS", "VIBRATE"],
209
+ "plugins": ["cordova-plugin-camera"],
210
+ "release": false,
211
+ "androidPlatform": "android@15.0.0",
212
+ "keystore": {
213
+ "path": "",
214
+ "alias": "app",
215
+ "storePassword": "",
216
+ "keyPassword": ""
217
+ },
218
+ "debug": false,
219
+ "entryFile": "index.html",
220
+ "webRoot": ".",
221
+ "files": []
222
+ }
223
+ ```
224
+
225
+ Campos principais:
226
+
227
+ | Campo | Para que serve |
228
+ | --- | --- |
229
+ | `appName` | Nome visivel do app. |
230
+ | `packageId` | Identificador Android. Precisa ter formato como `com.empresa.app`. |
231
+ | `version` | Versao do app. |
232
+ | `mode` | `fullscreen` para tela cheia ou `standalone` para modo normal. |
233
+ | `entryFile` | Arquivo HTML inicial. Normalmente `index.html`. |
234
+ | `webRoot` | Pasta onde estao os arquivos web. Normalmente `"."`. |
235
+ | `permissions` | Permissoes Android adicionadas ao app. |
236
+ | `plugins` | Plugins Cordova extras. |
237
+ | `androidPlatform` | Versao da plataforma Cordova Android. Padrao: `android@15.0.0`. |
238
+ | `debug` | Se `true`, preserva a pasta temporaria de build. |
239
+ | `release` | Se `true`, gera build release. |
240
+ | `keystore` | Dados de assinatura para build release. |
241
+
242
+ Prioridade de configuracao:
243
+
244
+ 1. Opcoes passadas na CLI ou em `buildApk`.
245
+ 2. `app.json` ou `config.json`.
246
+ 3. Valores padrao do html2apk.
247
+
248
+ ## Exemplo Minimo
249
+
250
+ Este repositorio ja inclui um exemplo em:
251
+
252
+ ```text
253
+ examples/minimal
254
+ ```
255
+
256
+ Para testar:
257
+
258
+ ```bash
259
+ cd examples/minimal
260
+ node ../../bin/html2apk.js doctor
261
+ node ../../bin/html2apk.js build
262
+ ```
263
+
264
+ O APK sai em:
265
+
266
+ ```text
267
+ examples/minimal/dist/
268
+ ```
269
+
270
+ ## Usando Como Biblioteca
271
+
272
+ Tambem e possivel usar pelo Node.js:
273
+
274
+ ```js
275
+ const { buildApk } = require("html2apk");
276
+
277
+ const result = await buildApk();
278
+ console.log(result.apkPath);
279
+ ```
280
+
281
+ Com opcoes:
282
+
283
+ ```js
284
+ const result = await buildApk({
285
+ mode: "fullscreen",
286
+ release: true
287
+ });
288
+ ```
289
+
290
+ Retorno:
291
+
292
+ ```json
293
+ {
294
+ "apkPath": "/app/dist/MeuApp-1.0.0-debug.apk",
295
+ "buildDir": null,
296
+ "logs": [],
297
+ "status": "success",
298
+ "tempCleaned": true
299
+ }
300
+ ```
301
+
302
+ ## Bridge Nativa
303
+
304
+ A v0.1 instala um plugin Cordova local com uma API global simples para recursos Android.
305
+
306
+ No seu JavaScript do app:
307
+
308
+ ```js
309
+ await solicitarPermissaoNotificacoes();
310
+
311
+ toast("Mensagem");
312
+ vibrar(250);
313
+
314
+ notificar({
315
+ titulo: "Pedido aprovado",
316
+ texto: "Toque para abrir os detalhes",
317
+ aoClicar: {
318
+ acao: "abrir-rota",
319
+ rota: "/pedido/123",
320
+ dados: { id: 123 }
321
+ }
322
+ });
323
+
324
+ agendarNotificacao({
325
+ titulo: "Lembrete",
326
+ texto: "Hora de abrir o app",
327
+ quando: Date.now() + 60000,
328
+ aoClicar: {
329
+ acao: "abrir-rota",
330
+ rota: "/lembretes"
331
+ }
332
+ });
333
+
334
+ fullscreen(true);
335
+ ```
336
+
337
+ Clique em notificacao:
338
+
339
+ ```js
340
+ aoClicarNotificacao((evento) => {
341
+ console.log(evento.id, evento.aoClicar || evento.onClick);
342
+ });
343
+
344
+ window.addEventListener("html2apk:notification", (event) => {
345
+ console.log(event.detail);
346
+ });
347
+
348
+ const inicial = await obterNotificacaoInicial();
349
+ ```
350
+
351
+ Permissoes e alarmes:
352
+
353
+ ```js
354
+ const status = await statusPermissaoNotificacoes();
355
+ if (!status.granted) {
356
+ await solicitarPermissaoNotificacoes();
357
+ }
358
+
359
+ const podeUsarAlarmeExato = await podeAgendarNotificacaoExata();
360
+ if (!podeUsarAlarmeExato) {
361
+ await abrirConfiguracaoAlarmeExato();
362
+ }
363
+ ```
364
+
365
+ A bridge cria canal de notificacao, solicita/consulta `POST_NOTIFICATIONS` no Android 13+, abre o app com payload quando a notificacao e clicada, persiste notificacoes agendadas e tenta reagendar apos reboot ou update do app.
366
+
367
+ ## Problemas Comuns
368
+
369
+ ### `doctor` mostra `ERR java` ou `ERR javac`
370
+
371
+ Instale um JDK e configure `JAVA_HOME`.
372
+
373
+ ### `doctor` mostra erro no Android SDK
374
+
375
+ Instale Android Studio ou Android command line tools. Depois instale:
376
+
377
+ ```bash
378
+ sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0"
379
+ ```
380
+
381
+ ### `build` diz que nao encontrou `index.html`
382
+
383
+ Confira `entryFile` e `webRoot` no `app.json`.
384
+
385
+ Exemplo:
386
+
387
+ ```json
388
+ {
389
+ "entryFile": "index.html",
390
+ "webRoot": "."
391
+ }
392
+ ```
393
+
394
+ Se seu HTML fica em `public/index.html`:
395
+
396
+ ```json
397
+ {
398
+ "entryFile": "index.html",
399
+ "webRoot": "public"
400
+ }
401
+ ```
402
+
403
+ ### Quero ver a pasta Cordova gerada
404
+
405
+ Rode:
406
+
407
+ ```bash
408
+ html2apk build --debug
409
+ ```
410
+
411
+ No fim, a CLI mostra o caminho da pasta temporaria.
412
+
413
+ ### O APK foi gerado, onde ele esta?
414
+
415
+ Por padrao:
416
+
417
+ ```text
418
+ dist/
419
+ ```
420
+
421
+ Exemplo:
422
+
423
+ ```text
424
+ dist/MeuApp-1.0.0-debug.apk
425
+ ```
426
+
427
+ ## Interface Visual Para Windows
428
+
429
+ Tambem existe um app visual em Electron. O usuario abre o `html2apk.exe`, escolhe o idioma na primeira execucao, arrasta a pasta do projeto e acompanha tudo pela interface.
430
+
431
+ Fluxo da interface:
432
+
433
+ 1. Arraste ou escolha a pasta do projeto.
434
+ 2. O app mostra `verificando ambiente` antes de liberar as proximas etapas.
435
+ 3. Se faltarem pacotes do Android SDK, ele pede permissao e tenta baixar/instalar mostrando logs.
436
+ 4. Preencha as configuracoes obrigatorias: nome do app, Package ID, versao, modo e icone PNG.
437
+ 5. Revise, clique em `Gerar APK` e acompanhe a barra de progresso.
438
+ 6. Ao concluir, a tela final mostra o APK gerado e botoes para abrir a pasta `dist` ou localizar o arquivo.
439
+
440
+ O PNG escolhido e usado como icone do aplicativo e tambem como imagem da tela inicial do Android, evitando o splash padrao do Cordova.
441
+
442
+ Os logs podem ser abertos em uma barra inferior durante qualquer etapa pelo botao `Mostrar logs`. Se atrapalhar a visualizacao, use `Ocultar logs` e a area principal volta a ocupar a altura da janela.
443
+
444
+ Para rodar a interface em desenvolvimento:
445
+
446
+ ```bash
447
+ npm run desktop
448
+ ```
449
+
450
+ Para gerar o executavel portatil do Windows:
451
+
452
+ ```bash
453
+ npm run build-desktop-win
454
+ ```
455
+
456
+ O resultado fica em:
457
+
458
+ ```text
459
+ dist-desktop/html2apk-portable/html2apk.exe
460
+ ```
461
+
462
+ Esse portatil inclui a interface, o `html2apk`, Cordova e as dependencias Node do projeto. JDK, Gradle e Android SDK sao ferramentas grandes do sistema; quando possivel, a interface tenta completar os pacotes Android com permissao do usuario.
463
+
464
+ ## Executavel Da CLI
465
+
466
+ O projeto tambem mantem scripts antigos para empacotar somente a CLI com `pkg`:
467
+
468
+ ```bash
469
+ npm run build-win
470
+ npm run build-linux
471
+ npm run build-mac
472
+ ```
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("path");
5
+ const { spawn } = require("child_process");
6
+ const electron = require("electron");
7
+
8
+ const env = { ...process.env };
9
+ delete env.ELECTRON_RUN_AS_NODE;
10
+
11
+ const child = spawn(electron, [path.resolve(__dirname, "..", "src", "desktop", "main.js")], {
12
+ env,
13
+ stdio: "inherit",
14
+ windowsHide: false
15
+ });
16
+
17
+ child.on("exit", (code, signal) => {
18
+ if (signal) {
19
+ process.kill(process.pid, signal);
20
+ return;
21
+ }
22
+ process.exit(code || 0);
23
+ });
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { runCli } = require("../src/cli");
5
+
6
+ runCli(process.argv.slice(2)).catch((error) => {
7
+ const message = error && error.stack ? error.stack : String(error);
8
+ console.error(message);
9
+ if (error && Array.isArray(error.logs) && error.logs.length > 0) {
10
+ console.error("\nhtml2apk logs:");
11
+ for (const line of error.logs) {
12
+ console.error(line);
13
+ }
14
+ }
15
+ if (error && error.buildDir) {
16
+ console.error(`\nBuild directory kept: ${error.buildDir}`);
17
+ }
18
+ process.exitCode = 1;
19
+ });
@@ -0,0 +1,27 @@
1
+ {
2
+ "_editMe": "Edite os campos abaixo e rode: html2apk doctor && html2apk build",
3
+ "appName": "MeuApp",
4
+ "packageId": "com.seuapp.meuapp",
5
+ "version": "1.0.0",
6
+ "mode": "fullscreen",
7
+ "icon": "",
8
+ "splash": "",
9
+ "permissions": [
10
+ "INTERNET",
11
+ "POST_NOTIFICATIONS",
12
+ "VIBRATE"
13
+ ],
14
+ "plugins": [],
15
+ "release": false,
16
+ "androidPlatform": "android@15.0.0",
17
+ "keystore": {
18
+ "path": "",
19
+ "alias": "",
20
+ "storePassword": "",
21
+ "keyPassword": ""
22
+ },
23
+ "debug": false,
24
+ "entryFile": "index.html",
25
+ "webRoot": ".",
26
+ "files": []
27
+ }
@@ -0,0 +1,41 @@
1
+ <!doctype html>
2
+ <html lang="pt-BR">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>MeuApp</title>
7
+ <style>
8
+ body {
9
+ min-height: 100vh;
10
+ margin: 0;
11
+ display: grid;
12
+ place-items: center;
13
+ font-family: system-ui, sans-serif;
14
+ background: #101820;
15
+ color: white;
16
+ }
17
+
18
+ main {
19
+ width: min(92vw, 420px);
20
+ display: grid;
21
+ gap: 12px;
22
+ }
23
+
24
+ button {
25
+ min-height: 44px;
26
+ border: 0;
27
+ border-radius: 8px;
28
+ font: inherit;
29
+ }
30
+ </style>
31
+ </head>
32
+ <body>
33
+ <main>
34
+ <h1>MeuApp</h1>
35
+ <button onclick="toast('Ola do Android')">Toast</button>
36
+ <button onclick="vibrar(250)">Vibrar</button>
37
+ <button onclick="notificar('Gerada pelo html2apk')">Notificar agora</button>
38
+ </main>
39
+ <script src="cordova.js"></script>
40
+ </body>
41
+ </html>
package/html2apk.png ADDED
Binary file
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ module.exports = require("./src");
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "html2apk",
3
+ "version": "0.1.0",
4
+ "description": "Node CLI and library to turn an HTML/CSS/JS folder into an Android APK through Cordova.",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "html2apk": "./bin/html2apk.js"
8
+ },
9
+ "type": "commonjs",
10
+ "license": "MIT",
11
+ "files": [
12
+ "bin",
13
+ "src",
14
+ "examples",
15
+ "index.js",
16
+ "html2apk.png",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "node bin/html2apk.js build",
21
+ "doctor": "node bin/html2apk.js doctor",
22
+ "desktop": "node bin/html2apk-desktop.js",
23
+ "build-desktop-win": "node scripts/build-desktop-portable.js",
24
+ "test": "node --test",
25
+ "build-win": "pkg . --targets node20-win-x64 --output dist/html2apk.exe",
26
+ "build-linux": "pkg . --targets node20-linux-x64 --output dist/html2apk-linux",
27
+ "build-mac": "pkg . --targets node20-macos-x64 --output dist/html2apk-macos"
28
+ },
29
+ "pkg": {
30
+ "scripts": [
31
+ "src/**/*.js"
32
+ ],
33
+ "assets": [
34
+ "src/templates/**/*"
35
+ ]
36
+ },
37
+ "build": {
38
+ "appId": "dev.caiomultiversando.html2apk",
39
+ "productName": "html2apk",
40
+ "copyright": "Copyright © Dev Caio Multiversando",
41
+ "asar": false,
42
+ "directories": {
43
+ "output": "dist-desktop"
44
+ },
45
+ "files": [
46
+ "bin/**/*",
47
+ "src/**/*",
48
+ "index.js",
49
+ "package.json",
50
+ "package-lock.json",
51
+ "README.md",
52
+ "html2apk.png",
53
+ "node_modules/**/*"
54
+ ],
55
+ "extraMetadata": {
56
+ "main": "src/desktop/main.js"
57
+ },
58
+ "win": {
59
+ "target": [
60
+ "portable"
61
+ ],
62
+ "icon": "html2apk.png"
63
+ }
64
+ },
65
+ "devDependencies": {
66
+ "electron": "^42.3.0",
67
+ "electron-builder": "^26.8.1",
68
+ "pkg": "^5.8.1"
69
+ },
70
+ "engines": {
71
+ "node": ">=18"
72
+ },
73
+ "dependencies": {
74
+ "cordova": "^13.0.0"
75
+ }
76
+ }
@@ -0,0 +1,7 @@
1
+ # Android Native Layer
2
+
3
+ The production Android implementation is generated as a local Cordova plugin from:
4
+
5
+ `src/templates/cordova-plugin-html2apk-bridge/src/android`
6
+
7
+ Keeping the Android source inside the template lets each build copy a self-contained plugin into the temporary Cordova project. This directory exists as the top-level Android ownership boundary for future native modules, build hooks, signing helpers, and Android-specific orchestration.
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ const path = require("path");
4
+ const { copyDirectory, removePath } = require("../utils/fs-extra");
5
+
6
+ async function installBridgePlugin(buildDir) {
7
+ const source = path.resolve(__dirname, "..", "templates", "cordova-plugin-html2apk-bridge");
8
+ const destination = path.join(buildDir, "html2apk-bridge-plugin");
9
+ await removePath(destination);
10
+ await copyDirectory(source, destination, () => false);
11
+ return destination;
12
+ }
13
+
14
+ module.exports = {
15
+ installBridgePlugin
16
+ };