@24i/smartapps-bigscreen-rnv-build-engine 0.17.0 → 0.17.1-alpha.2054
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 +3 -1
- package/dist/src/constants/platforms.js +1 -0
- package/dist/src/engine.js +5 -0
- package/dist/src/scripts/release/urlsMarkdown.js +1 -0
- package/dist/src/sdks/sdk-xbox/sdkXbox.js +1 -1
- package/dist/src/tasks/task.rnv.build.js +1 -0
- package/dist/src/tasks/task.rnv.configure.js +1 -0
- package/dist/src/tasks/task.rnv.deploy.js +1 -0
- package/dist/src/tasks/task.rnv.project.configure.js +1 -1
- package/dist/src/tasks/task.rnv.start.js +1 -0
- package/dist/templates/platforms/_shared/webpack.base.js +8 -8
- package/docs/PLATFORM_ADD.md +1 -1
- package/package.json +7 -7
- package/renative.engine.json +1 -0
- package/dist/src/__tests__/engine.spec.js +0 -57
- package/dist/src/__tests__/resolvers/resolveBaseUrl.spec.js +0 -99
- package/dist/src/__tests__/resolvers/resolveBuildFileExtension.spec.js +0 -26
- package/dist/src/__tests__/resolvers/resolveBuildFileName.spec.js +0 -89
- package/dist/src/__tests__/resolvers/resolveBuildVersion.spec.js +0 -50
- package/dist/src/__tests__/resolvers/resolveBuildVersionOffset.spec.js +0 -111
- package/dist/src/__tests__/resolvers/resolveDeployLocations.spec.js +0 -98
- package/dist/src/__tests__/resolvers/resolveGenericRnvConfig.spec.js +0 -92
- package/dist/src/__tests__/resolvers/resolveHbbtvDeployConfig.spec.js +0 -35
- package/dist/src/__tests__/resolvers/resolveHbbtvDeployUrl.spec.js +0 -41
- package/dist/src/__tests__/resolvers/resolveHbbtvRemoteBuildDirRelativePath.spec.js +0 -49
- package/dist/src/__tests__/resolvers/resolveSupportedPlatforms.spec.js +0 -22
- package/dist/src/__tests__/resolvers/resolveUsedFlavours.spec.js +0 -38
- package/dist/src/__tests__/resolvers/resolveZippedPlatformBuildsRelativeFilePath.spec.js +0 -18
- package/dist/src/__tests__/sdks/sdk-utils/registerSdkPath.spec.js +0 -60
- package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/sdkInstaller.spec.js +0 -85
- package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/services/clean.spec.js +0 -50
- package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/services/download.spec.js +0 -103
- package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/services/install.spec.js +0 -57
- package/dist/src/__tests__/sdks/sdk-utils/sdk-installer/services/unzip.spec.js +0 -51
- package/dist/src/__tests__/utils/forEachSupportedPlatformFlavour.spec.js +0 -104
- package/dist/src/__tests__/utils/generatePngSpriteMap.spec.js +0 -81
- package/dist/src/__tests__/utils/generateSvgSpriteMap.spec.js +0 -108
- package/dist/src/__tests__/utils/mergeSvgAndPngIcons.spec.js +0 -112
- package/dist/src/__tests__/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.spec.js +0 -116
- package/dist/src/__tests__/utils/replaceRelevantStringsInConfig/replaceTemplateString.spec.js +0 -65
- package/dist/src/__tests__/utils/zipBuildsByPlatforms.spec.js +0 -69
|
@@ -1,112 +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
|
-
const fs_1 = __importDefault(require("fs"));
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const child_process_1 = require("child_process");
|
|
9
|
-
const mergeSvgAndPngIcons_1 = require("../../utils/mergeSvgAndPngIcons");
|
|
10
|
-
describe('mergeSvgAndPngIcons', () => {
|
|
11
|
-
const originalConsoleLogFn = console.log;
|
|
12
|
-
const projectDir = path_1.default.resolve(process.cwd(), 'temp_mergeSvgAndPngIcons');
|
|
13
|
-
const platformAssetsDir = path_1.default.resolve(projectDir, 'platformAssets');
|
|
14
|
-
const runtimeDir = path_1.default.resolve(platformAssetsDir, 'runtime');
|
|
15
|
-
const iconsDir = path_1.default.resolve(projectDir, 'icons');
|
|
16
|
-
const svgCssFilePath = path_1.default.resolve(runtimeDir, 'svg_icons.css');
|
|
17
|
-
const pngCssFilePath = path_1.default.resolve(runtimeDir, 'png_icons.css');
|
|
18
|
-
const svgJsonFilePath = path_1.default.resolve(platformAssetsDir, 'svg_icons.json');
|
|
19
|
-
const pngJsonFilePath = path_1.default.resolve(platformAssetsDir, 'png_icons.json');
|
|
20
|
-
const mergedCssFilePath = path_1.default.resolve(runtimeDir, 'icons.css');
|
|
21
|
-
const mergedJsonFilePath = path_1.default.resolve(platformAssetsDir, 'icons.json');
|
|
22
|
-
const rnvC = {
|
|
23
|
-
runtime: {
|
|
24
|
-
appId: 'appId',
|
|
25
|
-
},
|
|
26
|
-
platform: 'platform1',
|
|
27
|
-
paths: {
|
|
28
|
-
project: {
|
|
29
|
-
dir: projectDir,
|
|
30
|
-
builds: {
|
|
31
|
-
dir: path_1.default.resolve(projectDir, 'platformBuilds'),
|
|
32
|
-
},
|
|
33
|
-
assets: {
|
|
34
|
-
dir: platformAssetsDir,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
buildConfig: {
|
|
39
|
-
common: {
|
|
40
|
-
svgIconsMaskList: [],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
beforeEach(() => {
|
|
45
|
-
fs_1.default.mkdirSync(iconsDir, { recursive: true });
|
|
46
|
-
fs_1.default.mkdirSync(rnvC.paths.project.builds.dir, { recursive: true });
|
|
47
|
-
fs_1.default.mkdirSync(runtimeDir, { recursive: true });
|
|
48
|
-
fs_1.default.writeFileSync(svgCssFilePath, 'svg_icons_css_content');
|
|
49
|
-
fs_1.default.writeFileSync(pngCssFilePath, 'png_icons_css_content');
|
|
50
|
-
fs_1.default.writeFileSync(svgJsonFilePath, JSON.stringify({ svg_icon_json_entry: '' }));
|
|
51
|
-
fs_1.default.writeFileSync(pngJsonFilePath, JSON.stringify({ png_icon_json_entry: '' }));
|
|
52
|
-
console.log = () => { };
|
|
53
|
-
});
|
|
54
|
-
afterEach(() => {
|
|
55
|
-
fs_1.default.rmdirSync(projectDir, { recursive: true });
|
|
56
|
-
console.log = originalConsoleLogFn;
|
|
57
|
-
});
|
|
58
|
-
it('should create icons files from svg_icons and png_icons', () => {
|
|
59
|
-
(0, mergeSvgAndPngIcons_1.mergeSvgAndPngIcons)(rnvC);
|
|
60
|
-
const mergedCssContentRows = fs_1.default.readFileSync(mergedCssFilePath).toString().split('\n');
|
|
61
|
-
expect(mergedCssContentRows).toHaveLength(2);
|
|
62
|
-
expect(mergedCssContentRows[0]).toBe('svg_icons_css_content');
|
|
63
|
-
expect(mergedCssContentRows[1]).toBe('png_icons_css_content');
|
|
64
|
-
const mergedJsonContent = JSON.parse(fs_1.default.readFileSync(mergedJsonFilePath).toString());
|
|
65
|
-
expect(mergedJsonContent).toMatchObject({
|
|
66
|
-
svg_icon_json_entry: '',
|
|
67
|
-
png_icon_json_entry: '',
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
it('should create icons files from svg_icons when png_icons does not exist', () => {
|
|
71
|
-
(0, child_process_1.execSync)(`rm -rf ${pngCssFilePath}`);
|
|
72
|
-
(0, child_process_1.execSync)(`rm -rf ${pngJsonFilePath}`);
|
|
73
|
-
(0, mergeSvgAndPngIcons_1.mergeSvgAndPngIcons)(rnvC);
|
|
74
|
-
const mergedCssContentRows = fs_1.default.readFileSync(mergedCssFilePath).toString().split('\n');
|
|
75
|
-
expect(mergedCssContentRows).toHaveLength(1);
|
|
76
|
-
expect(mergedCssContentRows[0]).toBe('svg_icons_css_content');
|
|
77
|
-
const mergedJsonContent = JSON.parse(fs_1.default.readFileSync(mergedJsonFilePath).toString());
|
|
78
|
-
expect(mergedJsonContent).toMatchObject({
|
|
79
|
-
svg_icon_json_entry: '',
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
it('should create icons files from png_icons when svg_icons does not exist', () => {
|
|
83
|
-
(0, child_process_1.execSync)(`rm -rf ${svgCssFilePath}`);
|
|
84
|
-
(0, child_process_1.execSync)(`rm -rf ${svgJsonFilePath}`);
|
|
85
|
-
(0, mergeSvgAndPngIcons_1.mergeSvgAndPngIcons)(rnvC);
|
|
86
|
-
const mergedCssContentRows = fs_1.default.readFileSync(mergedCssFilePath).toString().split('\n');
|
|
87
|
-
expect(mergedCssContentRows).toHaveLength(1);
|
|
88
|
-
expect(mergedCssContentRows[0]).toBe('png_icons_css_content');
|
|
89
|
-
const mergedJsonContent = JSON.parse(fs_1.default.readFileSync(mergedJsonFilePath).toString());
|
|
90
|
-
expect(mergedJsonContent).toMatchObject({
|
|
91
|
-
png_icon_json_entry: '',
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
it('should create blank icons files from when nothing exists', () => {
|
|
95
|
-
(0, child_process_1.execSync)(`rm -rf ${svgCssFilePath}`);
|
|
96
|
-
(0, child_process_1.execSync)(`rm -rf ${svgJsonFilePath}`);
|
|
97
|
-
(0, child_process_1.execSync)(`rm -rf ${pngCssFilePath}`);
|
|
98
|
-
(0, child_process_1.execSync)(`rm -rf ${pngJsonFilePath}`);
|
|
99
|
-
(0, mergeSvgAndPngIcons_1.mergeSvgAndPngIcons)(rnvC);
|
|
100
|
-
const mergedCssContentRows = fs_1.default.readFileSync(mergedCssFilePath).toString();
|
|
101
|
-
expect(mergedCssContentRows).toHaveLength(0);
|
|
102
|
-
const mergedJsonContent = JSON.parse(fs_1.default.readFileSync(mergedJsonFilePath).toString());
|
|
103
|
-
expect(mergedJsonContent).toMatchObject({});
|
|
104
|
-
});
|
|
105
|
-
it('should remove svg_icons.css and png_icons.css after merge', () => {
|
|
106
|
-
(0, mergeSvgAndPngIcons_1.mergeSvgAndPngIcons)(rnvC);
|
|
107
|
-
expect(fs_1.default.existsSync(mergedCssFilePath)).toBeTruthy();
|
|
108
|
-
expect(fs_1.default.existsSync(mergedJsonFilePath)).toBeTruthy();
|
|
109
|
-
expect(fs_1.default.existsSync(svgCssFilePath)).toBeFalsy();
|
|
110
|
-
expect(fs_1.default.existsSync(pngCssFilePath)).toBeFalsy();
|
|
111
|
-
});
|
|
112
|
-
});
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const replaceRelevantStringsInConfig_1 = require("../../../utils/replaceRelevantStringsInConfig");
|
|
4
|
-
describe('replaceRelevantStringsInConfig', () => {
|
|
5
|
-
it('replaces template strings inside c.buildConfig.defaults object', () => {
|
|
6
|
-
const rnvC = {
|
|
7
|
-
runtime: {
|
|
8
|
-
scheme: 'scheme1',
|
|
9
|
-
},
|
|
10
|
-
platform: 'platform1',
|
|
11
|
-
buildConfig: {
|
|
12
|
-
defaults: {
|
|
13
|
-
defaultProp1: 'defaultProp1',
|
|
14
|
-
defaultProp2: '{{c.buildConfig.defaults.defaultProp1}}',
|
|
15
|
-
defaultProp3: '{{configProps.sharedProp}}',
|
|
16
|
-
defaultProp4: '{{c.buildConfig.defaults.defaultProp5}}',
|
|
17
|
-
},
|
|
18
|
-
platforms: {
|
|
19
|
-
platform1: { sharedProp: 'sharedPropPlatform1' },
|
|
20
|
-
platform2: { sharedProp: 'sharedPropPlatform2' },
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
(0, replaceRelevantStringsInConfig_1.replaceRelevantStringsInConfig)(rnvC);
|
|
25
|
-
expect(rnvC).toStrictEqual({
|
|
26
|
-
runtime: {
|
|
27
|
-
scheme: 'scheme1',
|
|
28
|
-
},
|
|
29
|
-
platform: 'platform1',
|
|
30
|
-
buildConfig: {
|
|
31
|
-
defaults: {
|
|
32
|
-
defaultProp1: 'defaultProp1',
|
|
33
|
-
defaultProp2: 'defaultProp1',
|
|
34
|
-
defaultProp3: 'sharedPropPlatform1',
|
|
35
|
-
defaultProp4: '',
|
|
36
|
-
},
|
|
37
|
-
platforms: {
|
|
38
|
-
platform1: { sharedProp: 'sharedPropPlatform1' },
|
|
39
|
-
platform2: { sharedProp: 'sharedPropPlatform2' },
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
it('replaces template strings inside c.buildConfig.common object', () => {
|
|
45
|
-
const rnvC = {
|
|
46
|
-
runtime: {
|
|
47
|
-
scheme: 'scheme1',
|
|
48
|
-
},
|
|
49
|
-
platform: 'platform1',
|
|
50
|
-
buildConfig: {
|
|
51
|
-
common: {
|
|
52
|
-
commonProp1: 'commonProp1',
|
|
53
|
-
commonProp2: '{{c.buildConfig.common.commonProp1}}',
|
|
54
|
-
commonProp3: '{{configProps.commonProp1}}',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
(0, replaceRelevantStringsInConfig_1.replaceRelevantStringsInConfig)(rnvC);
|
|
59
|
-
expect(rnvC).toStrictEqual({
|
|
60
|
-
runtime: {
|
|
61
|
-
scheme: 'scheme1',
|
|
62
|
-
},
|
|
63
|
-
platform: 'platform1',
|
|
64
|
-
buildConfig: {
|
|
65
|
-
common: {
|
|
66
|
-
commonProp1: 'commonProp1',
|
|
67
|
-
commonProp2: 'commonProp1',
|
|
68
|
-
commonProp3: 'commonProp1',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
it('replaces template strings inside c.buildConfig.platforms object', () => {
|
|
74
|
-
const rnvC = {
|
|
75
|
-
runtime: {
|
|
76
|
-
scheme: 'scheme1',
|
|
77
|
-
},
|
|
78
|
-
platform: 'platform1',
|
|
79
|
-
buildConfig: {
|
|
80
|
-
platforms: {
|
|
81
|
-
platform1: {
|
|
82
|
-
platform1Prop1: '{{c.buildConfig.platforms.platform2.platform2Prop1}}',
|
|
83
|
-
platform1Prop2: 'platform1Prop2',
|
|
84
|
-
commonProp: 'commonPropPlatform1Value',
|
|
85
|
-
},
|
|
86
|
-
platform2: {
|
|
87
|
-
platform2Prop1: 'platform2Prop1',
|
|
88
|
-
platform2Prop2: '{{c.buildConfig.platforms.platform1.platform1Prop2}}',
|
|
89
|
-
commonProp: '{{configProps.commonProp}}',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
(0, replaceRelevantStringsInConfig_1.replaceRelevantStringsInConfig)(rnvC);
|
|
95
|
-
expect(rnvC).toStrictEqual({
|
|
96
|
-
runtime: {
|
|
97
|
-
scheme: 'scheme1',
|
|
98
|
-
},
|
|
99
|
-
platform: 'platform1',
|
|
100
|
-
buildConfig: {
|
|
101
|
-
platforms: {
|
|
102
|
-
platform1: {
|
|
103
|
-
platform1Prop1: 'platform2Prop1',
|
|
104
|
-
platform1Prop2: 'platform1Prop2',
|
|
105
|
-
commonProp: 'commonPropPlatform1Value',
|
|
106
|
-
},
|
|
107
|
-
platform2: {
|
|
108
|
-
platform2Prop1: 'platform2Prop1',
|
|
109
|
-
platform2Prop2: 'platform1Prop2',
|
|
110
|
-
commonProp: 'commonPropPlatform1Value',
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
});
|
package/dist/src/__tests__/utils/replaceRelevantStringsInConfig/replaceTemplateString.spec.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const replaceTemplateString_1 = require("../../../utils/replaceRelevantStringsInConfig/replaceTemplateString");
|
|
4
|
-
describe('replaceTemplateString', () => {
|
|
5
|
-
describe('string input not wrapped into placeholder brackets', () => {
|
|
6
|
-
it('returns input value', () => {
|
|
7
|
-
const rnvC = {};
|
|
8
|
-
expect((0, replaceTemplateString_1.replaceTemplateString)(rnvC, '')).toBe('');
|
|
9
|
-
expect((0, replaceTemplateString_1.replaceTemplateString)(rnvC, 'c')).toBe('c');
|
|
10
|
-
expect((0, replaceTemplateString_1.replaceTemplateString)(rnvC, 'c.buildConfig.projectName')).toBe('c.buildConfig.projectName');
|
|
11
|
-
expect((0, replaceTemplateString_1.replaceTemplateString)(rnvC, 'configProps.engine')).toBe('configProps.engine');
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
describe('string input wrapped into placeholder brackets', () => {
|
|
15
|
-
describe('{{c.}} pattern', () => {
|
|
16
|
-
it('throws when input points to non string value in rnv c object', () => {
|
|
17
|
-
const rnvC = { buildConfig: { common: { deploy: true } } };
|
|
18
|
-
expect(() => (0, replaceTemplateString_1.replaceTemplateString)(rnvC, '{{c.buildConfig}}')).toThrow();
|
|
19
|
-
expect(() => (0, replaceTemplateString_1.replaceTemplateString)(rnvC, '{{c.buildConfig.common}}')).toThrow();
|
|
20
|
-
expect(() => (0, replaceTemplateString_1.replaceTemplateString)(rnvC, '{{c.buildConfig.common.deploy}}')).toThrow();
|
|
21
|
-
});
|
|
22
|
-
it('returns empty string when value is not found in rnv c object', () => {
|
|
23
|
-
const rnvC = {};
|
|
24
|
-
expect((0, replaceTemplateString_1.replaceTemplateString)(rnvC, '{{c.buildConfig.projectName}}')).toBe('');
|
|
25
|
-
});
|
|
26
|
-
it('returns correct value from rnv c object for pattern on input', () => {
|
|
27
|
-
expect((0, replaceTemplateString_1.replaceTemplateString)({ buildConfig: { projectName: 'prj' } }, '{{c.buildConfig.projectName}}')).toBe('prj');
|
|
28
|
-
expect((0, replaceTemplateString_1.replaceTemplateString)({
|
|
29
|
-
buildConfig: {
|
|
30
|
-
projectName: '{{c.buildConfig.common.id}}',
|
|
31
|
-
workspaceID: '{{c.buildConfig.projectName}}',
|
|
32
|
-
common: { id: 'id' },
|
|
33
|
-
},
|
|
34
|
-
}, '{{c.buildConfig.workspaceID}}')).toBe('id');
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
describe('{{configProps.}} pattern', () => {
|
|
38
|
-
it('throws when input points to non string value in rnv c object', () => {
|
|
39
|
-
const rnvC = {
|
|
40
|
-
runtime: { scheme: 'scheme' },
|
|
41
|
-
buildConfig: { common: { deploy: { testProp: true } } },
|
|
42
|
-
};
|
|
43
|
-
expect(() => (0, replaceTemplateString_1.replaceTemplateString)(rnvC, '{{configProps.deploy}}')).toThrow();
|
|
44
|
-
expect(() => (0, replaceTemplateString_1.replaceTemplateString)(rnvC, '{{configProps.deploy.testProp}}')).toThrow();
|
|
45
|
-
});
|
|
46
|
-
it('returns empty string when value is not found in rnv c object', () => {
|
|
47
|
-
const rnvC = {
|
|
48
|
-
platform: 'somePlatform',
|
|
49
|
-
runtime: { scheme: 'scheme' },
|
|
50
|
-
buildConfig: { common: { deploy: { testProp: true } } },
|
|
51
|
-
};
|
|
52
|
-
expect((0, replaceTemplateString_1.replaceTemplateString)(rnvC, '{{configProps.deploy.notExistingProp}}')).toBe('');
|
|
53
|
-
});
|
|
54
|
-
it('returns correct value from rnv c object for pattern on input', () => {
|
|
55
|
-
expect((0, replaceTemplateString_1.replaceTemplateString)({
|
|
56
|
-
buildConfig: {
|
|
57
|
-
projectName: '{{c.buildConfig.common.id}}',
|
|
58
|
-
workspaceID: '{{c.buildConfig.projectName}}',
|
|
59
|
-
common: { id: 'id' },
|
|
60
|
-
},
|
|
61
|
-
}, '{{c.buildConfig.workspaceID}}')).toBe('id');
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,69 +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
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const child_process_1 = __importDefault(require("child_process"));
|
|
9
|
-
const zipBuildsByPlatforms_1 = require("../../utils/zipBuildsByPlatforms");
|
|
10
|
-
const constants_1 = require("../../constants");
|
|
11
|
-
describe('zipBuildsByPlatforms', () => {
|
|
12
|
-
const platformBuildsPath = path_1.default.resolve(process.cwd(), 'platformBuilds');
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
Object.values(constants_1.Platforms).forEach((platform) => {
|
|
15
|
-
const outputPaths = [
|
|
16
|
-
path_1.default.resolve(platformBuildsPath, `${platform}_any_name_1`, 'output'),
|
|
17
|
-
path_1.default.resolve(platformBuildsPath, `${platform}_any_name_2`, 'output'),
|
|
18
|
-
];
|
|
19
|
-
outputPaths.forEach((outputPath) => {
|
|
20
|
-
fs_1.default.mkdirSync(outputPath, { recursive: true });
|
|
21
|
-
fs_1.default.writeFileSync(path_1.default.resolve(outputPath, 'build.zip'), 'data');
|
|
22
|
-
fs_1.default.writeFileSync(path_1.default.resolve(outputPath, 'another_build.zip'), 'data');
|
|
23
|
-
fs_1.default.writeFileSync(path_1.default.resolve(outputPath, 'build.wgt'), 'data');
|
|
24
|
-
fs_1.default.writeFileSync(path_1.default.resolve(outputPath, 'another_build.wgt'), 'data');
|
|
25
|
-
fs_1.default.writeFileSync(path_1.default.resolve(outputPath, 'build.ipk'), 'data');
|
|
26
|
-
fs_1.default.writeFileSync(path_1.default.resolve(outputPath, 'another_build.ipk'), 'data');
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
afterEach(() => {
|
|
31
|
-
fs_1.default.rmdirSync(platformBuildsPath, { recursive: true });
|
|
32
|
-
});
|
|
33
|
-
it('create zip file for each supported platform', () => {
|
|
34
|
-
const rnvC = {
|
|
35
|
-
buildConfig: {
|
|
36
|
-
paths: {
|
|
37
|
-
platformBuildsDir: platformBuildsPath,
|
|
38
|
-
},
|
|
39
|
-
defaults: {
|
|
40
|
-
supportedPlatforms: Object.values(constants_1.Platforms),
|
|
41
|
-
},
|
|
42
|
-
common: {
|
|
43
|
-
appNameInFileName: 'appNameInFileName',
|
|
44
|
-
packageVersion: '1.0.0',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
(0, zipBuildsByPlatforms_1.zipBuildsByPlatforms)(rnvC);
|
|
49
|
-
const zippedBuildsDirPath = path_1.default.resolve(platformBuildsPath, 'zipped_by_platform');
|
|
50
|
-
Object.values(constants_1.Platforms).forEach((platform) => {
|
|
51
|
-
const zippedPlatformBuildFilePath = path_1.default.resolve(zippedBuildsDirPath, `appNameInFileName_${platform}_1.0.0.zip`);
|
|
52
|
-
expect(fs_1.default.existsSync(zippedPlatformBuildFilePath)).toBe(true);
|
|
53
|
-
const zipFileContent = child_process_1.default
|
|
54
|
-
.execSync(`zipinfo -1 ${zippedPlatformBuildFilePath}`)
|
|
55
|
-
.toString()
|
|
56
|
-
.split('\n')
|
|
57
|
-
.filter((filename) => filename.length);
|
|
58
|
-
if (platform === constants_1.Platforms.TIZEN) {
|
|
59
|
-
expect(zipFileContent).toStrictEqual(['another_build.wgt', 'build.wgt']);
|
|
60
|
-
}
|
|
61
|
-
else if (platform === constants_1.Platforms.WEBOS) {
|
|
62
|
-
expect(zipFileContent).toStrictEqual(['another_build.ipk', 'build.ipk']);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
expect(zipFileContent).toStrictEqual(['another_build.zip', 'build.zip']);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
});
|