@24i/smartapps-bigscreen-rnv-build-engine 0.13.0 → 0.13.1-alpha.1773
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.
|
@@ -7,6 +7,7 @@ const child_process_1 = require("child_process");
|
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const manifoldjs_windows10_1 = require("manifoldjs-windows10");
|
|
9
9
|
const resolvers_1 = require("../../resolvers");
|
|
10
|
+
const xml2js = require('xml2js');
|
|
10
11
|
const fs = fs_1.promises;
|
|
11
12
|
const { logTask } = rnv_1.Logger;
|
|
12
13
|
const hostedAppOutputPath = '/output/hosted';
|
|
@@ -15,6 +16,8 @@ const packagedAppSrcDestination = '/output/packaged/windows10/source/src';
|
|
|
15
16
|
const appSourcePath = '/project/public';
|
|
16
17
|
const packagedAppEntryUrl = 'src/index.html';
|
|
17
18
|
const wrapperConfigPath = '/wrapperConfig.json';
|
|
19
|
+
const hostedAppSource = '/output/hosted/windows10/source';
|
|
20
|
+
const packagedAppSource = '/output/packaged/windows10/source';
|
|
18
21
|
const hostedSourceImages = '/output/hosted/windows10/source/images';
|
|
19
22
|
const packagedSourceImages = '/output/packaged/windows10/source/images';
|
|
20
23
|
const hostedManifestImages = '/output/hosted/windows10/manifest/images';
|
|
@@ -87,6 +90,50 @@ const createPackagedApplication = async (c) => {
|
|
|
87
90
|
const destinationDirectory = `${getBuildFolder(c)}${packagedAppSrcDestination}`;
|
|
88
91
|
await createVSSolution(c, `${getBuildFolder(c)}${packagedAppOutputPath}`, manifest);
|
|
89
92
|
(0, child_process_1.execSync)(`cp -r ${sourceDir} ${destinationDirectory}`);
|
|
93
|
+
await addPackagedFiles(c);
|
|
94
|
+
};
|
|
95
|
+
const readContent = async (c, path) => {
|
|
96
|
+
logTask('readContent');
|
|
97
|
+
const srcDirectory = `${getBuildFolder(c)}${packagedAppSource}/${path}`;
|
|
98
|
+
let content = [];
|
|
99
|
+
try {
|
|
100
|
+
const res = await fs.readdir(srcDirectory, { withFileTypes: true });
|
|
101
|
+
for (var i = 0; i < res.length; i++) {
|
|
102
|
+
const file = res[i];
|
|
103
|
+
const fileNameWithPath = `${path}/${file.name}`;
|
|
104
|
+
if (file.isDirectory()) {
|
|
105
|
+
const subdirectoryContent = await readContent(c, fileNameWithPath);
|
|
106
|
+
content = content.concat(subdirectoryContent);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
content.push(fileNameWithPath);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
throw new Error('Failed to parse project content');
|
|
115
|
+
}
|
|
116
|
+
return content;
|
|
117
|
+
};
|
|
118
|
+
const addPackagedFiles = async (c) => {
|
|
119
|
+
logTask('addPackagedFiles');
|
|
120
|
+
const destinationDirectory = `${getBuildFolder(c)}${packagedAppSource}/App.jsproj`;
|
|
121
|
+
const srcDirectory = `${getBuildFolder(c)}${packagedAppSource}/src`;
|
|
122
|
+
try {
|
|
123
|
+
let xmlString = await fs.readFile(destinationDirectory, 'utf-8');
|
|
124
|
+
const xmlObject = await xml2js.parseStringPromise(xmlString);
|
|
125
|
+
const srcDirectoryContent = await readContent(c, 'src');
|
|
126
|
+
srcDirectoryContent.forEach(element => {
|
|
127
|
+
const contentElement = { $: { Include: element } };
|
|
128
|
+
xmlObject.Project.ItemGroup[1].Content.push(contentElement);
|
|
129
|
+
});
|
|
130
|
+
const builder = new xml2js.Builder();
|
|
131
|
+
xmlString = builder.buildObject(xmlObject);
|
|
132
|
+
await fs.writeFile(destinationDirectory, xmlString);
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
throw new Error('Failed to parse update App.jsproj project file');
|
|
136
|
+
}
|
|
90
137
|
};
|
|
91
138
|
const replacePublisherId = async (c, basePath) => {
|
|
92
139
|
logTask('replacePublisherId');
|
|
@@ -144,6 +191,20 @@ const replaceImages = async (c) => {
|
|
|
144
191
|
throw new Error('Failed to replace the xbox icons');
|
|
145
192
|
}
|
|
146
193
|
};
|
|
194
|
+
const copyWinJS = async (c) => {
|
|
195
|
+
const source = process.cwd() + '/node_modules/@24i/smartapps-bigscreen-rnv-build-engine/dist/src/sdks/sdk-xbox/winjs/directionalnavigation-1.0.0.0.js ';
|
|
196
|
+
const packagedAppDestination = `${getBuildFolder(c)}${packagedAppSource}/lib/TVHelpers`;
|
|
197
|
+
const hostedAppDestination = `${getBuildFolder(c)}${hostedAppSource}/lib/TVHelpers`;
|
|
198
|
+
try {
|
|
199
|
+
await fs.mkdir(packagedAppDestination, { recursive: true });
|
|
200
|
+
await fs.mkdir(hostedAppDestination, { recursive: true });
|
|
201
|
+
(0, child_process_1.execSync)(`cp -r ${source} ${packagedAppDestination}`);
|
|
202
|
+
(0, child_process_1.execSync)(`cp -r ${source} ${hostedAppDestination}`);
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
throw new Error('Failed to copy the winJS library');
|
|
206
|
+
}
|
|
207
|
+
};
|
|
147
208
|
const buildXboxProject = async (c) => {
|
|
148
209
|
logTask('buildXboxProject');
|
|
149
210
|
const outputDirectory = `${getBuildFolder(c)}/output`;
|
|
@@ -154,6 +215,7 @@ const buildXboxProject = async (c) => {
|
|
|
154
215
|
await replacePublisherId(c, `${getBuildFolder(c)}${hostedAppOutputPath}`);
|
|
155
216
|
await replacePublisherId(c, `${getBuildFolder(c)}${packagedAppOutputPath}`);
|
|
156
217
|
await replaceImages(c);
|
|
218
|
+
await copyWinJS(c);
|
|
157
219
|
await zipOutput(c);
|
|
158
220
|
};
|
|
159
221
|
exports.buildXboxProject = buildXboxProject;
|
|
@@ -32,6 +32,10 @@ const htmlTemp = (options) => {
|
|
|
32
32
|
if (debug === 'true' && debugIp) {
|
|
33
33
|
remoteDebugScript = `<script src="http://${debugIp}:8080/target/target-script-min.js#anonymous"></script>`;
|
|
34
34
|
}
|
|
35
|
+
let xboxScripts = '';
|
|
36
|
+
if (platform === 'xbox') {
|
|
37
|
+
xboxScripts = '<script src="/lib/TVHelpers/directionalnavigation-1.0.0.0.js"></script>';
|
|
38
|
+
}
|
|
35
39
|
let tizenScripts = '';
|
|
36
40
|
if (platform === 'tizen') {
|
|
37
41
|
tizenScripts = '<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>';
|
|
@@ -55,6 +59,7 @@ ${htmlTag}
|
|
|
55
59
|
${remoteDebugScript}
|
|
56
60
|
${isDebug ? errScript : ''}
|
|
57
61
|
${tizenScripts}
|
|
62
|
+
${xboxScripts}
|
|
58
63
|
${headAppend}
|
|
59
64
|
</head>
|
|
60
65
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/smartapps-bigscreen-rnv-build-engine",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1-alpha.1773+0ebc4329",
|
|
4
4
|
"description": "Package with build engine for SmartApps BIGscreen projects...",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"keywords": [],
|
|
80
80
|
"author": "24i",
|
|
81
81
|
"license": "ISC",
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "0ebc4329453234fbbac0aa10a47c6a2245d9a67a"
|
|
83
83
|
}
|