@24i/smartapps-bigscreen-rnv-build-engine 0.0.2-alpha.1355 → 0.0.2-alpha.1357
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/constants/buildSchemes.js +1 -1
- package/dist/src/constants/platforms.js +1 -1
- package/dist/src/index.js +21 -23
- package/dist/src/resolvers/resolveBaseUrl.js +12 -14
- package/dist/src/resolvers/resolveBuildVersion.js +15 -16
- package/dist/src/resolvers/resolveBuildVersionOffset.js +11 -12
- package/dist/src/resolvers/resolveDeployLocations.js +41 -54
- package/dist/src/resolvers/resolveGenericRnvConfig.js +17 -29
- package/dist/src/resolvers/resolveHbbtvDeployConfig.js +2 -2
- package/dist/src/resolvers/resolveHbbtvDeployUrl.js +6 -6
- package/dist/src/resolvers/resolveHbbtvRemoteBuildDirRelativePath.js +11 -11
- package/dist/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.js +10 -10
- package/dist/src/scripts/buildAllWithScheme.js +13 -13
- package/dist/src/scripts/gitReleaser/afterVersionBump.js +9 -10
- package/dist/src/scripts/gitReleaser/beforeVersionBump.js +6 -7
- package/dist/src/scripts/gitReleaser/checkReleaseNotes.js +8 -9
- package/dist/src/scripts/gitReleaser/pushRelease.js +16 -17
- package/dist/src/scripts/gitReleaser/pushReleaseCandidate.js +3 -3
- package/dist/src/scripts/gitReleaser/pushReleaseNotes.js +15 -16
- package/dist/src/scripts/release/deleteSourceMaps.js +5 -5
- package/dist/src/scripts/release/deployToAppCenter.js +34 -35
- package/dist/src/scripts/release/githubRelease.js +56 -60
- package/dist/src/scripts/release/notifySlack/makePayload.js +43 -47
- package/dist/src/scripts/release/notifySlack/notifySlack.js +9 -10
- package/dist/src/scripts/release/notifySlack/slackBlockKitBuilder.js +20 -23
- package/dist/src/scripts/release/sentryRelease.js +33 -36
- package/dist/src/scripts/release/urlsMarkdown.js +22 -24
- package/dist/src/scripts/releaseAllWithScheme.js +25 -25
- package/dist/src/scripts/utils/cmdUtils.js +5 -5
- package/dist/src/scripts/utils/fsUtils.js +5 -5
- package/dist/src/scripts/utils/gitUtils.js +37 -37
- package/dist/src/scripts/utils/stringUtils.js +1 -4
- package/dist/src/sdks/index.js +14 -53
- package/dist/src/sdks/sdk-tizen/index.js +145 -250
- package/dist/src/sdks/sdk-webos/index.js +133 -231
- package/dist/src/sdks/sdk-webpack/index.js +19 -68
- package/dist/src/sdks/sdkUtils.js +13 -58
- package/dist/src/tasks/deploy/aswS3/aws.js +8 -8
- package/dist/src/tasks/deploy/aswS3/deployS3.js +43 -82
- package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +67 -136
- package/dist/src/tasks/engineTasks.js +9 -9
- package/dist/src/tasks/task.rnv.build.js +70 -127
- package/dist/src/tasks/task.rnv.configure.js +37 -87
- package/dist/src/tasks/task.rnv.configureSoft.js +20 -73
- package/dist/src/tasks/task.rnv.deploy.js +27 -77
- package/dist/src/tasks/task.rnv.hooks.run.js +40 -91
- package/dist/src/tasks/task.rnv.package.js +16 -59
- package/dist/src/tasks/task.rnv.project.configure.js +78 -181
- package/dist/src/tasks/task.rnv.start.js +39 -85
- package/dist/src/utils/forEachSupportedPlatformFlavour.js +11 -12
- package/dist/src/utils/replaceRelevantStringsInConfig/replaceRelevantStringsInConfig.js +9 -10
- package/dist/src/utils/replaceRelevantStringsInConfig/replaceTemplateString.js +22 -28
- package/dist/src/utils/zipBuildsByPlatforms.js +24 -24
- package/dist/templates/platforms/_shared/template.js +53 -38
- package/dist/templates/platforms/_shared/webpack.base.js +86 -106
- package/dist/templates/platforms/entone/webpack.config.dev.js +43 -22
- package/dist/templates/platforms/entone/webpack.config.prod.js +38 -21
- package/dist/templates/platforms/hbbtv/webpack.config.dev.js +57 -23
- package/dist/templates/platforms/hbbtv/webpack.config.prod.js +52 -22
- package/dist/templates/platforms/tizen/webpack.config.dev.js +44 -22
- package/dist/templates/platforms/tizen/webpack.config.prod.js +38 -21
- package/dist/templates/platforms/webos/webpack.config.dev.js +47 -24
- package/dist/templates/platforms/webos/webpack.config.prod.js +40 -23
- package/dist/templates/platforms/webtv/webpack.config.dev.js +43 -22
- package/dist/templates/platforms/webtv/webpack.config.prod.js +38 -21
- package/package.json +2 -2
|
@@ -20,10 +20,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.notifySlack = void 0;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const child_process_1 = require("child_process");
|
|
24
|
+
const payload = __importStar(require("./makePayload"));
|
|
25
|
+
const getPayload = (c) => {
|
|
26
|
+
const releaseType = c.runtime.scheme;
|
|
27
27
|
switch (releaseType) {
|
|
28
28
|
case 'dev:latest': return payload.makeDevelopmentPayload(c);
|
|
29
29
|
case 'rc:latest': return payload.makeReleaseCandidatePayload(c);
|
|
@@ -31,12 +31,11 @@ var getPayload = function (c) {
|
|
|
31
31
|
default: throw new Error('Notify Slack: unsupported or undefined release type! Did you pass it as an argument?');
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var cmd = "curl -X POST -H " + contentType + " " + data + " " + webHookUrl;
|
|
34
|
+
const notifySlack = (c) => {
|
|
35
|
+
const contentType = '"Content-type: application/json"';
|
|
36
|
+
const data = `--data '${JSON.stringify(getPayload(c))}'`;
|
|
37
|
+
const webHookUrl = c.buildConfig?.common?.deploy?.slack?.webhookUrl || '';
|
|
38
|
+
const cmd = `curl -X POST -H ${contentType} ${data} ${webHookUrl}`;
|
|
40
39
|
child_process_1.execSync(cmd, { stdio: 'inherit' });
|
|
41
40
|
};
|
|
42
41
|
exports.notifySlack = notifySlack;
|
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Context = exports.Divider = exports.Actions = exports.Section = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const mrkdwn = (text) => ({ type: 'mrkdwn', text });
|
|
5
|
+
const plainText = (text) => ({
|
|
6
6
|
type: 'plain_text',
|
|
7
|
-
text
|
|
7
|
+
text,
|
|
8
8
|
emoji: true,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
var Section = {
|
|
19
|
-
mrkdwn: function (text) { return ({
|
|
9
|
+
});
|
|
10
|
+
const buttonWithUrl = ({ text, url }) => ({
|
|
11
|
+
type: 'button',
|
|
12
|
+
text: plainText(text),
|
|
13
|
+
url,
|
|
14
|
+
});
|
|
15
|
+
const Section = {
|
|
16
|
+
mrkdwn: (text) => ({
|
|
20
17
|
type: 'section',
|
|
21
18
|
text: mrkdwn(text),
|
|
22
|
-
})
|
|
19
|
+
}),
|
|
23
20
|
};
|
|
24
21
|
exports.Section = Section;
|
|
25
|
-
|
|
26
|
-
buttons:
|
|
22
|
+
const Actions = {
|
|
23
|
+
buttons: (btnsData) => ({
|
|
27
24
|
type: 'actions',
|
|
28
25
|
elements: btnsData.map(buttonWithUrl),
|
|
29
|
-
})
|
|
26
|
+
}),
|
|
30
27
|
};
|
|
31
28
|
exports.Actions = Actions;
|
|
32
|
-
|
|
33
|
-
plain:
|
|
29
|
+
const Divider = {
|
|
30
|
+
plain: () => ({ type: 'divider' }),
|
|
34
31
|
};
|
|
35
32
|
exports.Divider = Divider;
|
|
36
|
-
|
|
37
|
-
mrkdwns:
|
|
33
|
+
const Context = {
|
|
34
|
+
mrkdwns: (texts) => ({
|
|
38
35
|
type: 'context',
|
|
39
36
|
elements: texts.map(mrkdwn),
|
|
40
|
-
})
|
|
37
|
+
}),
|
|
41
38
|
};
|
|
42
39
|
exports.Context = Context;
|
|
@@ -20,66 +20,63 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.sentryRelease = void 0;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
executeSync(
|
|
23
|
+
const child_process_1 = require("child_process");
|
|
24
|
+
const fs = __importStar(require("fs"));
|
|
25
|
+
const constants_1 = require("../../constants");
|
|
26
|
+
const UNSUPPORTED_PLATFORMS = [constants_1.Platforms.WEBTV];
|
|
27
|
+
const executeSync = (cmd) => child_process_1.execSync(cmd, { stdio: 'inherit' });
|
|
28
|
+
const createNewRelease = (version) => {
|
|
29
|
+
executeSync(`sentry-cli releases new ${version}`);
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const uploadSourceMaps = (params) => {
|
|
32
|
+
const { version, sourceMapsPath, urlPrefix } = params;
|
|
33
33
|
executeSync('sentry-cli releases '
|
|
34
|
-
+
|
|
35
|
-
+
|
|
36
|
-
+
|
|
34
|
+
+ `files ${version} `
|
|
35
|
+
+ `upload-sourcemaps ${sourceMapsPath} `
|
|
36
|
+
+ `--url-prefix "~/${urlPrefix}" `
|
|
37
37
|
+ '--rewrite --validate');
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
const setReleaseCommits = (version) => {
|
|
40
40
|
try {
|
|
41
|
-
executeSync(
|
|
41
|
+
executeSync(`sentry-cli releases set-commits ${version} --auto --log-level=debug`);
|
|
42
42
|
}
|
|
43
43
|
catch (error) {
|
|
44
44
|
console.log('Sentry release commits failed: ', error);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
|
|
48
|
-
executeSync(
|
|
47
|
+
const finalizeRelease = (version) => {
|
|
48
|
+
executeSync(`sentry-cli releases finalize ${version}`);
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var urlPrefix = "builds/" + platform + "/" + flavour + "/dist/" + version + "/public/content/js/";
|
|
50
|
+
const processPlatform = (c, platform, version) => {
|
|
51
|
+
const processFlavour = (flavour) => {
|
|
52
|
+
const { platformBuildsDir } = c.buildConfig.paths;
|
|
53
|
+
const mapsPath = `${platformBuildsDir}/${flavour}_${platform}-public/public/content/js`;
|
|
54
|
+
const urlPrefix = `builds/${platform}/${flavour}/dist/${version}/public/content/js/`;
|
|
56
55
|
if (!fs.existsSync(mapsPath))
|
|
57
56
|
return;
|
|
58
|
-
console.log(
|
|
59
|
-
uploadSourceMaps({ version
|
|
57
|
+
console.log(`Uploading ${flavour}_${platform} sourcemaps to Sentry...`);
|
|
58
|
+
uploadSourceMaps({ version, sourceMapsPath: mapsPath, urlPrefix });
|
|
60
59
|
};
|
|
61
|
-
|
|
60
|
+
const { supportedFlavours = [] } = c.buildConfig.platforms[platform]?.deploy || {};
|
|
62
61
|
supportedFlavours.forEach(processFlavour);
|
|
63
62
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return !!((_a = sentryConfig.config) === null || _a === void 0 ? void 0 : _a.project);
|
|
63
|
+
const isSentryProjectConfigured = () => {
|
|
64
|
+
const cmd = child_process_1.execSync('sentry-cli info --config-status-json');
|
|
65
|
+
const sentryConfig = JSON.parse(cmd.toString()) || {};
|
|
66
|
+
return !!sentryConfig.config?.project;
|
|
69
67
|
};
|
|
70
|
-
|
|
71
|
-
var _a;
|
|
68
|
+
const sentryRelease = (c) => {
|
|
72
69
|
if (!isSentryProjectConfigured()) {
|
|
73
70
|
console.log('Project is not defined...');
|
|
74
71
|
return;
|
|
75
72
|
}
|
|
76
|
-
|
|
73
|
+
const version = `v${c.buildConfig.common?.packageVersion}`;
|
|
77
74
|
if (!version)
|
|
78
75
|
return;
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
const { supportedPlatforms = [] } = c.buildConfig.defaults || {};
|
|
77
|
+
const supportedPlatformsBySentry = supportedPlatforms.filter((platform) => !UNSUPPORTED_PLATFORMS.includes(platform));
|
|
81
78
|
createNewRelease(version);
|
|
82
|
-
supportedPlatformsBySentry.forEach(
|
|
79
|
+
supportedPlatformsBySentry.forEach((platform) => processPlatform(c, platform, version));
|
|
83
80
|
setReleaseCommits(version);
|
|
84
81
|
finalizeRelease(version);
|
|
85
82
|
console.log('Source Maps uploaded...');
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getUrlsMarkdown = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var platforms = versions[Object.keys(versions)[0]].platforms;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const resolvers_1 = require("../../resolvers");
|
|
6
|
+
const newLine = '\r\n';
|
|
7
|
+
const getDataToProceed = (c, customPlatformList = []) => {
|
|
8
|
+
const locations = resolvers_1.resolveDeployLocations(c);
|
|
9
|
+
const { versions } = locations;
|
|
10
|
+
const { platforms } = versions[Object.keys(versions)[0]];
|
|
12
11
|
if (!customPlatformList.length)
|
|
13
12
|
return platforms;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const outputData = {};
|
|
14
|
+
const addToOutputIfPlatformHasData = (platformName) => {
|
|
15
|
+
const platformData = platforms[platformName];
|
|
17
16
|
if (platformData) {
|
|
18
17
|
outputData[platformName] = platformData;
|
|
19
18
|
}
|
|
@@ -21,7 +20,7 @@ var getDataToProceed = function (c, customPlatformList) {
|
|
|
21
20
|
customPlatformList.forEach(addToOutputIfPlatformHasData);
|
|
22
21
|
return outputData;
|
|
23
22
|
};
|
|
24
|
-
|
|
23
|
+
const beautifyPlatformName = (platformName) => {
|
|
25
24
|
switch (platformName.toLowerCase()) {
|
|
26
25
|
case constants_1.Platforms.ENTONE: return 'Entone';
|
|
27
26
|
case constants_1.Platforms.HBBTV: return 'HbbTV';
|
|
@@ -31,28 +30,27 @@ var beautifyPlatformName = function (platformName) {
|
|
|
31
30
|
default: return platformName;
|
|
32
31
|
}
|
|
33
32
|
};
|
|
34
|
-
|
|
33
|
+
const getPlatformOutput = (data, platformName) => {
|
|
35
34
|
if (platformName === constants_1.Platforms.TIZEN || platformName === constants_1.Platforms.WEBOS) {
|
|
36
35
|
return '';
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
output += "* [" + flavour + "](" + indexUrl + ")" + newLine;
|
|
37
|
+
const platformData = data[platformName];
|
|
38
|
+
let output = `**${beautifyPlatformName(platformName)}**${newLine}`;
|
|
39
|
+
const processPlatformEntry = ([flavour, flavourData]) => {
|
|
40
|
+
const { indexUrl } = flavourData;
|
|
41
|
+
output += `* [${flavour}](${indexUrl})${newLine}`;
|
|
44
42
|
};
|
|
45
43
|
Object.entries(platformData).forEach(processPlatformEntry);
|
|
46
44
|
return output;
|
|
47
45
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.map(
|
|
46
|
+
const getUrlsMarkdown = (c, customPlatformList) => {
|
|
47
|
+
const dataToProceed = getDataToProceed(c, customPlatformList);
|
|
48
|
+
const markdownWithoutHeader = Object.keys(dataToProceed)
|
|
49
|
+
.map((platformName) => getPlatformOutput(dataToProceed, platformName))
|
|
52
50
|
.filter(Boolean)
|
|
53
51
|
.join(newLine);
|
|
54
52
|
if (markdownWithoutHeader.length) {
|
|
55
|
-
|
|
53
|
+
const urlHeader = `${newLine}## URL${newLine}`;
|
|
56
54
|
return urlHeader + markdownWithoutHeader;
|
|
57
55
|
}
|
|
58
56
|
return '';
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
4
|
+
const forEachSupportedPlatformFlavour_1 = require("../utils/forEachSupportedPlatformFlavour");
|
|
5
|
+
const resolvers_1 = require("../resolvers");
|
|
6
|
+
const zipBuildsByPlatforms_1 = require("../utils/zipBuildsByPlatforms");
|
|
7
|
+
const deleteSourceMaps_1 = require("./release/deleteSourceMaps");
|
|
8
|
+
const deployToAppCenter_1 = require("./release/deployToAppCenter");
|
|
9
|
+
const githubRelease_1 = require("./release/githubRelease");
|
|
10
|
+
const notifySlack_1 = require("./release/notifySlack/notifySlack");
|
|
11
|
+
const sentryRelease_1 = require("./release/sentryRelease");
|
|
12
|
+
const deployTask = (options) => {
|
|
13
|
+
const { scheme, platform, flavour } = options;
|
|
14
|
+
const cmd = `npx rnv deploy -s ${scheme} -p ${platform} -c ${flavour} --ci --only`;
|
|
15
15
|
child_process_1.execSync(cmd, { stdio: 'inherit' });
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
const deployBuilds = (c) => {
|
|
18
18
|
console.log('Deploying the builds...');
|
|
19
19
|
forEachSupportedPlatformFlavour_1.forEachSupportedPlatformFlavour(c, deployTask);
|
|
20
20
|
return true;
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
const doLatestDevelopmentRelease = (c) => {
|
|
23
23
|
console.log('doLatestDevelopmentRelease');
|
|
24
24
|
return deployBuilds(c);
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
const doLatestReleaseCandidateRelease = (c) => {
|
|
27
27
|
console.log('doLatestReleaseCandidateRelease');
|
|
28
28
|
deployBuilds(c);
|
|
29
29
|
notifySlack_1.notifySlack(c);
|
|
30
30
|
return true;
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
const doLatestRelease = (c) => {
|
|
33
33
|
console.log('doLatestRelease');
|
|
34
34
|
return deployBuilds(c);
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
const doDistributionRelease = (c) => {
|
|
37
37
|
console.log('doDistributionRelease');
|
|
38
38
|
zipBuildsByPlatforms_1.zipBuildsByPlatforms(c);
|
|
39
39
|
deployBuilds(c);
|
|
@@ -44,12 +44,12 @@ var doDistributionRelease = function (c) {
|
|
|
44
44
|
notifySlack_1.notifySlack(c);
|
|
45
45
|
return true;
|
|
46
46
|
};
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const releaseAllWithScheme = () => {
|
|
48
|
+
const scheme = process.argv[2];
|
|
49
49
|
if (!scheme) {
|
|
50
50
|
throw new Error('No scheme name to use found! Please use rnv scheme name as a param.');
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
const c = resolvers_1.getBaseConfig();
|
|
53
53
|
c.runtime.scheme = scheme;
|
|
54
54
|
switch (scheme) {
|
|
55
55
|
case 'dev:latest':
|
|
@@ -67,12 +67,12 @@ var releaseAllWithScheme = function () {
|
|
|
67
67
|
default:
|
|
68
68
|
throw new Error('Unsupported scheme to release!');
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
const spacing = 4;
|
|
71
71
|
console.log(JSON.stringify(resolvers_1.resolveDeployLocations(c), null, spacing));
|
|
72
72
|
return true;
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
const startTimestamp = Date.now();
|
|
75
75
|
releaseAllWithScheme();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
console.log(
|
|
76
|
+
const msPerSecond = 1000;
|
|
77
|
+
const scriptTotalTimeInSeconds = Math.ceil((Date.now() - startTimestamp) / msPerSecond);
|
|
78
|
+
console.log(`buildAllWithScheme: done in ${scriptTotalTimeInSeconds} second(s)!`);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cmdSyncTrimOut = exports.cmdSyncPipeOut = exports.cmdSyncInheritOut = exports.cmdSync = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const cmdSync = (command, options) => child_process_1.execSync(command, options);
|
|
6
6
|
exports.cmdSync = cmdSync;
|
|
7
|
-
|
|
7
|
+
const cmdSyncInheritOut = (command) => cmdSync(command, { stdio: 'inherit' });
|
|
8
8
|
exports.cmdSyncInheritOut = cmdSyncInheritOut;
|
|
9
|
-
|
|
9
|
+
const cmdSyncPipeOut = (command) => cmdSync(command, { stdio: 'pipe' });
|
|
10
10
|
exports.cmdSyncPipeOut = cmdSyncPipeOut;
|
|
11
|
-
|
|
11
|
+
const cmdSyncTrimOut = (command) => cmdSync(command).toString().trim();
|
|
12
12
|
exports.cmdSyncTrimOut = cmdSyncTrimOut;
|
|
@@ -20,12 +20,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.assertPath = exports.getFileContentAsString = void 0;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const fs = __importStar(require("fs"));
|
|
24
|
+
const assert = __importStar(require("assert"));
|
|
25
|
+
const getFileContentAsString = (filePath) => fs.readFileSync(filePath).toString();
|
|
26
26
|
exports.getFileContentAsString = getFileContentAsString;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const assertPath = (path) => {
|
|
28
|
+
const errorMsg = `File or path ${path} does not exist!`;
|
|
29
29
|
assert.strict.ok(fs.existsSync(path), errorMsg);
|
|
30
30
|
};
|
|
31
31
|
exports.assertPath = assertPath;
|
|
@@ -20,79 +20,79 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.assertRemoteBranch = exports.assertCurrentBranch = exports.assertEmptyStatusList = exports.push = exports.commit = exports.createBranch = exports.checkout = exports.add = exports.addAll = exports.pull = exports.remoteBranchExists = exports.pullRequest = exports.getCurrentBranchName = exports.statusList = void 0;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
const assert = __importStar(require("assert"));
|
|
24
|
+
const cmdUtils_1 = require("./cmdUtils");
|
|
25
|
+
const stringUtils_1 = require("./stringUtils");
|
|
26
|
+
const { ok } = assert.strict;
|
|
27
|
+
const statusList = () => {
|
|
28
|
+
const gitCmd = 'git status --porcelain';
|
|
29
|
+
const outputString = cmdUtils_1.cmdSyncTrimOut(gitCmd);
|
|
30
30
|
if (!outputString)
|
|
31
31
|
return [];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const handleMultipleWhitespaces = (rowString) => {
|
|
33
|
+
const spaceChar = ' ';
|
|
34
|
+
const parts = rowString.split(spaceChar);
|
|
35
35
|
return parts.filter(Boolean).join(spaceChar);
|
|
36
36
|
};
|
|
37
37
|
return stringUtils_1.splitByNewLine(outputString).map(handleMultipleWhitespaces);
|
|
38
38
|
};
|
|
39
39
|
exports.statusList = statusList;
|
|
40
|
-
|
|
40
|
+
const getCurrentBranchName = () => cmdUtils_1.cmdSyncTrimOut('git branch --show-current');
|
|
41
41
|
exports.getCurrentBranchName = getCurrentBranchName;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const pullRequest = (fromBranch, toBranch, prTitle) => {
|
|
43
|
+
const cmdTool = 'hub';
|
|
44
|
+
const installDocUrl = 'https://github.com/github/hub#installation';
|
|
45
|
+
const errorMsg = `${cmdTool} is not installed! See ${installDocUrl}\n`;
|
|
46
46
|
try {
|
|
47
|
-
|
|
47
|
+
const toolPath = cmdUtils_1.cmdSyncTrimOut(`${cmdTool} --version`);
|
|
48
48
|
ok(toolPath, errorMsg);
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
51
|
throw new Error(errorMsg);
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
const cmd = `${cmdTool} pull-request -m "${prTitle}" --head ${fromBranch} --base ${toBranch}`;
|
|
54
54
|
cmdUtils_1.cmdSyncInheritOut(cmd);
|
|
55
55
|
};
|
|
56
56
|
exports.pullRequest = pullRequest;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const remoteBranchExists = (expectedBranchName) => {
|
|
58
|
+
const gitCmd = `git ls-remote --heads origin ${expectedBranchName}`;
|
|
59
|
+
const output = cmdUtils_1.cmdSyncTrimOut(gitCmd);
|
|
60
60
|
return Boolean(output);
|
|
61
61
|
};
|
|
62
62
|
exports.remoteBranchExists = remoteBranchExists;
|
|
63
|
-
|
|
63
|
+
const pull = () => cmdUtils_1.cmdSyncPipeOut('git remote update -p && git merge --ff-only @{u}');
|
|
64
64
|
exports.pull = pull;
|
|
65
|
-
|
|
65
|
+
const addAll = () => cmdUtils_1.cmdSyncPipeOut('git add --all');
|
|
66
66
|
exports.addAll = addAll;
|
|
67
|
-
|
|
67
|
+
const add = (fileList) => cmdUtils_1.cmdSyncPipeOut(`git add ${fileList.join(' ')}`);
|
|
68
68
|
exports.add = add;
|
|
69
|
-
|
|
69
|
+
const checkout = (branchName) => cmdUtils_1.cmdSyncPipeOut(`git checkout ${branchName}`);
|
|
70
70
|
exports.checkout = checkout;
|
|
71
|
-
|
|
71
|
+
const createBranch = (branchName) => cmdUtils_1.cmdSyncPipeOut(`git branch ${branchName}`);
|
|
72
72
|
exports.createBranch = createBranch;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return cmdUtils_1.cmdSyncPipeOut(
|
|
73
|
+
const commit = (commitMessage, noVerify) => {
|
|
74
|
+
const maybeNoVerifyParam = noVerify ? '--no-verify' : '';
|
|
75
|
+
return cmdUtils_1.cmdSyncPipeOut(`git commit -m "${commitMessage}" ${maybeNoVerifyParam}`.trimEnd());
|
|
76
76
|
};
|
|
77
77
|
exports.commit = commit;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
const push = (branchName, noVerify) => {
|
|
79
|
+
const maybeNoVerifyParam = noVerify ? '--no-verify' : '';
|
|
80
|
+
const cmd = `git push --set-upstream origin ${branchName} ${maybeNoVerifyParam}`.trimEnd();
|
|
81
81
|
return cmdUtils_1.cmdSyncPipeOut(cmd);
|
|
82
82
|
};
|
|
83
83
|
exports.push = push;
|
|
84
|
-
|
|
84
|
+
const assertEmptyStatusList = () => {
|
|
85
85
|
ok(statusList().length === 0, 'An empty GIT stage is expected!');
|
|
86
86
|
};
|
|
87
87
|
exports.assertEmptyStatusList = assertEmptyStatusList;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
const assertCurrentBranch = (expectedBranchName) => {
|
|
89
|
+
const currentGitBranchName = getCurrentBranchName();
|
|
90
|
+
const errorMsg = `The ${expectedBranchName} branch is expected to be active, not "${currentGitBranchName}"`;
|
|
91
91
|
ok(currentGitBranchName === expectedBranchName, errorMsg);
|
|
92
92
|
};
|
|
93
93
|
exports.assertCurrentBranch = assertCurrentBranch;
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
const assertRemoteBranch = (expectedBranchName) => {
|
|
95
|
+
const errorMsg = `Remote branch ${expectedBranchName} does not exist!`;
|
|
96
96
|
ok(remoteBranchExists(expectedBranchName), errorMsg);
|
|
97
97
|
};
|
|
98
98
|
exports.assertRemoteBranch = assertRemoteBranch;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.splitByNewLine = void 0;
|
|
4
|
-
|
|
5
|
-
if (string === void 0) { string = ''; }
|
|
6
|
-
return string.split(/\r?\n/);
|
|
7
|
-
};
|
|
4
|
+
const splitByNewLine = (string = '') => string.split(/\r?\n/);
|
|
8
5
|
exports.splitByNewLine = splitByNewLine;
|
package/dist/src/sdks/index.js
CHANGED
|
@@ -18,62 +18,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
31
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
32
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
33
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
|
-
function step(op) {
|
|
35
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
-
while (_) try {
|
|
37
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
38
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
|
-
switch (op[0]) {
|
|
40
|
-
case 0: case 1: t = op; break;
|
|
41
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
42
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
43
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
44
|
-
default:
|
|
45
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
46
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
47
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49
|
-
if (t[2]) _.ops.pop();
|
|
50
|
-
_.trys.pop(); continue;
|
|
51
|
-
}
|
|
52
|
-
op = body.call(thisArg, _);
|
|
53
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
54
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
22
|
exports.handlePlatformSdk = exports.SDKWebpack = exports.SDKTizen = exports.SDKWebos = void 0;
|
|
59
|
-
|
|
60
|
-
|
|
23
|
+
const constants_1 = require("../constants");
|
|
24
|
+
const SDKWebos = __importStar(require("./sdk-webos"));
|
|
61
25
|
exports.SDKWebos = SDKWebos;
|
|
62
|
-
|
|
26
|
+
const SDKTizen = __importStar(require("./sdk-tizen"));
|
|
63
27
|
exports.SDKTizen = SDKTizen;
|
|
64
|
-
|
|
28
|
+
const SDKWebpack = __importStar(require("./sdk-webpack"));
|
|
65
29
|
exports.SDKWebpack = SDKWebpack;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return [2];
|
|
77
|
-
});
|
|
78
|
-
}); };
|
|
30
|
+
const handlePlatformSdk = async (c) => {
|
|
31
|
+
switch (c.platform) {
|
|
32
|
+
case constants_1.Platforms.TIZEN:
|
|
33
|
+
return SDKTizen.handleTizenSdk(c);
|
|
34
|
+
case constants_1.Platforms.WEBOS:
|
|
35
|
+
return SDKWebos.handleWebosSdk(c);
|
|
36
|
+
default:
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
79
40
|
exports.handlePlatformSdk = handlePlatformSdk;
|