@24i/smartapps-bigscreen-rnv-build-engine 0.12.2-alpha.1693 → 0.13.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.
- package/dist/src/__tests__/resolvers/resolveDeployLocations.spec.js +12 -1
- package/dist/src/sdks/index.js +3 -1
- package/dist/src/sdks/sdk-xbox/index.js +13 -0
- package/dist/src/sdks/sdk-xbox/sdkXbox.js +159 -0
- package/dist/src/tasks/task.rnv.build.js +4 -1
- package/dist/templates/platforms/_shared/webpack.base.js +1 -1
- package/fixDependency.js +25 -0
- package/jest.config.js +1 -0
- package/package.json +23 -7
|
@@ -13,7 +13,7 @@ const c = {
|
|
|
13
13
|
appId: 'flavour1',
|
|
14
14
|
},
|
|
15
15
|
buildConfig: {
|
|
16
|
-
defaults: { supportedPlatforms: [constants_1.Platforms.TIZEN, constants_1.Platforms.WEBTV, constants_1.Platforms.HBBTV] },
|
|
16
|
+
defaults: { supportedPlatforms: [constants_1.Platforms.TIZEN, constants_1.Platforms.WEBTV, constants_1.Platforms.HBBTV, constants_1.Platforms.XBOX] },
|
|
17
17
|
common: {
|
|
18
18
|
appNameInFileName: 'appName',
|
|
19
19
|
packageVersion: '1.0.0',
|
|
@@ -39,6 +39,11 @@ const c = {
|
|
|
39
39
|
supportedFlavours: ['flavour3'],
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
|
+
xbox: {
|
|
43
|
+
deploy: {
|
|
44
|
+
supportedFlavours: ['flavour1'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
42
47
|
},
|
|
43
48
|
},
|
|
44
49
|
};
|
|
@@ -79,6 +84,12 @@ describe('resolveDeployLocations', () => {
|
|
|
79
84
|
packageUrl: `${bucketBaseUrl}/builds/webtv/flavour1/latest/release/build/appName_webtv_latest.release_flavour1.zip`,
|
|
80
85
|
},
|
|
81
86
|
},
|
|
87
|
+
xbox: {
|
|
88
|
+
flavour1: {
|
|
89
|
+
indexUrl: `${bucketBaseUrl}/builds/xbox/flavour1/latest/release/public/index.html`,
|
|
90
|
+
packageUrl: `${bucketBaseUrl}/builds/xbox/flavour1/latest/release/build/appName_xbox_latest.release_flavour1.zip`,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
82
93
|
},
|
|
83
94
|
},
|
|
84
95
|
},
|
package/dist/src/sdks/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.handlePlatformSdk = exports.SDKWebpack = exports.SDKTizen = exports.SDKWebos = void 0;
|
|
22
|
+
exports.handlePlatformSdk = exports.SDKXbox = exports.SDKWebpack = exports.SDKTizen = exports.SDKWebos = void 0;
|
|
23
23
|
const constants_1 = require("../constants");
|
|
24
24
|
const SDKWebos = __importStar(require("./sdk-webos"));
|
|
25
25
|
exports.SDKWebos = SDKWebos;
|
|
@@ -27,6 +27,8 @@ const SDKTizen = __importStar(require("./sdk-tizen"));
|
|
|
27
27
|
exports.SDKTizen = SDKTizen;
|
|
28
28
|
const SDKWebpack = __importStar(require("./sdk-webpack"));
|
|
29
29
|
exports.SDKWebpack = SDKWebpack;
|
|
30
|
+
const SDKXbox = __importStar(require("./sdk-xbox"));
|
|
31
|
+
exports.SDKXbox = SDKXbox;
|
|
30
32
|
const handlePlatformSdk = async (c) => {
|
|
31
33
|
switch (c.platform) {
|
|
32
34
|
case constants_1.Platforms.TIZEN:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./sdkXbox"), exports);
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildXboxProject = void 0;
|
|
4
|
+
const rnv_1 = require("rnv");
|
|
5
|
+
const sdk_webpack_1 = require("@rnv/sdk-webpack");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const manifoldjs_windows10_1 = require("manifoldjs-windows10");
|
|
9
|
+
const resolvers_1 = require("../../resolvers");
|
|
10
|
+
const fs = fs_1.promises;
|
|
11
|
+
const { logTask } = rnv_1.Logger;
|
|
12
|
+
const hostedAppOutputPath = '/output/hosted';
|
|
13
|
+
const packagedAppOutputPath = '/output/packaged';
|
|
14
|
+
const packagedAppSrcDestination = '/output/packaged/windows10/source/src';
|
|
15
|
+
const appSourcePath = '/project/public';
|
|
16
|
+
const packagedAppEntryUrl = 'src/index.html';
|
|
17
|
+
const wrapperConfigPath = '/wrapperConfig.json';
|
|
18
|
+
const hostedSourceImages = '/output/hosted/windows10/source/images';
|
|
19
|
+
const packagedSourceImages = '/output/packaged/windows10/source/images';
|
|
20
|
+
const hostedManifestImages = '/output/hosted/windows10/manifest/images';
|
|
21
|
+
const packagedManifestImages = '/output/packaged/windows10/manifest/images';
|
|
22
|
+
const identityNamePlaceholder = 'INSERT-YOUR-PACKAGE-IDENTITY-NAME-HERE';
|
|
23
|
+
const identityPublisherPlaceholder = 'INSERT-YOUR-PACKAGE-IDENTITY-PUBLISHER-HERE';
|
|
24
|
+
const publisherDisplayNamePlaceholder = 'INSERT-YOUR-PACKAGE-PROPERTIES-PUBLISHERDISPLAYNAME-HERE';
|
|
25
|
+
class Manifest {
|
|
26
|
+
content = { start_url: '', short_name: '', theme_color: 'white' };
|
|
27
|
+
format = 'w3c';
|
|
28
|
+
}
|
|
29
|
+
const getHostedAppEntryUrl = (c) => {
|
|
30
|
+
const deployLocations = (0, resolvers_1.resolveDeployLocations)(c);
|
|
31
|
+
const keys = Object.keys(deployLocations.versions);
|
|
32
|
+
let url = '';
|
|
33
|
+
if (keys.length > 0) {
|
|
34
|
+
const version = keys[0];
|
|
35
|
+
if (version !== null) {
|
|
36
|
+
const flavour = c.runtime.appId;
|
|
37
|
+
url = deployLocations.versions[version].platforms.xbox?.[flavour].indexUrl ?? '';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return url;
|
|
41
|
+
};
|
|
42
|
+
const getBuildFolder = (c) => `${rnv_1.Common.getPlatformBuildDir(c)}`;
|
|
43
|
+
const zipOutput = async (c) => {
|
|
44
|
+
logTask('zipOutput');
|
|
45
|
+
const defaultZipFileName = `${c.platform}_${c.runtime.appId}.zip`;
|
|
46
|
+
const fileName = (0, resolvers_1.resolveBuildFileName)(c) || defaultZipFileName;
|
|
47
|
+
const outputDirectory = `${getBuildFolder(c)}/output`;
|
|
48
|
+
const tmpOutputDirectory = `${getBuildFolder(c)}/tmpOutput`;
|
|
49
|
+
try {
|
|
50
|
+
await fs.mkdir(tmpOutputDirectory);
|
|
51
|
+
(0, child_process_1.execSync)(`cp -r ${outputDirectory} ${tmpOutputDirectory}`);
|
|
52
|
+
await fs.rm(outputDirectory, { recursive: true, force: true });
|
|
53
|
+
await fs.mkdir(outputDirectory);
|
|
54
|
+
(0, child_process_1.execSync)(`zip -r ${outputDirectory}/${fileName} *`, { cwd: `${tmpOutputDirectory}` });
|
|
55
|
+
await fs.rm(tmpOutputDirectory, { recursive: true, force: true });
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
throw new Error('Unable to zip the output folder');
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const createVSSolution = async (c, outputPath, manifest) => {
|
|
62
|
+
logTask('createVSSolution');
|
|
63
|
+
try {
|
|
64
|
+
manifest.content.short_name = c.buildConfig.common.appName;
|
|
65
|
+
const platform = new manifoldjs_windows10_1.Platform('package', ['windows10']);
|
|
66
|
+
await platform.create(manifest, outputPath, ['windows10'], '');
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
if (e instanceof Error
|
|
70
|
+
&& !e.message.includes('Error retrieving information for module')) {
|
|
71
|
+
console.error(e.message);
|
|
72
|
+
throw new Error('Failed to create VSSolution');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const createHostedApplication = async (c) => {
|
|
77
|
+
logTask('createHostedApplication');
|
|
78
|
+
const manifest = new Manifest();
|
|
79
|
+
manifest.content.start_url = getHostedAppEntryUrl(c);
|
|
80
|
+
await createVSSolution(c, `${getBuildFolder(c)}${hostedAppOutputPath}`, manifest);
|
|
81
|
+
};
|
|
82
|
+
const createPackagedApplication = async (c) => {
|
|
83
|
+
logTask('createPackagedApplication');
|
|
84
|
+
const manifest = new Manifest();
|
|
85
|
+
manifest.content.start_url = packagedAppEntryUrl;
|
|
86
|
+
const sourceDir = `${getBuildFolder(c)}${appSourcePath}`;
|
|
87
|
+
const destinationDirectory = `${getBuildFolder(c)}${packagedAppSrcDestination}`;
|
|
88
|
+
await createVSSolution(c, `${getBuildFolder(c)}${packagedAppOutputPath}`, manifest);
|
|
89
|
+
(0, child_process_1.execSync)(`cp -r ${sourceDir} ${destinationDirectory}`);
|
|
90
|
+
};
|
|
91
|
+
const replacePublisherId = async (c, basePath) => {
|
|
92
|
+
logTask('replacePublisherId');
|
|
93
|
+
const output = `${basePath}/windows10/manifest/appxmanifest.xml`;
|
|
94
|
+
const configPath = `${getBuildFolder(c)}${wrapperConfigPath}`;
|
|
95
|
+
let appxmanifest = null;
|
|
96
|
+
let identityName = null;
|
|
97
|
+
let identityPublisher = null;
|
|
98
|
+
let publisherDisplayName = null;
|
|
99
|
+
try {
|
|
100
|
+
const data = await fs.readFile(configPath, 'utf-8');
|
|
101
|
+
const config = JSON.parse(data);
|
|
102
|
+
({
|
|
103
|
+
identityName = null,
|
|
104
|
+
identityPublisher = null,
|
|
105
|
+
publisherDisplayName = null,
|
|
106
|
+
} = config);
|
|
107
|
+
const appxmanifestData = await fs.readFile(output, 'utf-8');
|
|
108
|
+
appxmanifest = appxmanifestData;
|
|
109
|
+
if (identityName !== null
|
|
110
|
+
&& identityPublisher !== null
|
|
111
|
+
&& publisherDisplayName !== null) {
|
|
112
|
+
appxmanifest = appxmanifest.replace(identityNamePlaceholder, identityName)
|
|
113
|
+
.replace(identityPublisherPlaceholder, identityPublisher)
|
|
114
|
+
.replace(publisherDisplayNamePlaceholder, publisherDisplayName);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
throw new Error('failed to obtain store settings');
|
|
118
|
+
}
|
|
119
|
+
await fs.writeFile(output, appxmanifest ?? '');
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
if (e instanceof Error) {
|
|
123
|
+
throw new Error(`Failed to modify the xbox appxmanifest.xml - ${e.message}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const replaceImages = async (c) => {
|
|
128
|
+
logTask('replaceImages');
|
|
129
|
+
const hostedOutputDirectory = `${getBuildFolder(c)}${hostedSourceImages}`;
|
|
130
|
+
const packagedOutputDirectory = `${getBuildFolder(c)}${packagedSourceImages}`;
|
|
131
|
+
const hostedOutputManifestDirectory = `${getBuildFolder(c)}${hostedManifestImages}`;
|
|
132
|
+
const packagedOutputManifestDirectory = `${getBuildFolder(c)}${packagedManifestImages}`;
|
|
133
|
+
const appIconsDirectory = `${getBuildFolder(c)}/project/appIcons`;
|
|
134
|
+
try {
|
|
135
|
+
await fs.rm(hostedOutputDirectory, { recursive: true, force: true });
|
|
136
|
+
await fs.rm(packagedOutputDirectory, { recursive: true, force: true });
|
|
137
|
+
(0, child_process_1.execSync)(`cp -r ${appIconsDirectory} ${hostedOutputDirectory}`);
|
|
138
|
+
(0, child_process_1.execSync)(`cp -r ${appIconsDirectory} ${packagedOutputDirectory}`);
|
|
139
|
+
(0, child_process_1.execSync)(`cp -r ${appIconsDirectory} ${hostedOutputManifestDirectory}`);
|
|
140
|
+
(0, child_process_1.execSync)(`cp -r ${appIconsDirectory} ${packagedOutputManifestDirectory}`);
|
|
141
|
+
await fs.rm(appIconsDirectory, { recursive: true, force: true });
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
throw new Error('Failed to replace the xbox icons');
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const buildXboxProject = async (c) => {
|
|
148
|
+
logTask('buildXboxProject');
|
|
149
|
+
const outputDirectory = `${getBuildFolder(c)}/output`;
|
|
150
|
+
await (0, sdk_webpack_1.buildCoreWebpackProject)(c);
|
|
151
|
+
await fs.rm(outputDirectory, { recursive: true, force: true });
|
|
152
|
+
await createHostedApplication(c);
|
|
153
|
+
await createPackagedApplication(c);
|
|
154
|
+
await replacePublisherId(c, `${getBuildFolder(c)}${hostedAppOutputPath}`);
|
|
155
|
+
await replacePublisherId(c, `${getBuildFolder(c)}${packagedAppOutputPath}`);
|
|
156
|
+
await replaceImages(c);
|
|
157
|
+
await zipOutput(c);
|
|
158
|
+
};
|
|
159
|
+
exports.buildXboxProject = buildXboxProject;
|
|
@@ -32,6 +32,7 @@ const { logTask } = rnv_1.Logger;
|
|
|
32
32
|
const { buildWeb } = sdks_1.SDKWebpack;
|
|
33
33
|
const { buildTizenProject } = sdks_1.SDKTizen;
|
|
34
34
|
const { buildWebOSProject } = sdks_1.SDKWebos;
|
|
35
|
+
const { buildXboxProject } = sdks_1.SDKXbox;
|
|
35
36
|
const { executeOrSkipTask } = rnv_1.TaskManager;
|
|
36
37
|
const { TASK_BUILD, TASK_PACKAGE, PARAMS } = rnv_1.Constants;
|
|
37
38
|
const makeZipOutput = (c) => {
|
|
@@ -70,10 +71,12 @@ const buildFn = async (c, parentTask, originTask) => {
|
|
|
70
71
|
case constants_1.Platforms.KREATV:
|
|
71
72
|
case constants_1.Platforms.SAPHI:
|
|
72
73
|
case constants_1.Platforms.WEBTV:
|
|
73
|
-
case constants_1.Platforms.XBOX:
|
|
74
74
|
await buildWeb(c);
|
|
75
75
|
makeZipOutput(c);
|
|
76
76
|
return;
|
|
77
|
+
case constants_1.Platforms.XBOX:
|
|
78
|
+
await buildXboxProject(c);
|
|
79
|
+
return;
|
|
77
80
|
case constants_1.Platforms.TIZEN:
|
|
78
81
|
await buildTizenProject(c);
|
|
79
82
|
renameOutput(c);
|
|
@@ -96,7 +96,7 @@ const makeRules = (config, projectDir, isDevServer) => ({
|
|
|
96
96
|
test: /\.[tj]sx$/,
|
|
97
97
|
use: ['source-map-loader'],
|
|
98
98
|
enforce: 'pre',
|
|
99
|
-
exclude: [/node_modules/, /build/, /
|
|
99
|
+
exclude: [/node_modules/, /build/, /__tests__/],
|
|
100
100
|
},
|
|
101
101
|
});
|
|
102
102
|
const makeAliases = (config, projectDir) => {
|
package/fixDependency.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
const process = require('process');
|
|
4
|
+
const fs = require('fs').promises;
|
|
5
|
+
|
|
6
|
+
const main = async (deleteDependencies) => {
|
|
7
|
+
|
|
8
|
+
console.log("Fix dependencies")
|
|
9
|
+
|
|
10
|
+
if (deleteDependencies === undefined) return;
|
|
11
|
+
|
|
12
|
+
for (dependency of deleteDependencies) {
|
|
13
|
+
|
|
14
|
+
const packageLockFilePath = `${dependency.path}`;
|
|
15
|
+
|
|
16
|
+
console.log(packageLockFilePath);
|
|
17
|
+
try {
|
|
18
|
+
await fs.rm(packageLockFilePath, { recursive: true, force: true });
|
|
19
|
+
} catch {
|
|
20
|
+
console.log("error")
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
main(require('./package.json').deleteDependencies);
|
package/jest.config.js
CHANGED
|
@@ -2,6 +2,7 @@ module.exports = {
|
|
|
2
2
|
...require('../../jest.config.base'),
|
|
3
3
|
transformIgnorePatterns: [
|
|
4
4
|
'/node_modules/ansi-color/', // compiler error: Octal literal in strict mode
|
|
5
|
+
'/node_modules/fstream', // compiler error: Octal literal in strict mode
|
|
5
6
|
],
|
|
6
7
|
testEnvironment: 'node',
|
|
7
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/smartapps-bigscreen-rnv-build-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Package with build engine for SmartApps BIGscreen projects...",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,17 +16,32 @@
|
|
|
16
16
|
"lintcheck:cached": "npm run eslint -- --cache && npm run stylelint -- --cache",
|
|
17
17
|
"typecheck:cached": "tsc --noEmit --incremental",
|
|
18
18
|
"test": "jest --passWithNoTests",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"postinstall": "node fixDependency.js"
|
|
20
21
|
},
|
|
22
|
+
"deleteDependencies": [
|
|
23
|
+
{
|
|
24
|
+
"path": "../../unzip2/node_modules/graceful-fs/",
|
|
25
|
+
"version": "^4.2.8"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"path": "./node_modules/fstream/node_modules/graceful-fs/",
|
|
29
|
+
"version": "^4.2.8"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"path": "../../fstream/node_modules/graceful-fs/",
|
|
33
|
+
"version": "^4.2.8"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
21
36
|
"devDependencies": {
|
|
22
|
-
"@types/inquirer": "8.
|
|
37
|
+
"@types/inquirer": "8.2.0",
|
|
23
38
|
"@types/mini-css-extract-plugin": "1.2.2",
|
|
24
|
-
"@types/node": "17.0.
|
|
39
|
+
"@types/node": "17.0.14",
|
|
25
40
|
"@types/semver": "7.3.9",
|
|
26
|
-
"@types/ssh2": "0.5.
|
|
41
|
+
"@types/ssh2": "0.5.51",
|
|
27
42
|
"@types/tapable": "1.0.6",
|
|
28
43
|
"@types/webpack": "4.41.26",
|
|
29
|
-
"nock": "13.2.
|
|
44
|
+
"nock": "13.2.2",
|
|
30
45
|
"svgo": "1.3.2"
|
|
31
46
|
},
|
|
32
47
|
"peerDependencies": {
|
|
@@ -43,6 +58,7 @@
|
|
|
43
58
|
"glob": "7.1.7",
|
|
44
59
|
"html-webpack-harddisk-plugin": "1.0.2",
|
|
45
60
|
"html-webpack-plugin": "4.5.2",
|
|
61
|
+
"manifoldjs-windows10": "^0.1.8",
|
|
46
62
|
"mini-css-extract-plugin": "1.6.2",
|
|
47
63
|
"node-ssh": "11.1.1",
|
|
48
64
|
"ora": "5.4.1",
|
|
@@ -63,5 +79,5 @@
|
|
|
63
79
|
"keywords": [],
|
|
64
80
|
"author": "24i",
|
|
65
81
|
"license": "ISC",
|
|
66
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "8118c9fff07ffff6132bb33eb542b3074a33a396"
|
|
67
83
|
}
|