Skip to content

Commit

Permalink
fix(plugin-version): Correctly check void releases for a null value
Browse files Browse the repository at this point in the history
js-yaml implements the YAML spec and it has no undefined type:

- nodeca/js-yaml#356 (comment)

I.e.:

```
> require('js-yaml').safeLoad('releases:\n')
{ releases: null }
```
  • Loading branch information
martinjlowm committed Jul 1, 2020
1 parent 5a19b1f commit b596237
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .yarn/versions/7bfd08a0.yml
@@ -0,0 +1,2 @@
releases:
"@yarnpkg/plugin-version": prerelease
2 changes: 1 addition & 1 deletion packages/plugin-version/sources/versionUtils.ts
Expand Up @@ -174,7 +174,7 @@ export async function updateVersionFiles(project: Project) {
const versionContent = await xfs.readFilePromise(versionPath, `utf8`);
const versionData = parseSyml(versionContent);

if (typeof versionData.releases === `undefined`)
if (versionData.releases === null)
continue;

for (const locatorStr of Object.keys(versionData.releases || {})) {
Expand Down

0 comments on commit b596237

Please sign in to comment.