additional warning re: potential version incompatibility

This commit is contained in:
Michael Bradley, Jr 2018-10-12 09:09:35 -05:00 committed by Pascal Precht
parent f686fec74a
commit 4812a0d1a2
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 6 additions and 4 deletions

View File

@ -54,9 +54,10 @@ class TemplateGenerator {
try {
await this.download(url, tmpFilePath, browse);
} catch (err) {
let {url_fallback, filePath_fallback, browse_fallback} = ext;
let {url_fallback, filePath_fallback, browse_fallback, embarkVersion} = ext;
if (url_fallback) {
console.log(__('Retrying with the master branch...').yellow);
console.log((__(`It may not be compatible with your Embark version`) + ` ${embarkVersion}`).yellow);
tmpFilePath = fs.tmpDir(filePath_fallback);
await this.download(url_fallback, tmpFilePath, browse_fallback);
} else {
@ -128,13 +129,13 @@ class TemplateGenerator {
getExternalProject(uri) {
let url, folder, hgi;
let fallback, url_fallback, folder_fallback, hgi_fallback;
let fallback, url_fallback, folder_fallback, hgi_fallback, embarkVersion;
hgi = hostedGitInfo.fromUrl(uri);
if (!hgi || hgi.user.includes('#')) {
let templateAndBranch = uri.split('#');
if (templateAndBranch.length === 1) {
fallback = true;
let embarkVersion = semver(require('../../package.json').version);
embarkVersion = semver(require('../../package.json').version);
templateAndBranch.push(`${embarkVersion.major}.${embarkVersion.minor}`);
}
templateAndBranch[0] = `embark-framework/embark-${templateAndBranch[0]}-template`;
@ -157,7 +158,8 @@ class TemplateGenerator {
browse: decodeURIComponent(hgi.browse()),
url_fallback,
filePath_fallback: fallback && utils.joinPath(".embark/templates/", folder_fallback, "archive.zip"),
browse_fallback: fallback && decodeURIComponent(hgi_fallback.browse())
browse_fallback: fallback && decodeURIComponent(hgi_fallback.browse()),
embarkVersion
};
}
}