@saltcorn/mobile-builder 0.9.8 → 1.0.0-beta.1
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/package.json +8 -8
- package/dist/docker/post-installer.d.ts +0 -2
- package/dist/docker/post-installer.d.ts.map +0 -1
- package/dist/docker/post-installer.js +0 -36
- package/dist/docker/post-installer.js.map +0 -1
- package/dist/utils/cordova-build-utils.d.ts +0 -61
- package/dist/utils/cordova-build-utils.d.ts.map +0 -1
- package/dist/utils/cordova-build-utils.js +0 -268
- package/dist/utils/cordova-build-utils.js.map +0 -1
package/package.json
CHANGED
|
@@ -3,20 +3,20 @@
|
|
|
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.
|
|
6
|
+
"version": "1.0.0-beta.1",
|
|
7
7
|
"author": "Christian Hugo",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "jest ./tests/ --runInBand",
|
|
10
10
|
"build": "webpack --mode development"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@saltcorn/markup": "0.
|
|
14
|
-
"@saltcorn/data": "0.
|
|
15
|
-
"@saltcorn/db-common": "0.
|
|
16
|
-
"@saltcorn/server": "0.
|
|
17
|
-
"@saltcorn/base-plugin": "0.
|
|
18
|
-
"@saltcorn/sbadmin2": "0.
|
|
19
|
-
"@saltcorn/mobile-app": "0.
|
|
13
|
+
"@saltcorn/markup": "1.0.0-beta.1",
|
|
14
|
+
"@saltcorn/data": "1.0.0-beta.1",
|
|
15
|
+
"@saltcorn/db-common": "1.0.0-beta.1",
|
|
16
|
+
"@saltcorn/server": "1.0.0-beta.1",
|
|
17
|
+
"@saltcorn/base-plugin": "1.0.0-beta.1",
|
|
18
|
+
"@saltcorn/sbadmin2": "1.0.0-beta.1",
|
|
19
|
+
"@saltcorn/mobile-app": "1.0.0-beta.1",
|
|
20
20
|
"fs-extra": "^10.0.1",
|
|
21
21
|
"live-plugin-manager": "^0.17.1",
|
|
22
22
|
"resize-with-sharp-or-jimp": "0.1.7",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"post-installer.d.ts","sourceRoot":"","sources":["../../docker/post-installer.js"],"names":[],"mappings":""}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const { spawn, spawnSync } = require("child_process");
|
|
3
|
-
const { join } = require("path");
|
|
4
|
-
if (process.env.SKIP_DOCKER_IMAGE_INSTALL === "true") {
|
|
5
|
-
console.log("skipping build 'saltcorn/cordova-builder' docker image");
|
|
6
|
-
}
|
|
7
|
-
else {
|
|
8
|
-
const dArgs = [
|
|
9
|
-
"build",
|
|
10
|
-
__dirname,
|
|
11
|
-
"--network",
|
|
12
|
-
"host",
|
|
13
|
-
"--no-cache",
|
|
14
|
-
"-f",
|
|
15
|
-
join(__dirname, "Dockerfile"),
|
|
16
|
-
"-t",
|
|
17
|
-
"saltcorn/cordova-builder",
|
|
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
|
-
}
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=post-installer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type User from "@saltcorn/data/models/user";
|
|
2
|
-
/**
|
|
3
|
-
* copy saltcorn-mobile-app as a template to buildDir
|
|
4
|
-
* @param buildDir directory where the app will be build
|
|
5
|
-
* @param templateDir directory of the template code that will be copied to 'buildDir'
|
|
6
|
-
*/
|
|
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>;
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param buildDir directory where the app will be build
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
export declare function buildApkInContainer(buildDir: string): number | null;
|
|
34
|
-
/**
|
|
35
|
-
* build '.apk / .ipa' files with cordova (only android is tested)
|
|
36
|
-
* @param flags
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
export declare function buildApp(buildDir: string, platforms: string[], useDocker?: boolean, buildForEmulator?: boolean, appleTeamId?: string): number | null;
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* @param buildDir directory where the app will be build
|
|
43
|
-
* @param platforms
|
|
44
|
-
*/
|
|
45
|
-
export declare function addPlatforms(buildDir: string, platforms: string[]): void;
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @param buildDir directory where the app will be build
|
|
49
|
-
* @param platforms
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
export declare function callBuild(buildDir: string, platforms: string[], buildForEmulator?: boolean, appleTeamId?: string): number | null;
|
|
53
|
-
/**
|
|
54
|
-
* copy .apk / .ipa files to 'copyDir' if they exist
|
|
55
|
-
* @param buildDir directory where the app was build
|
|
56
|
-
* @param copyDir directory where the resulting app file will be copied to
|
|
57
|
-
* @param user the user specified by the userEmail (-c) parameter
|
|
58
|
-
* @param appName
|
|
59
|
-
*/
|
|
60
|
-
export declare function tryCopyAppFiles(buildDir: string, copyDir: string, user: User, appName?: string): Promise<void>;
|
|
61
|
-
//# sourceMappingURL=cordova-build-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cordova-build-utils.d.ts","sourceRoot":"","sources":["../../utils/cordova-build-utils.ts"],"names":[],"mappings":"AAYA,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,EAC1B,WAAW,CAAC,EAAE,MAAM,iBAWrB;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,EAC1B,WAAW,CAAC,EAAE,MAAM,iBAiBrB;AAoBD;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,MAAM,iBA8BjB"}
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.tryCopyAppFiles = exports.callBuild = exports.addPlatforms = exports.buildApp = exports.buildApkInContainer = exports.prepareAppIcon = exports.setAppVersion = exports.setAppName = exports.prepareBuildDir = void 0;
|
|
7
|
-
const child_process_1 = require("child_process");
|
|
8
|
-
const fs_extra_1 = require("fs-extra");
|
|
9
|
-
const path_1 = require("path");
|
|
10
|
-
const fs_1 = require("fs");
|
|
11
|
-
const file_1 = __importDefault(require("@saltcorn/data/models/file"));
|
|
12
|
-
const xml2js_1 = require("xml2js");
|
|
13
|
-
const utils_1 = require("@saltcorn/data/utils");
|
|
14
|
-
/**
|
|
15
|
-
* copy saltcorn-mobile-app as a template to buildDir
|
|
16
|
-
* @param buildDir directory where the app will be build
|
|
17
|
-
* @param templateDir directory of the template code that will be copied to 'buildDir'
|
|
18
|
-
*/
|
|
19
|
-
function prepareBuildDir(buildDir, templateDir) {
|
|
20
|
-
if ((0, fs_extra_1.existsSync)(buildDir))
|
|
21
|
-
(0, fs_extra_1.rmSync)(buildDir, { force: true, recursive: true });
|
|
22
|
-
(0, fs_extra_1.copySync)(templateDir, buildDir);
|
|
23
|
-
(0, fs_extra_1.rmSync)(`${buildDir}/node_modules`, { recursive: true, force: true });
|
|
24
|
-
const result = (0, child_process_1.spawnSync)("npm", ["install", "--legacy-peer-deps"], {
|
|
25
|
-
cwd: buildDir,
|
|
26
|
-
});
|
|
27
|
-
console.log(result.output.toString());
|
|
28
|
-
}
|
|
29
|
-
exports.prepareBuildDir = prepareBuildDir;
|
|
30
|
-
/**
|
|
31
|
-
* parse the config.xml file and replace the id and name parameters
|
|
32
|
-
* on error the defaults will be used
|
|
33
|
-
* @param buildDir directory where the app will be build
|
|
34
|
-
* @param appName
|
|
35
|
-
*/
|
|
36
|
-
async function setAppName(buildDir, appName) {
|
|
37
|
-
try {
|
|
38
|
-
const configXml = (0, path_1.join)(buildDir, "config.xml");
|
|
39
|
-
const content = (0, fs_extra_1.readFileSync)(configXml);
|
|
40
|
-
const parsed = await (0, xml2js_1.parseStringPromise)(content);
|
|
41
|
-
parsed.widget.$.id = `${(0, utils_1.removeNonWordChars)(appName)}.mobile.app`;
|
|
42
|
-
parsed.widget.name[0] = appName;
|
|
43
|
-
const xmlBuilder = new xml2js_1.Builder();
|
|
44
|
-
const newCfg = xmlBuilder.buildObject(parsed);
|
|
45
|
-
(0, fs_extra_1.writeFileSync)(configXml, newCfg);
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
console.log(`Unable to set the appName to '${appName}': ${error.message ? error.message : "Unknown error"}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.setAppName = setAppName;
|
|
52
|
-
/**
|
|
53
|
-
* parse the config.xml file and replace the version parameter
|
|
54
|
-
* on error the defaults will be used
|
|
55
|
-
* @param buildDir directory where the app will be build
|
|
56
|
-
* @param appVersion
|
|
57
|
-
*/
|
|
58
|
-
async function setAppVersion(buildDir, appVersion) {
|
|
59
|
-
try {
|
|
60
|
-
const configXml = (0, path_1.join)(buildDir, "config.xml");
|
|
61
|
-
const content = (0, fs_extra_1.readFileSync)(configXml);
|
|
62
|
-
const parsed = await (0, xml2js_1.parseStringPromise)(content);
|
|
63
|
-
parsed.widget.$.version = appVersion;
|
|
64
|
-
const xmlBuilder = new xml2js_1.Builder();
|
|
65
|
-
const newCfg = xmlBuilder.buildObject(parsed);
|
|
66
|
-
(0, fs_extra_1.writeFileSync)(configXml, newCfg);
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
console.log(`Unable to set the appVersion to '${appVersion}': ${error.message ? error.message : "Unknown error"}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.setAppVersion = setAppVersion;
|
|
73
|
-
/**
|
|
74
|
-
* copy a png file into the build dir and use it as launcher icon
|
|
75
|
-
* @param buildDir
|
|
76
|
-
* @param appIcon path to appIcon file
|
|
77
|
-
*/
|
|
78
|
-
async function prepareAppIcon(buildDir, appIcon) {
|
|
79
|
-
try {
|
|
80
|
-
(0, fs_extra_1.copySync)(appIcon, (0, path_1.join)(buildDir, "res", "icon", "android", "icon.png"), {
|
|
81
|
-
overwrite: true,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
console.log(`Unable to set the app icon '${appIcon}': ${error.message ? error.message : "Unknown error"}`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.prepareAppIcon = prepareAppIcon;
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
* @param buildDir directory where the app will be build
|
|
92
|
-
* @returns
|
|
93
|
-
*/
|
|
94
|
-
function buildApkInContainer(buildDir) {
|
|
95
|
-
const result = (0, child_process_1.spawnSync)("docker", [
|
|
96
|
-
"run",
|
|
97
|
-
"--network",
|
|
98
|
-
"host",
|
|
99
|
-
"-v",
|
|
100
|
-
`${buildDir}:/saltcorn-mobile-app`,
|
|
101
|
-
"saltcorn/cordova-builder",
|
|
102
|
-
], { cwd: "." });
|
|
103
|
-
if (result.output)
|
|
104
|
-
console.log(result.output.toString());
|
|
105
|
-
else if (result.error)
|
|
106
|
-
console.log(result.error.toString());
|
|
107
|
-
else
|
|
108
|
-
console.log("docker finished without output");
|
|
109
|
-
return result.status;
|
|
110
|
-
}
|
|
111
|
-
exports.buildApkInContainer = buildApkInContainer;
|
|
112
|
-
/**
|
|
113
|
-
* build '.apk / .ipa' files with cordova (only android is tested)
|
|
114
|
-
* @param flags
|
|
115
|
-
* @returns
|
|
116
|
-
*/
|
|
117
|
-
function buildApp(buildDir, platforms, useDocker, buildForEmulator, appleTeamId) {
|
|
118
|
-
if (!useDocker) {
|
|
119
|
-
addPlugins(buildDir);
|
|
120
|
-
return callBuild(buildDir, platforms, buildForEmulator, appleTeamId);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
let code = buildApkInContainer(buildDir);
|
|
124
|
-
if (code === 0 && platforms.indexOf("ios") > -1)
|
|
125
|
-
code = callBuild(buildDir, ["ios"], buildForEmulator, appleTeamId);
|
|
126
|
-
return code;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
exports.buildApp = buildApp;
|
|
130
|
-
/**
|
|
131
|
-
* call cordova plugin add ...
|
|
132
|
-
* it loads the dependencies from npm, docker usese cached folders
|
|
133
|
-
* @param buildDir
|
|
134
|
-
*/
|
|
135
|
-
function addPlugins(buildDir) {
|
|
136
|
-
let result = (0, child_process_1.spawnSync)("npm", ["run", "add-plugin", "--", "cordova-sqlite-ext"], {
|
|
137
|
-
cwd: buildDir,
|
|
138
|
-
env: {
|
|
139
|
-
...process.env,
|
|
140
|
-
NODE_ENV: "development",
|
|
141
|
-
},
|
|
142
|
-
});
|
|
143
|
-
console.log(result.output.toString());
|
|
144
|
-
result = (0, child_process_1.spawnSync)("npm", ["run", "add-plugin", "--", "cordova-plugin-file@7.0.0"], {
|
|
145
|
-
cwd: buildDir,
|
|
146
|
-
env: {
|
|
147
|
-
...process.env,
|
|
148
|
-
NODE_ENV: "development",
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
console.log(result.output.toString());
|
|
152
|
-
result = (0, child_process_1.spawnSync)("npm", ["run", "add-plugin", "--", "cordova-plugin-inappbrowser"], {
|
|
153
|
-
cwd: buildDir,
|
|
154
|
-
env: {
|
|
155
|
-
...process.env,
|
|
156
|
-
NODE_ENV: "development",
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
console.log(result.output.toString());
|
|
160
|
-
result = (0, child_process_1.spawnSync)("npm", ["run", "add-plugin", "--", "cordova-plugin-network-information"], {
|
|
161
|
-
cwd: buildDir,
|
|
162
|
-
env: {
|
|
163
|
-
...process.env,
|
|
164
|
-
NODE_ENV: "development",
|
|
165
|
-
},
|
|
166
|
-
});
|
|
167
|
-
console.log(result.output.toString());
|
|
168
|
-
result = (0, child_process_1.spawnSync)("npm", ["run", "add-plugin", "--", "cordova-plugin-geolocation"], {
|
|
169
|
-
cwd: buildDir,
|
|
170
|
-
env: {
|
|
171
|
-
...process.env,
|
|
172
|
-
NODE_ENV: "development",
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
console.log(result.output.toString());
|
|
176
|
-
result = (0, child_process_1.spawnSync)("npm", ["run", "add-plugin", "--", "cordova-plugin-camera"], {
|
|
177
|
-
cwd: buildDir,
|
|
178
|
-
env: {
|
|
179
|
-
...process.env,
|
|
180
|
-
NODE_ENV: "development",
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
|
-
console.log(result.output.toString());
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
*
|
|
187
|
-
* @param buildDir directory where the app will be build
|
|
188
|
-
* @param platforms
|
|
189
|
-
*/
|
|
190
|
-
function addPlatforms(buildDir, platforms) {
|
|
191
|
-
const result = (0, child_process_1.spawnSync)("npm", ["run", "add-platform", "--", ...platforms], {
|
|
192
|
-
cwd: buildDir,
|
|
193
|
-
env: {
|
|
194
|
-
...process.env,
|
|
195
|
-
NODE_ENV: "development",
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
console.log(result.output.toString());
|
|
199
|
-
}
|
|
200
|
-
exports.addPlatforms = addPlatforms;
|
|
201
|
-
/**
|
|
202
|
-
*
|
|
203
|
-
* @param buildDir directory where the app will be build
|
|
204
|
-
* @param platforms
|
|
205
|
-
* @returns
|
|
206
|
-
*/
|
|
207
|
-
function callBuild(buildDir, platforms, buildForEmulator, appleTeamId) {
|
|
208
|
-
addPlatforms(buildDir, platforms);
|
|
209
|
-
let buildParams = [...platforms];
|
|
210
|
-
if (!buildForEmulator) {
|
|
211
|
-
buildParams.push("--device", `--developmentTeam=${appleTeamId}`, "--codeSignIdentity=iPhone Developer", "--automaticProvisioning=true");
|
|
212
|
-
}
|
|
213
|
-
const result = (0, child_process_1.spawnSync)("npm", ["run", "build-app", "--", ...buildParams], {
|
|
214
|
-
cwd: buildDir,
|
|
215
|
-
});
|
|
216
|
-
console.log(result.output.toString());
|
|
217
|
-
return result.status;
|
|
218
|
-
}
|
|
219
|
-
exports.callBuild = callBuild;
|
|
220
|
-
/**
|
|
221
|
-
* find first file with specific ending
|
|
222
|
-
* @param directory directory to search
|
|
223
|
-
* @param ending wantet ending
|
|
224
|
-
*/
|
|
225
|
-
function fileWithEnding(directory, ending) {
|
|
226
|
-
if (!(0, fs_extra_1.existsSync)(directory))
|
|
227
|
-
return null;
|
|
228
|
-
for (const file of (0, fs_1.readdirSync)(directory)) {
|
|
229
|
-
if (file.endsWith(ending))
|
|
230
|
-
return file;
|
|
231
|
-
}
|
|
232
|
-
return null;
|
|
233
|
-
}
|
|
234
|
-
function safeEnding(file, ending) {
|
|
235
|
-
if (!file.endsWith(ending))
|
|
236
|
-
return `${file}${ending}`;
|
|
237
|
-
return file;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* copy .apk / .ipa files to 'copyDir' if they exist
|
|
241
|
-
* @param buildDir directory where the app was build
|
|
242
|
-
* @param copyDir directory where the resulting app file will be copied to
|
|
243
|
-
* @param user the user specified by the userEmail (-c) parameter
|
|
244
|
-
* @param appName
|
|
245
|
-
*/
|
|
246
|
-
async function tryCopyAppFiles(buildDir, copyDir, user, appName) {
|
|
247
|
-
if (!(0, fs_extra_1.existsSync)(copyDir)) {
|
|
248
|
-
(0, fs_extra_1.mkdirSync)(copyDir);
|
|
249
|
-
}
|
|
250
|
-
// android .apk file
|
|
251
|
-
const apkBuildDir = (0, path_1.join)(buildDir, "platforms", "android", "app", "build", "outputs", "apk", "debug");
|
|
252
|
-
const apkFile = fileWithEnding(apkBuildDir, ".apk");
|
|
253
|
-
if (apkFile) {
|
|
254
|
-
const dstFile = appName ? safeEnding(appName, ".apk") : "app-debug.apk";
|
|
255
|
-
(0, fs_extra_1.copySync)((0, path_1.join)(apkBuildDir, apkFile), (0, path_1.join)(copyDir, dstFile));
|
|
256
|
-
await file_1.default.set_xattr_of_existing_file(dstFile, copyDir, user);
|
|
257
|
-
}
|
|
258
|
-
// iOS .ipa file
|
|
259
|
-
const ipaBuildDir = (0, path_1.join)(buildDir, "platforms", "ios", "build", "device");
|
|
260
|
-
const ipaFile = fileWithEnding(ipaBuildDir, ".ipa");
|
|
261
|
-
if (ipaFile) {
|
|
262
|
-
const dstFile = appName ? safeEnding(appName, ".ipa") : "app-debug.ipa";
|
|
263
|
-
(0, fs_extra_1.copySync)((0, path_1.join)(ipaBuildDir, ipaFile), (0, path_1.join)(copyDir, dstFile));
|
|
264
|
-
await file_1.default.set_xattr_of_existing_file(dstFile, copyDir, user);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
exports.tryCopyAppFiles = tryCopyAppFiles;
|
|
268
|
-
//# sourceMappingURL=cordova-build-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAE9C,mCAAqD;AACrD,gDAA0D;AAE1D;;;;GAIG;AACH,SAAgB,eAAe,CAAC,QAAgB,EAAE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