Registry Mirror
Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

File tree

‎bin/ns-bundle‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ execute(options);
5353

5454
function execute(options) {
5555
const platform = options.platform;
56-
let commands = [
57-
() => runTns("prepare", platform)
56+
let commands = [
57+
() => runTns("prepare", platform)
5858
];
5959

6060
if (options.bundle) {
@@ -70,7 +70,7 @@ function execute(options) {
7070
if (shouldSnapshot(platform, options.env)) {
7171
commands.push(() => installSnapshotArtefacts());
7272
}
73-
73+
7474
// If "build-app" or "start-app" is specified,
7575
// the respective command should be run last.
7676
if (options.command) {
@@ -123,15 +123,20 @@ function gradlewClean() {
123123
function getTnsVersion() {
124124
return new Promise((resolve, reject) => {
125125
const childProcess = spawn("tns", ["--version"], { shell: true });
126-
127-
childProcess.stdout.on("data", version => resolve(version.toString()));
126+
let stdoutData = "";
127+
childProcess.stdout.on("data", data => stdoutData += data);
128128

129129
childProcess.on("close", code => {
130130
if (code) {
131131
reject({
132132
code,
133133
message: `child process exited with code ${code}`,
134134
});
135+
} else {
136+
const versionRegex = /^(?:\d+\.){2}\d+.*?$/m;
137+
const matches = stdoutData.toString().match(versionRegex);
138+
const version = matches && matches[0] && matches[0].trim();
139+
resolve(version);
135140
}
136141
});
137142
});

0 commit comments

Comments
 (0)