fixes manifest overriding in case version is automatically set

This commit is contained in:
Roberto Huertas 2017-03-18 18:02:39 +01:00
parent 999a34c401
commit 4d7822b1b7
2 changed files with 18 additions and 14 deletions

View file

@ -442,7 +442,7 @@ export function validateManifest(manifest: Manifest): Manifest {
return manifest;
}
export function readManifest(cwd = process.cwd()): Promise<Manifest> {
export function readManifest(cwd = process.cwd(), nls = true): Promise<Manifest> {
const manifestPath = path.join(cwd, 'package.json');
const manifestNLSPath = path.join(cwd, 'package.nls.json');
@ -457,6 +457,7 @@ export function readManifest(cwd = process.cwd()): Promise<Manifest> {
})
.then(validateManifest);
if (nls) {
const manifestNLS = readFile(manifestNLSPath, 'utf8')
.catch<string>(err => err.code !== 'ENOENT' ? Promise.reject(err) : Promise.resolve('{}'))
.then<ITranslations>(raw => {
@ -470,6 +471,9 @@ export function readManifest(cwd = process.cwd()): Promise<Manifest> {
return Promise.all([manifest, manifestNLS]).then(([manifest, translations]) => {
return patchNLS(manifest, translations);
});
} else {
return manifest;
}
}
export function writeManifest(cwd: string, manifest: Manifest): Promise<void> {

View file

@ -90,7 +90,7 @@ function versionBump(cwd: string = process.cwd(), version?: string): Promise<voi
return Promise.resolve(null);
}
return readManifest(cwd)
return readManifest(cwd, false)
.then(manifest => {
switch (version) {
case 'major':