mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 06:16:01 +00:00
refactor(@embark/template_generator): account for prerelease in embark version
If the version in the embark package's own `package.json` has a prerelease identifier then appending `.x` to the major version isn't viable for resolving the latest version of the template package that's in the same prerelease line; a more complex semver range must be used: ``` "${pkg}@^${major}.${minor}.${patch}- <${major}.${minor}.${patch}" ```
This commit is contained in:
parent
1225cb14e8
commit
db66f0e197
@ -125,8 +125,13 @@ class TemplateGenerator {
|
||||
() => (pkgJsonPath) => normalize(pkgJsonPath).includes(normalize('dapps/templates'))
|
||||
);
|
||||
} else {
|
||||
const version = fs.readJSONSync(embarkPath('package.json')).version;
|
||||
templateSpecifier = `${templatePkg}@${semver(version).major}.x`;
|
||||
const version = semver(fs.readJSONSync(embarkPath('package.json')).version);
|
||||
if (!version.prerelease.length) {
|
||||
templateSpecifier = `${templatePkg}@${version.major}.x`;
|
||||
} else {
|
||||
const majorMinorPatch = `${version.major}.${version.minor}.${version.patch}`;
|
||||
templateSpecifier = `"${templatePkg}@^${majorMinorPatch}- <${majorMinorPatch}"`;
|
||||
}
|
||||
}
|
||||
|
||||
const tmpDir = require('fs-extra').mkdtempSync(
|
||||
|
Loading…
x
Reference in New Issue
Block a user