Skip to content

Commit

Permalink
style: reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
ext committed Dec 10, 2023
1 parent 2032a00 commit e61e483
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions lib/generate-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export async function generateNotes(pluginConfig, context) {
fillScope({
...rawCommit,
...parser(rawCommit.message, { referenceActions, issuePrefixes, ...parserOpts }),
})
)
}),
),
);
const previousTag = lastRelease.gitTag || lastRelease.gitHead;
const currentTag = nextRelease.gitTag || nextRelease.gitHead;
Expand Down
4 changes: 2 additions & 2 deletions lib/get-changed-packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ export default async function getChangedPackages(latch, context) {
logger.log(
`%d package${packages.length === 1 ? "" : "s"} found: %s`,
packages.length,
format(packages.map((pkg) => pkg.name))
format(packages.map((pkg) => pkg.name)),
);

const updates = collectUpdates(
packageGraph.rawPackageList,
packageGraph,
{ cwd },
{ logger, version, latch }
{ logger, version, latch },
);

return updates.map((node) => packages.find((pkg) => pkg.name === node.name));
Expand Down
6 changes: 3 additions & 3 deletions lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async function updateLockfile(npmrc, pkg, context) {
{
cwd: pkg.location,
env,
}
},
);
versionResult.stdout.pipe(stdout, { end: false });
versionResult.stderr.pipe(stderr, { end: false });
Expand Down Expand Up @@ -199,11 +199,11 @@ export default async function (npmrc, pluginConfig, context) {

const s = changed.length > 1 ? "s" : "";
logger.log(
`${changed.length} package${s} need version bump: ${format(changed.map((pkg) => pkg.name))}`
`${changed.length} package${s} need version bump: ${format(changed.map((pkg) => pkg.name))}`,
);

const currentVersions = Object.fromEntries(
await Promise.all(changed.map((pkg) => getCurrentVersion(pkg)))
await Promise.all(changed.map((pkg) => getCurrentVersion(pkg))),
);

/* Bump version in all changed packages */
Expand Down
44 changes: 22 additions & 22 deletions lib/prepare.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,26 @@ it("Update lerna.json and root package.json when no package has changed", async
stderr: context.stderr,
nextRelease: { version: "1.0.0" },
logger: context.logger,
}
},
);

// Verify lerna.json has been updated
expect(await readJson(project.lernaPath)).toEqual(
expect.objectContaining({
version: "1.0.0",
})
}),
);

// Verify root package.json has been updated
expect(await readJson(project.manifestLocation)).toEqual(
expect.objectContaining({
version: "1.0.0",
})
}),
);

// Verify the logger has been called with the version updated
expect(context.log).toHaveBeenCalledWith(
"No packages changed, applying version bump on root package only"
"No packages changed, applying version bump on root package only",
);
expect(context.log).toHaveBeenCalledWith("Write version %s to lerna.json in %s", "1.0.0", cwd);
});
Expand All @@ -117,29 +117,29 @@ it("Update lerna.json and root package.json when one or more package has changed
stderr: context.stderr,
nextRelease: { version: "1.0.0" },
logger: context.logger,
}
},
);

// Verify lerna.json has been updated
expect(await readJson(project.lernaPath)).toEqual(
expect.objectContaining({
version: "1.0.0",
})
}),
);

// Verify package.json has been updated
expect(await readJson(project.manifestLocation)).toEqual(
expect.objectContaining({
version: "1.0.0",
})
}),
);

// Verify the logger has been called with the version updated
expect(context.log).toHaveBeenCalledWith("1 package need version bump: [ 'foo' ]");
expect(context.log).toHaveBeenCalledWith(
"Write version %s to package.json in %s",
"1.0.0",
pkg.location
pkg.location,
);
expect(context.log).toHaveBeenCalledWith("Write version %s to lerna.json in %s", "1.0.0", cwd);
});
Expand All @@ -166,14 +166,14 @@ it("Update only lerna.json when one or more package has changed when option `roo
stderr: context.stderr,
nextRelease: { version: "1.0.0" },
logger: context.logger,
}
},
);

// Verify lerna.json has been updated
expect(await readJson(project.lernaPath)).toEqual(
expect.objectContaining({
version: "1.0.0",
})
}),
);

// Verify the logger has been called with the version updated
Expand Down Expand Up @@ -204,7 +204,7 @@ it("Update package.json in changed packages", async () => {
stderr: context.stderr,
nextRelease: { version: "1.0.0" },
logger: context.logger,
}
},
);

// Verify foo/package.json has been updated
Expand Down Expand Up @@ -241,7 +241,7 @@ it("Update npm-shrinkwrap.json if present", async () => {
stderr: context.stderr,
nextRelease: { version: "1.0.0" },
logger: context.logger,
}
},
);

// Verify foo/package.json has been updated
Expand All @@ -256,7 +256,7 @@ it("Update npm-shrinkwrap.json if present", async () => {
lockfileVersion: expect.anything(),
name: "foo",
version: "1.0.0",
})
}),
);
});

Expand All @@ -281,7 +281,7 @@ it("Update package-lock.json if present", async () => {
stderr: context.stderr,
nextRelease: { version: "1.0.0" },
logger: context.logger,
}
},
);

// Verify foo/package.json has been updated
Expand All @@ -296,7 +296,7 @@ it("Update package-lock.json if present", async () => {
lockfileVersion: expect.anything(),
name: "foo",
version: "1.0.0",
})
}),
);
});

Expand All @@ -322,7 +322,7 @@ it("Update package.json dependency when using exact version", async () => {
peerDependencies: {
c: "0.0.0",
},
}
},
);
await createPackage(cwd, "a", "0.0.0", { changed: true });
await createPackage(cwd, "b", "0.0.0", { changed: true });
Expand All @@ -338,7 +338,7 @@ it("Update package.json dependency when using exact version", async () => {
stderr: context.stderr,
nextRelease: { version: "0.0.1" },
logger: context.logger,
}
},
);

// Verify dependency has been updated
Expand Down Expand Up @@ -375,7 +375,7 @@ it("Update package.json dependency when using hat", async () => {
b: "^0.1",
c: "^0",
},
}
},
);

await createPackage(cwd, "a", "0.1.2", { changed: true });
Expand All @@ -392,7 +392,7 @@ it("Update package.json dependency when using hat", async () => {
stderr: context.stderr,
nextRelease: { version: "1.0.0" },
logger: context.logger,
}
},
);

// Verify dependency has been updated
Expand Down Expand Up @@ -423,7 +423,7 @@ it("Should not update other dependencies", async () => {
dependencies: {
a: "0.0.0",
},
}
},
);

await prepare(
Expand All @@ -436,7 +436,7 @@ it("Should not update other dependencies", async () => {
stderr: context.stderr,
nextRelease: { version: "0.0.1" },
logger: context.logger,
}
},
);

// Verify dependency has been updated
Expand Down Expand Up @@ -469,7 +469,7 @@ it("Handle dependencies from root package", async () => {
stderr: context.stderr,
nextRelease: { version: "0.0.2" },
logger: context.logger,
}
},
);
}).not.toThrow();
});
2 changes: 1 addition & 1 deletion lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default async function (npmrc, config, pkg, context) {
/* Lerna does not support --userconfig */
NPM_CONFIG_USERCONFIG: npmrc,
},
}
},
);
result.stdout.pipe(stdout, { end: false });
result.stderr.pipe(stderr, { end: false });
Expand Down
2 changes: 1 addition & 1 deletion lib/verify-git.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default async function verifyGit(context) {
Object.entries(VALIDATORS).map(async ([name, validator]) => {
const details = await validator(context);
return [name, details];
})
}),
);
return result
.filter(([, details]) => details)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
"semantic-release": "semantic-release",
"pretest": "npm run eslint",
"pretest": "npm run eslint && npm run prettier:check",
"test": "jest --collectCoverage"
},
"prettier": "@html-validate/prettier-config",
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function createProject(cwd, version, options = {}) {
publishConfig: {},
workspaces: options.workspaces ? ["packages/*"] : undefined,
},
{ spaces: 2 }
{ spaces: 2 },
);
await outputJson(lernaPath, { version, packages: ["packages/*"] });
await outputFile(path.resolve(cwd, ".npmrc"), generateNpmrc(), "utf-8");
Expand Down
10 changes: 5 additions & 5 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function initialPublish(cwd) {
{
cwd,
env: npmRegistry.authEnv,
}
},
);
}

Expand Down Expand Up @@ -96,7 +96,7 @@ it("should setup testable environment", async () => {

/* Verify versions */
expect(await readJson(project.manifestLocation)).toEqual(
expect.objectContaining({ version: "0.0.0" })
expect.objectContaining({ version: "0.0.0" }),
);
expect(await readJson(project.lernaPath)).toEqual(expect.objectContaining({ version: "0.0.0" }));
expect(await readJson(foo.manifestLocation)).toEqual({ name: foo.name, version: "0.0.0" });
Expand Down Expand Up @@ -135,7 +135,7 @@ it("should publish only changed packages", async () => {

/* Verify versions */
expect(await readJson(project.manifestLocation)).toEqual(
expect.objectContaining({ version: "0.0.1" })
expect.objectContaining({ version: "0.0.1" }),
);
expect(await readJson(project.lernaPath)).toEqual(expect.objectContaining({ version: "0.0.1" }));
expect(await readJson(foo.manifestLocation)).toEqual({ name: foo.name, version: "0.0.1" });
Expand Down Expand Up @@ -174,7 +174,7 @@ it("should latch package versions", async () => {

/* Verify versions */
expect(await readJson(project.manifestLocation)).toEqual(
expect.objectContaining({ version: "0.1.0" })
expect.objectContaining({ version: "0.1.0" }),
);
expect(await readJson(project.lernaPath)).toEqual(expect.objectContaining({ version: "0.1.0" }));
expect(await readJson(foo.manifestLocation)).toEqual({ name: foo.name, version: "0.1.0" });
Expand Down Expand Up @@ -215,7 +215,7 @@ it("should publish depender packages when dependee changes", async () => {

/* Verify versions */
expect(await readJson(project.manifestLocation)).toEqual(
expect.objectContaining({ version: "0.1.0" })
expect.objectContaining({ version: "0.1.0" }),
);
expect(await readJson(project.lernaPath)).toEqual(expect.objectContaining({ version: "0.1.0" }));
expect(await readJson(foo.manifestLocation)).toEqual({ name: foo.name, version: "0.1.0" });
Expand Down

0 comments on commit e61e483

Please sign in to comment.