@saltcorn/mobile-builder 0.8.6-beta.9 → 0.8.6
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/docker/post-installer.js +20 -7
- package/dist/docker/post-installer.js.map +1 -1
- package/dist/mobile-builder.d.ts +8 -2
- package/dist/mobile-builder.d.ts.map +1 -1
- package/dist/mobile-builder.js +13 -2
- package/dist/mobile-builder.js.map +1 -1
- package/dist/utils/common-build-utils.d.ts +11 -0
- package/dist/utils/common-build-utils.d.ts.map +1 -1
- package/dist/utils/common-build-utils.js +63 -1
- package/dist/utils/common-build-utils.js.map +1 -1
- package/dist/utils/cordova-build-utils.d.ts +23 -3
- package/dist/utils/cordova-build-utils.d.ts.map +1 -1
- package/dist/utils/cordova-build-utils.js +75 -10
- package/dist/utils/cordova-build-utils.js.map +1 -1
- package/docker/Dockerfile +2 -1
- package/docker/entry.bash +1 -0
- package/docker/post-installer.js +26 -19
- package/package.json +12 -10
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const { spawn } = require("child_process");
|
|
2
|
+
const { spawn, spawnSync } = require("child_process");
|
|
3
3
|
const { join } = require("path");
|
|
4
4
|
if (process.env.SKIP_DOCKER_IMAGE_INSTALL === "true") {
|
|
5
5
|
console.log("skipping build 'saltcorn/cordova-builder' docker image");
|
|
6
6
|
}
|
|
7
7
|
else {
|
|
8
|
-
const
|
|
8
|
+
const dArgs = [
|
|
9
9
|
"build",
|
|
10
10
|
__dirname,
|
|
11
11
|
"--network",
|
|
12
12
|
"host",
|
|
13
|
+
"--no-cache",
|
|
13
14
|
"-f",
|
|
14
15
|
join(__dirname, "Dockerfile"),
|
|
15
16
|
"-t",
|
|
16
17
|
"saltcorn/cordova-builder",
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
];
|
|
19
|
+
if (process.env.ATTTACH_DOCKER_IMAGE_BUILD === "true") {
|
|
20
|
+
const result = spawnSync("docker", dArgs, { cwd: ".", stdio: "inherit" });
|
|
21
|
+
if (result.error)
|
|
22
|
+
console.log(result.error.toString());
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const child = spawn("docker", dArgs, {
|
|
26
|
+
cwd: ".",
|
|
27
|
+
stdio: "ignore",
|
|
28
|
+
detached: true,
|
|
29
|
+
});
|
|
30
|
+
child.unref();
|
|
31
|
+
child.on("error", () => {
|
|
32
|
+
// console not available
|
|
33
|
+
});
|
|
34
|
+
}
|
|
22
35
|
}
|
|
23
36
|
//# sourceMappingURL=post-installer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-installer.js","sourceRoot":"","sources":["../../docker/post-installer.js"],"names":[],"mappings":";AAAA,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"post-installer.js","sourceRoot":"","sources":["../../docker/post-installer.js"],"names":[],"mappings":";AAAA,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AACtD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAEjC,IAAI,OAAO,CAAC,GAAG,CAAC,yBAAyB,KAAK,MAAM,EAAE;IACpD,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;CACvE;KAAM;IACL,MAAM,KAAK,GAAG;QACZ,OAAO;QACP,SAAS;QACT,WAAW;QACX,MAAM;QACN,YAAY;QACZ,IAAI;QACJ,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC;QAC7B,IAAI;QACJ,0BAA0B;KAC3B,CAAC;IACF,IAAI,OAAO,CAAC,GAAG,CAAC,0BAA0B,KAAK,MAAM,EAAE;QACrD,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAC1E,IAAI,MAAM,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;KACxD;SAAM;QACL,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE;YACnC,GAAG,EAAE,GAAG;YACR,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACrB,wBAAwB;QAC1B,CAAC,CAAC,CAAC;KACJ;CACF"}
|
package/dist/mobile-builder.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ declare type EntryPointType = "view" | "page";
|
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
7
|
export declare class MobileBuilder {
|
|
8
|
+
appName?: string;
|
|
9
|
+
appVersion?: string;
|
|
10
|
+
appIcon?: string;
|
|
8
11
|
templateDir: string;
|
|
9
12
|
buildDir: string;
|
|
10
13
|
cliDir: string;
|
|
@@ -14,13 +17,13 @@ export declare class MobileBuilder {
|
|
|
14
17
|
entryPoint: string;
|
|
15
18
|
entryPointType: EntryPointType;
|
|
16
19
|
serverURL: string;
|
|
20
|
+
splashPage?: string;
|
|
17
21
|
allowOfflineMode: string;
|
|
18
22
|
pluginManager: any;
|
|
19
23
|
plugins: Plugin[];
|
|
20
24
|
packageRoot: string;
|
|
21
25
|
copyTargetDir?: string;
|
|
22
26
|
user?: User;
|
|
23
|
-
copyFileName?: string;
|
|
24
27
|
buildForEmulator?: boolean;
|
|
25
28
|
tenantAppName?: string;
|
|
26
29
|
/**
|
|
@@ -28,6 +31,9 @@ export declare class MobileBuilder {
|
|
|
28
31
|
* @param cfg
|
|
29
32
|
*/
|
|
30
33
|
constructor(cfg: {
|
|
34
|
+
appName?: string;
|
|
35
|
+
appVersion?: string;
|
|
36
|
+
appIcon?: string;
|
|
31
37
|
templateDir: string;
|
|
32
38
|
buildDir: string;
|
|
33
39
|
cliDir: string;
|
|
@@ -37,11 +43,11 @@ export declare class MobileBuilder {
|
|
|
37
43
|
entryPoint: string;
|
|
38
44
|
entryPointType: EntryPointType;
|
|
39
45
|
serverURL: string;
|
|
46
|
+
splashPage?: string;
|
|
40
47
|
allowOfflineMode: string;
|
|
41
48
|
plugins: Plugin[];
|
|
42
49
|
copyTargetDir?: string;
|
|
43
50
|
user?: User;
|
|
44
|
-
copyFileName?: string;
|
|
45
51
|
buildForEmulator?: boolean;
|
|
46
52
|
tenantAppName?: string;
|
|
47
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile-builder.d.ts","sourceRoot":"","sources":["../mobile-builder.ts"],"names":[],"mappings":"AAOA,OAAO,MAAM,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"mobile-builder.d.ts","sourceRoot":"","sources":["../mobile-builder.ts"],"names":[],"mappings":"AAOA,OAAO,MAAM,MAAM,8BAA8B,CAAC;AAuBlD,OAAO,IAAI,MAAM,4BAA4B,CAAC;AAE9C,aAAK,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtC;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,GAAG,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,SAA0B;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;gBACS,GAAG,EAAE;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3B,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,cAAc,CAAC;QAC/B,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;QACzB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,IAAI,CAAC;QACZ,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB;IA0BD;;OAEG;IACG,KAAK;CAqDZ"}
|
package/dist/mobile-builder.js
CHANGED
|
@@ -18,6 +18,9 @@ class MobileBuilder {
|
|
|
18
18
|
*/
|
|
19
19
|
constructor(cfg) {
|
|
20
20
|
this.packageRoot = (0, path_1.join)(__dirname, "../");
|
|
21
|
+
this.appName = cfg.appName;
|
|
22
|
+
this.appVersion = cfg.appVersion;
|
|
23
|
+
this.appIcon = cfg.appIcon;
|
|
21
24
|
this.templateDir = cfg.templateDir;
|
|
22
25
|
this.buildDir = cfg.buildDir;
|
|
23
26
|
this.cliDir = cfg.cliDir;
|
|
@@ -27,6 +30,7 @@ class MobileBuilder {
|
|
|
27
30
|
this.entryPoint = cfg.entryPoint;
|
|
28
31
|
this.entryPointType = cfg.entryPointType;
|
|
29
32
|
this.serverURL = cfg.serverURL;
|
|
33
|
+
this.splashPage = cfg.splashPage;
|
|
30
34
|
this.allowOfflineMode = cfg.allowOfflineMode;
|
|
31
35
|
this.pluginManager = new PluginManager({
|
|
32
36
|
pluginsPath: (0, path_1.join)(this.buildDir, "plugin_packages", "node_modules"),
|
|
@@ -35,7 +39,6 @@ class MobileBuilder {
|
|
|
35
39
|
this.plugins = cfg.plugins;
|
|
36
40
|
this.copyTargetDir = cfg.copyTargetDir;
|
|
37
41
|
this.user = cfg.user;
|
|
38
|
-
this.copyFileName = cfg.copyFileName;
|
|
39
42
|
this.buildForEmulator = cfg.buildForEmulator;
|
|
40
43
|
this.tenantAppName = cfg.tenantAppName;
|
|
41
44
|
}
|
|
@@ -44,6 +47,12 @@ class MobileBuilder {
|
|
|
44
47
|
*/
|
|
45
48
|
async build() {
|
|
46
49
|
(0, cordova_build_utils_1.prepareBuildDir)(this.buildDir, this.templateDir);
|
|
50
|
+
if (this.appName)
|
|
51
|
+
await (0, cordova_build_utils_1.setAppName)(this.buildDir, this.appName);
|
|
52
|
+
if (this.appVersion)
|
|
53
|
+
await (0, cordova_build_utils_1.setAppVersion)(this.buildDir, this.appVersion);
|
|
54
|
+
if (this.appIcon)
|
|
55
|
+
await (0, cordova_build_utils_1.prepareAppIcon)(this.buildDir, this.appIcon);
|
|
47
56
|
(0, common_build_utils_1.copyStaticAssets)(this.buildDir);
|
|
48
57
|
(0, common_build_utils_1.copySbadmin2Deps)(this.buildDir);
|
|
49
58
|
(0, common_build_utils_1.copyTranslationFiles)(this.buildDir);
|
|
@@ -64,12 +73,14 @@ class MobileBuilder {
|
|
|
64
73
|
await (0, package_bundle_utils_1.copyPublicDirs)(this.buildDir);
|
|
65
74
|
await (0, package_bundle_utils_1.installNpmPackages)(this.buildDir, this.pluginManager);
|
|
66
75
|
await (0, common_build_utils_1.buildTablesFile)(this.buildDir);
|
|
76
|
+
if (this.splashPage)
|
|
77
|
+
await (0, common_build_utils_1.prepareSplashPage)(this.buildDir, this.splashPage, this.serverURL, this.tenantAppName, this.user);
|
|
67
78
|
resultCode = await (0, common_build_utils_1.createSqliteDb)(this.buildDir);
|
|
68
79
|
if (resultCode !== 0)
|
|
69
80
|
return resultCode;
|
|
70
81
|
resultCode = (0, cordova_build_utils_1.buildApp)(this.buildDir, this.platforms, this.useDocker, this.buildForEmulator);
|
|
71
82
|
if (resultCode === 0 && this.copyTargetDir) {
|
|
72
|
-
await (0, cordova_build_utils_1.tryCopyAppFiles)(this.buildDir, this.copyTargetDir, this.user, this.
|
|
83
|
+
await (0, cordova_build_utils_1.tryCopyAppFiles)(this.buildDir, this.copyTargetDir, this.user, this.appName);
|
|
73
84
|
}
|
|
74
85
|
return resultCode;
|
|
75
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile-builder.js","sourceRoot":"","sources":["../mobile-builder.ts"],"names":[],"mappings":";;;AAAA,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AACzD,MAAM,EACJ,cAAc,EACd,kBAAkB,GACnB,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAC7C,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACxD,+BAA4B;AAE5B,
|
|
1
|
+
{"version":3,"file":"mobile-builder.js","sourceRoot":"","sources":["../mobile-builder.ts"],"names":[],"mappings":";;;AAAA,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AACzD,MAAM,EACJ,cAAc,EACd,kBAAkB,GACnB,GAAG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D,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAjID,sCAiIC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type User from "@saltcorn/data/models/user";
|
|
1
2
|
/**
|
|
2
3
|
* copy files from 'server/public' into the www folder (with a version_tag prefix)
|
|
3
4
|
* @param buildDir directory where the app will be build
|
|
@@ -30,4 +31,14 @@ export declare function copyTranslationFiles(buildDir: string): void;
|
|
|
30
31
|
* @param buildDir directory where the app will be build
|
|
31
32
|
*/
|
|
32
33
|
export declare function createSqliteDb(buildDir: string): Promise<number | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Prepare a splash page
|
|
36
|
+
* runs a page and writes the html into 'splash_page.html' of the www directory
|
|
37
|
+
* @param buildDir
|
|
38
|
+
* @param pageName splash page
|
|
39
|
+
* @param serverUrl needed, if 'pageName' uses images from the server
|
|
40
|
+
* @param tenantAppName
|
|
41
|
+
* @param user
|
|
42
|
+
*/
|
|
43
|
+
export declare function prepareSplashPage(buildDir: string, pageName: string, serverUrl: string, tenantAppName?: string, user?: User): Promise<void>;
|
|
33
44
|
//# sourceMappingURL=common-build-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-build-utils.d.ts","sourceRoot":"","sources":["../../utils/common-build-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common-build-utils.d.ts","sourceRoot":"","sources":["../../utils/common-build-utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAGnD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,QAoBhD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,QA8BhD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,UAAU,EACV,cAAc,EACd,UAAU,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,EAAE,GAAG,QAaL;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,iBAmBrD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,QAGpD;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,0BAmBpD;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,aAAa,CAAC,EAAE,MAAM,EACtB,IAAI,CAAC,EAAE,IAAI,iBAkDZ"}
|
|
@@ -3,13 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createSqliteDb = exports.copyTranslationFiles = exports.buildTablesFile = exports.writeCfgFile = exports.copySbadmin2Deps = exports.copyStaticAssets = void 0;
|
|
6
|
+
exports.prepareSplashPage = exports.createSqliteDb = exports.copyTranslationFiles = exports.buildTablesFile = exports.writeCfgFile = exports.copySbadmin2Deps = exports.copyStaticAssets = void 0;
|
|
7
7
|
const index_1 = __importDefault(require("@saltcorn/data/db/index"));
|
|
8
8
|
const utils = require("@saltcorn/data/utils");
|
|
9
9
|
const { getSafeSaltcornCmd } = utils;
|
|
10
10
|
const path_1 = require("path");
|
|
11
11
|
const fs_extra_1 = require("fs-extra");
|
|
12
12
|
const child_process_1 = require("child_process");
|
|
13
|
+
const page_1 = __importDefault(require("@saltcorn/data/models/page"));
|
|
14
|
+
const state_1 = require("@saltcorn/data/db/state");
|
|
13
15
|
/**
|
|
14
16
|
* copy files from 'server/public' into the www folder (with a version_tag prefix)
|
|
15
17
|
* @param buildDir directory where the app will be build
|
|
@@ -132,4 +134,64 @@ async function createSqliteDb(buildDir) {
|
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
136
|
exports.createSqliteDb = createSqliteDb;
|
|
137
|
+
/**
|
|
138
|
+
* Prepare a splash page
|
|
139
|
+
* runs a page and writes the html into 'splash_page.html' of the www directory
|
|
140
|
+
* @param buildDir
|
|
141
|
+
* @param pageName splash page
|
|
142
|
+
* @param serverUrl needed, if 'pageName' uses images from the server
|
|
143
|
+
* @param tenantAppName
|
|
144
|
+
* @param user
|
|
145
|
+
*/
|
|
146
|
+
async function prepareSplashPage(buildDir, pageName, serverUrl, tenantAppName, user) {
|
|
147
|
+
try {
|
|
148
|
+
const role = user ? user.role_id : 100;
|
|
149
|
+
const page = page_1.default.findOne({ name: pageName });
|
|
150
|
+
if (!page)
|
|
151
|
+
throw new Error(`The page '${pageName}' does not exist`);
|
|
152
|
+
const state = (0, state_1.getState)();
|
|
153
|
+
if (!state)
|
|
154
|
+
throw new Error("Unable to get the state object");
|
|
155
|
+
// @ts-ignore
|
|
156
|
+
global.window = {};
|
|
157
|
+
const contents = await page.run({}, {
|
|
158
|
+
req: {
|
|
159
|
+
user,
|
|
160
|
+
getLocale: () => {
|
|
161
|
+
return "en";
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
const sbadmin2 = state.plugins["sbadmin2"];
|
|
166
|
+
// @ts-ignore TODO CH fix base_types
|
|
167
|
+
const html = sbadmin2.layout.wrap({
|
|
168
|
+
title: page.title,
|
|
169
|
+
body: { above: [contents] },
|
|
170
|
+
alerts: [],
|
|
171
|
+
role: role,
|
|
172
|
+
menu: [],
|
|
173
|
+
headers: [
|
|
174
|
+
{ css: `static_assets/${index_1.default.connectObj.version_tag}/saltcorn.css` },
|
|
175
|
+
{
|
|
176
|
+
script: `static_assets/${index_1.default.connectObj.version_tag}/saltcorn-common.js`,
|
|
177
|
+
},
|
|
178
|
+
{ script: "js/utils/iframe_view_utils.js" },
|
|
179
|
+
{
|
|
180
|
+
headerTag: `<script>parent.splashConfig = { server_path: '${serverUrl}', tenantAppName: ${tenantAppName}, };</script>`,
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
brand: { name: "" },
|
|
184
|
+
bodyClass: "",
|
|
185
|
+
currentUrl: "",
|
|
186
|
+
});
|
|
187
|
+
// @ts-ignore
|
|
188
|
+
global.window = undefined;
|
|
189
|
+
(0, fs_extra_1.writeFileSync)((0, path_1.join)(buildDir, "www", "splash_page.html"), html);
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
console.log("Unable to build a splash page");
|
|
193
|
+
console.log(error);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
exports.prepareSplashPage = prepareSplashPage;
|
|
135
197
|
//# sourceMappingURL=common-build-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-build-utils.js","sourceRoot":"","sources":["../../utils/common-build-utils.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAyC;AACzC,8CAA+C;AAC/C,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;AACrC,+BAA4B;AAC5B,uCAA0E;AAE1E,iDAA0C;
|
|
1
|
+
{"version":3,"file":"common-build-utils.js","sourceRoot":"","sources":["../../utils/common-build-utils.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAyC;AACzC,8CAA+C;AAC/C,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;AACrC,+BAA4B;AAC5B,uCAA0E;AAE1E,iDAA0C;AAC1C,sEAA8C;AAE9C,mDAAmD;AAEnD;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,MAAM,GAAG,IAAA,WAAI,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACrC,MAAM,SAAS,GAAG,IAAA,WAAI,EAAC,MAAM,EAAE,eAAe,EAAE,eAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3E,IAAI,CAAC,IAAA,qBAAU,EAAC,SAAS,CAAC,EAAE;QAC1B,IAAA,oBAAS,EAAC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AM,CAAC,IAAI,CAAC;YAChC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE;YAC3B,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,EAAE;YACR,OAAO,EAAE;gBACP,EAAE,GAAG,EAAE,iBAAiB,eAAE,CAAC,UAAU,CAAC,WAAW,eAAe,EAAE;gBAClE;oBACE,MAAM,EAAE,iBAAiB,eAAE,CAAC,UAAU,CAAC,WAAW,qBAAqB;iBACxE;gBACD,EAAE,MAAM,EAAE,+BAA+B,EAAE;gBAC3C;oBACE,SAAS,EAAE,iDAAiD,SAAS,qBAAqB,aAAa,eAAe;iBACvH;aACF;YACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACnB,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,EAAE;SACf,CAAC,CAAC;QACH,aAAa;QACb,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC;QAC1B,IAAA,wBAAa,EAAC,IAAA,WAAI,EAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC,EAAE,IAAI,CAAC,CAAC;KAChE;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;AACH,CAAC;AAvDD,8CAuDC"}
|
|
@@ -5,6 +5,26 @@ import type User from "@saltcorn/data/models/user";
|
|
|
5
5
|
* @param templateDir directory of the template code that will be copied to 'buildDir'
|
|
6
6
|
*/
|
|
7
7
|
export declare function prepareBuildDir(buildDir: string, templateDir: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* parse the config.xml file and replace the id and name parameters
|
|
10
|
+
* on error the defaults will be used
|
|
11
|
+
* @param buildDir directory where the app will be build
|
|
12
|
+
* @param appName
|
|
13
|
+
*/
|
|
14
|
+
export declare function setAppName(buildDir: string, appName: string): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* parse the config.xml file and replace the version parameter
|
|
17
|
+
* on error the defaults will be used
|
|
18
|
+
* @param buildDir directory where the app will be build
|
|
19
|
+
* @param appVersion
|
|
20
|
+
*/
|
|
21
|
+
export declare function setAppVersion(buildDir: string, appVersion: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* copy a png file into the build dir and use it as launcher icon
|
|
24
|
+
* @param buildDir
|
|
25
|
+
* @param appIcon path to appIcon file
|
|
26
|
+
*/
|
|
27
|
+
export declare function prepareAppIcon(buildDir: string, appIcon: string): Promise<void>;
|
|
8
28
|
/**
|
|
9
29
|
*
|
|
10
30
|
* @param buildDir directory where the app will be build
|
|
@@ -34,8 +54,8 @@ export declare function callBuild(buildDir: string, platforms: string[], buildFo
|
|
|
34
54
|
* copy .apk / .ipa files to 'copyDir' if they exist
|
|
35
55
|
* @param buildDir directory where the app was build
|
|
36
56
|
* @param copyDir directory where the resulting app file will be copied to
|
|
37
|
-
* @param the user specified by the userEmail (-c) parameter
|
|
38
|
-
* @param
|
|
57
|
+
* @param user the user specified by the userEmail (-c) parameter
|
|
58
|
+
* @param appName
|
|
39
59
|
*/
|
|
40
|
-
export declare function tryCopyAppFiles(buildDir: string, copyDir: string, user: User,
|
|
60
|
+
export declare function tryCopyAppFiles(buildDir: string, copyDir: string, user: User, appName?: string): Promise<void>;
|
|
41
61
|
//# sourceMappingURL=cordova-build-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cordova-build-utils.d.ts","sourceRoot":"","sources":["../../utils/cordova-build-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cordova-build-utils.d.ts","sourceRoot":"","sources":["../../utils/cordova-build-utils.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAInD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAQpE;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAiBjE;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAgBvE;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAYrE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,iBAiBnD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EAAE,EACnB,SAAS,CAAC,EAAE,OAAO,EACnB,gBAAgB,CAAC,EAAE,OAAO,iBAW3B;AAkFD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QASjE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EAAE,EACnB,gBAAgB,CAAC,EAAE,OAAO,iBAe3B;AAoBD;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,MAAM,iBA8BjB"}
|
|
@@ -3,13 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.tryCopyAppFiles = exports.callBuild = exports.addPlatforms = exports.buildApp = exports.buildApkInContainer = exports.prepareBuildDir = void 0;
|
|
6
|
+
exports.tryCopyAppFiles = exports.callBuild = exports.addPlatforms = exports.buildApp = exports.buildApkInContainer = exports.prepareAppIcon = exports.setAppVersion = exports.setAppName = exports.prepareBuildDir = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const fs_extra_1 = require("fs-extra");
|
|
9
9
|
const path_1 = require("path");
|
|
10
10
|
const fs_1 = require("fs");
|
|
11
11
|
const file_1 = __importDefault(require("@saltcorn/data/models/file"));
|
|
12
12
|
const { getState } = require("@saltcorn/data/db/state");
|
|
13
|
+
const xml2js_1 = require("xml2js");
|
|
14
|
+
const utils_1 = require("@saltcorn/data/utils");
|
|
13
15
|
/**
|
|
14
16
|
* copy saltcorn-mobile-app as a template to buildDir
|
|
15
17
|
* @param buildDir directory where the app will be build
|
|
@@ -26,6 +28,65 @@ function prepareBuildDir(buildDir, templateDir) {
|
|
|
26
28
|
console.log(result.output.toString());
|
|
27
29
|
}
|
|
28
30
|
exports.prepareBuildDir = prepareBuildDir;
|
|
31
|
+
/**
|
|
32
|
+
* parse the config.xml file and replace the id and name parameters
|
|
33
|
+
* on error the defaults will be used
|
|
34
|
+
* @param buildDir directory where the app will be build
|
|
35
|
+
* @param appName
|
|
36
|
+
*/
|
|
37
|
+
async function setAppName(buildDir, appName) {
|
|
38
|
+
try {
|
|
39
|
+
const configXml = (0, path_1.join)(buildDir, "config.xml");
|
|
40
|
+
const content = (0, fs_extra_1.readFileSync)(configXml);
|
|
41
|
+
const parsed = await (0, xml2js_1.parseStringPromise)(content);
|
|
42
|
+
parsed.widget.$.id = `${(0, utils_1.removeNonWordChars)(appName)}.mobile.app`;
|
|
43
|
+
parsed.widget.name[0] = appName;
|
|
44
|
+
const xmlBuilder = new xml2js_1.Builder();
|
|
45
|
+
const newCfg = xmlBuilder.buildObject(parsed);
|
|
46
|
+
(0, fs_extra_1.writeFileSync)(configXml, newCfg);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.log(`Unable to set the appName to '${appName}': ${error.message ? error.message : "Unknown error"}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.setAppName = setAppName;
|
|
53
|
+
/**
|
|
54
|
+
* parse the config.xml file and replace the version parameter
|
|
55
|
+
* on error the defaults will be used
|
|
56
|
+
* @param buildDir directory where the app will be build
|
|
57
|
+
* @param appVersion
|
|
58
|
+
*/
|
|
59
|
+
async function setAppVersion(buildDir, appVersion) {
|
|
60
|
+
try {
|
|
61
|
+
const configXml = (0, path_1.join)(buildDir, "config.xml");
|
|
62
|
+
const content = (0, fs_extra_1.readFileSync)(configXml);
|
|
63
|
+
const parsed = await (0, xml2js_1.parseStringPromise)(content);
|
|
64
|
+
parsed.widget.$.version = appVersion;
|
|
65
|
+
const xmlBuilder = new xml2js_1.Builder();
|
|
66
|
+
const newCfg = xmlBuilder.buildObject(parsed);
|
|
67
|
+
(0, fs_extra_1.writeFileSync)(configXml, newCfg);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.log(`Unable to set the appVersion to '${appVersion}': ${error.message ? error.message : "Unknown error"}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.setAppVersion = setAppVersion;
|
|
74
|
+
/**
|
|
75
|
+
* copy a png file into the build dir and use it as launcher icon
|
|
76
|
+
* @param buildDir
|
|
77
|
+
* @param appIcon path to appIcon file
|
|
78
|
+
*/
|
|
79
|
+
async function prepareAppIcon(buildDir, appIcon) {
|
|
80
|
+
try {
|
|
81
|
+
(0, fs_extra_1.copySync)(appIcon, (0, path_1.join)(buildDir, "res", "icon", "android", "icon.png"), {
|
|
82
|
+
overwrite: true,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.log(`Unable to set the app icon '${appIcon}': ${error.message ? error.message : "Unknown error"}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.prepareAppIcon = prepareAppIcon;
|
|
29
90
|
/**
|
|
30
91
|
*
|
|
31
92
|
* @param buildDir directory where the app will be build
|
|
@@ -113,6 +174,14 @@ function addPlugins(buildDir) {
|
|
|
113
174
|
},
|
|
114
175
|
});
|
|
115
176
|
console.log(result.output.toString());
|
|
177
|
+
result = (0, child_process_1.spawnSync)("npm", ["run", "add-plugin", "--", "cordova-plugin-camera"], {
|
|
178
|
+
cwd: buildDir,
|
|
179
|
+
env: {
|
|
180
|
+
...process.env,
|
|
181
|
+
NODE_ENV: "development",
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
console.log(result.output.toString());
|
|
116
185
|
}
|
|
117
186
|
/**
|
|
118
187
|
*
|
|
@@ -172,10 +241,10 @@ function safeEnding(file, ending) {
|
|
|
172
241
|
* copy .apk / .ipa files to 'copyDir' if they exist
|
|
173
242
|
* @param buildDir directory where the app was build
|
|
174
243
|
* @param copyDir directory where the resulting app file will be copied to
|
|
175
|
-
* @param the user specified by the userEmail (-c) parameter
|
|
176
|
-
* @param
|
|
244
|
+
* @param user the user specified by the userEmail (-c) parameter
|
|
245
|
+
* @param appName
|
|
177
246
|
*/
|
|
178
|
-
async function tryCopyAppFiles(buildDir, copyDir, user,
|
|
247
|
+
async function tryCopyAppFiles(buildDir, copyDir, user, appName) {
|
|
179
248
|
if (!(0, fs_extra_1.existsSync)(copyDir)) {
|
|
180
249
|
(0, fs_extra_1.mkdirSync)(copyDir);
|
|
181
250
|
}
|
|
@@ -183,9 +252,7 @@ async function tryCopyAppFiles(buildDir, copyDir, user, appFileName) {
|
|
|
183
252
|
const apkBuildDir = (0, path_1.join)(buildDir, "platforms", "android", "app", "build", "outputs", "apk", "debug");
|
|
184
253
|
const apkFile = fileWithEnding(apkBuildDir, ".apk");
|
|
185
254
|
if (apkFile) {
|
|
186
|
-
const dstFile =
|
|
187
|
-
? safeEnding(appFileName, ".apk")
|
|
188
|
-
: "app-debug.apk";
|
|
255
|
+
const dstFile = appName ? safeEnding(appName, ".apk") : "app-debug.apk";
|
|
189
256
|
(0, fs_extra_1.copySync)((0, path_1.join)(apkBuildDir, apkFile), (0, path_1.join)(copyDir, dstFile));
|
|
190
257
|
await file_1.default.set_xattr_of_existing_file(dstFile, copyDir, user);
|
|
191
258
|
}
|
|
@@ -193,9 +260,7 @@ async function tryCopyAppFiles(buildDir, copyDir, user, appFileName) {
|
|
|
193
260
|
const ipaBuildDir = (0, path_1.join)(buildDir, "platforms", "ios", "build", "device");
|
|
194
261
|
const ipaFile = fileWithEnding(ipaBuildDir, ".ipa");
|
|
195
262
|
if (ipaFile) {
|
|
196
|
-
const dstFile =
|
|
197
|
-
? safeEnding(appFileName, ".ipa")
|
|
198
|
-
: "app-debug.ipa";
|
|
263
|
+
const dstFile = appName ? safeEnding(appName, ".ipa") : "app-debug.ipa";
|
|
199
264
|
(0, fs_extra_1.copySync)((0, path_1.join)(ipaBuildDir, ipaFile), (0, path_1.join)(copyDir, dstFile));
|
|
200
265
|
await file_1.default.set_xattr_of_existing_file(dstFile, copyDir, user);
|
|
201
266
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cordova-build-utils.js","sourceRoot":"","sources":["../../utils/cordova-build-utils.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA0C;AAC1C,
|
|
1
|
+
{"version":3,"file":"cordova-build-utils.js","sourceRoot":"","sources":["../../utils/cordova-build-utils.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA0C;AAC1C,uCAOkB;AAClB,+BAA4B;AAC5B,2BAAiC;AACjC,sEAA8C;AAC9C,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAExD,mCAAqD;AACrD,gDAA0D;AAE1D;;;;GAIG;AACH,SAAgB,eAAe,CAAC,QAAgB,EAAE,WAAmB;IACnE,IAAI,IAAA,qBAAU,EAAC,QAAQ,CAAC;QAAE,IAAA,iBAAM,EAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7E,IAAA,mBAAQ,EAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;I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Ae,CAAC;QACxE,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,OAAO,CAAC,EAAE,IAAA,WAAI,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7D,MAAM,cAAI,CAAC,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;KAC/D;IACD,gBAAgB;IAChB,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC1E,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACpD,IAAI,OAAO,EAAE;QACX,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;QACxE,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,OAAO,CAAC,EAAE,IAAA,WAAI,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7D,MAAM,cAAI,CAAC,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;KAC/D;AACH,CAAC;AAlCD,0CAkCC"}
|
package/docker/Dockerfile
CHANGED
|
@@ -16,7 +16,7 @@ RUN android_sdk/cmdline-tools/latest/bin/sdkmanager "build-tools;30.0.3"
|
|
|
16
16
|
RUN wget -q https://services.gradle.org/distributions/gradle-7.1.1-all.zip \
|
|
17
17
|
&& unzip gradle-7.1.1-all.zip -d /opt
|
|
18
18
|
|
|
19
|
-
RUN npm install -g cordova
|
|
19
|
+
RUN npm install -g cordova@11.1.0
|
|
20
20
|
|
|
21
21
|
# create an empty project, the first init seems to take longer
|
|
22
22
|
WORKDIR /init_project
|
|
@@ -29,6 +29,7 @@ RUN cordova plugin add cordova-plugin-file
|
|
|
29
29
|
RUN cordova plugin add cordova-plugin-inappbrowser
|
|
30
30
|
RUN cordova plugin add cordova-plugin-network-information
|
|
31
31
|
RUN cordova plugin add cordova-plugin-geolocation
|
|
32
|
+
RUN cordova plugin add cordova-plugin-camera
|
|
32
33
|
RUN cordova platform add android
|
|
33
34
|
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
|
|
34
35
|
ENV ANDROID_SDK_ROOT=/android_sdk
|
package/docker/entry.bash
CHANGED
|
@@ -18,6 +18,7 @@ npm run add-plugin /init_project/project/plugins/cordova-plugin-file
|
|
|
18
18
|
npm run add-plugin /init_project/project/plugins/cordova-sqlite-ext
|
|
19
19
|
npm run add-plugin /init_project/project/plugins/cordova-plugin-network-information
|
|
20
20
|
npm run add-plugin /init_project/project/plugins/cordova-plugin-geolocation
|
|
21
|
+
npm run add-plugin /init_project/project/plugins/cordova-plugin-camera
|
|
21
22
|
echo "calling cordova build";
|
|
22
23
|
cordova build android
|
|
23
24
|
|
package/docker/post-installer.js
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
const { spawn } = require("child_process");
|
|
1
|
+
const { spawn, spawnSync } = require("child_process");
|
|
2
2
|
const { join } = require("path");
|
|
3
3
|
|
|
4
4
|
if (process.env.SKIP_DOCKER_IMAGE_INSTALL === "true") {
|
|
5
5
|
console.log("skipping build 'saltcorn/cordova-builder' docker image");
|
|
6
6
|
} else {
|
|
7
|
-
const
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{ cwd: ".", stdio: "
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
const dArgs = [
|
|
8
|
+
"build",
|
|
9
|
+
__dirname,
|
|
10
|
+
"--network",
|
|
11
|
+
"host",
|
|
12
|
+
"--no-cache",
|
|
13
|
+
"-f",
|
|
14
|
+
join(__dirname, "Dockerfile"),
|
|
15
|
+
"-t",
|
|
16
|
+
"saltcorn/cordova-builder",
|
|
17
|
+
];
|
|
18
|
+
if (process.env.ATTTACH_DOCKER_IMAGE_BUILD === "true") {
|
|
19
|
+
const result = spawnSync("docker", dArgs, { cwd: ".", stdio: "inherit" });
|
|
20
|
+
if (result.error) console.log(result.error.toString());
|
|
21
|
+
} else {
|
|
22
|
+
const child = spawn("docker", dArgs, {
|
|
23
|
+
cwd: ".",
|
|
24
|
+
stdio: "ignore",
|
|
25
|
+
detached: true,
|
|
26
|
+
});
|
|
27
|
+
child.unref();
|
|
28
|
+
child.on("error", () => {
|
|
29
|
+
// console not available
|
|
30
|
+
});
|
|
31
|
+
}
|
|
25
32
|
}
|
package/package.json
CHANGED
|
@@ -3,28 +3,30 @@
|
|
|
3
3
|
"description": "plugin to to build a mobile app from a tenant application",
|
|
4
4
|
"homepage": "https://saltcorn.com",
|
|
5
5
|
"repository": "github:saltcorn/saltcorn",
|
|
6
|
-
"version": "0.8.6
|
|
6
|
+
"version": "0.8.6",
|
|
7
7
|
"author": "Christian Hugo",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "webpack --mode development",
|
|
10
10
|
"postinstall": "node ./docker/post-installer.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@saltcorn/markup": "0.8.6
|
|
14
|
-
"@saltcorn/data": "0.8.6
|
|
15
|
-
"@saltcorn/db-common": "0.8.6
|
|
16
|
-
"@saltcorn/server": "0.8.6
|
|
17
|
-
"@saltcorn/base-plugin": "0.8.6
|
|
18
|
-
"@saltcorn/sbadmin2": "0.8.6
|
|
19
|
-
"@saltcorn/mobile-app": "0.8.6
|
|
13
|
+
"@saltcorn/markup": "0.8.6",
|
|
14
|
+
"@saltcorn/data": "0.8.6",
|
|
15
|
+
"@saltcorn/db-common": "0.8.6",
|
|
16
|
+
"@saltcorn/server": "0.8.6",
|
|
17
|
+
"@saltcorn/base-plugin": "0.8.6",
|
|
18
|
+
"@saltcorn/sbadmin2": "0.8.6",
|
|
19
|
+
"@saltcorn/mobile-app": "0.8.6",
|
|
20
20
|
"fs-extra": "^10.0.1",
|
|
21
21
|
"live-plugin-manager": "^0.17.1",
|
|
22
22
|
"webpack-merge": "^5.8.0",
|
|
23
23
|
"webpack": "5.68.0",
|
|
24
|
-
"webpack-cli": "4.9.2"
|
|
24
|
+
"webpack-cli": "4.9.2",
|
|
25
|
+
"xml2js": "0.6.0"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@types/node": "^16.11.7"
|
|
28
|
+
"@types/node": "^16.11.7",
|
|
29
|
+
"@types/xml2js": "0.4.11"
|
|
28
30
|
},
|
|
29
31
|
"main": "./dist/index.js",
|
|
30
32
|
"exports": {
|