Upgrade prettier

This commit is contained in:
Stéphan Kochen
2023-10-29 13:39:57 +01:00
parent 10d226f780
commit a1ab08efae
8 changed files with 52 additions and 52 deletions
+1 -1
View File
@@ -22,7 +22,7 @@
"@yarnpkg/plugin-pnp": "^3.1.0",
"babel-loader": "^8.1.0",
"clipanion": "^3.0.0",
"prettier": "2.5.1",
"prettier": "3.0.3",
"raw-loader": "^4.0.1",
"typescript": "4.5.4",
"webpack": "^5.35.0",
+2 -2
View File
@@ -18,7 +18,7 @@ export default class FetchOneCommand extends Command<CommandContext> {
async execute() {
const configuration = await Configuration.find(
this.context.cwd,
this.context.plugins
this.context.plugins,
);
const { project } = await Project.find(configuration, this.context.cwd);
const cache = await Cache.find(configuration);
@@ -42,7 +42,7 @@ export default class FetchOneCommand extends Command<CommandContext> {
fetcher,
report,
});
}
},
);
return report.exitCode();
+9 -9
View File
@@ -23,7 +23,7 @@ export default class InjectBuildCommand extends Command<CommandContext> {
async execute() {
const configuration = await Configuration.find(
this.context.cwd,
this.context.plugins
this.context.plugins,
);
const { project } = await Project.find(configuration, this.context.cwd);
@@ -48,7 +48,7 @@ export default class InjectBuildCommand extends Command<CommandContext> {
// the read-only permissions of our source path in the Nix store.
const installLocation = ppath.join(
project.cwd,
this.installLocation as PortablePath
this.installLocation as PortablePath,
);
await xfs.mkdirpPromise(ppath.dirname(installLocation));
await execUtils.execvp("cp", ["-R", this.source, installLocation], {
@@ -72,7 +72,7 @@ export default class InjectBuildCommand extends Command<CommandContext> {
(data: Buffer | string) => {
globalHashGenerator.update(`\0`);
globalHashGenerator.update(data);
}
},
);
const globalHash = globalHashGenerator.digest(`hex`);
@@ -86,7 +86,7 @@ export default class InjectBuildCommand extends Command<CommandContext> {
const pkg = project.storedPackages.get(locator.locatorHash);
if (typeof pkg === `undefined`)
throw new Error(
`Assertion failed: The package should have been registered`
`Assertion failed: The package should have been registered`,
);
const builder = createHash(`sha512`);
@@ -97,20 +97,20 @@ export default class InjectBuildCommand extends Command<CommandContext> {
for (const descriptor of pkg.dependencies.values()) {
const resolution = project.storedResolutions.get(
descriptor.descriptorHash
descriptor.descriptorHash,
);
if (typeof resolution === `undefined`)
throw new Error(
`Assertion failed: The resolution (${structUtils.prettyDescriptor(
project.configuration,
descriptor
)}) should have been registered`
descriptor,
)}) should have been registered`,
);
const dependency = project.storedPackages.get(resolution);
if (typeof dependency === `undefined`)
throw new Error(
`Assertion failed: The package should have been registered`
`Assertion failed: The package should have been registered`,
);
builder.update(getBaseHash(dependency));
@@ -133,7 +133,7 @@ export default class InjectBuildCommand extends Command<CommandContext> {
// `yarn install` later, which should clean it up again.
project.storedBuildState.set(pkg.locatorHash, buildHash);
await project.persistInstallStateFile();
}
},
);
return report.exitCode();
+9 -9
View File
@@ -24,11 +24,11 @@ export default class InstallBinCommand extends Command<CommandContext> {
async execute() {
const configuration = await Configuration.find(
this.context.cwd,
this.context.plugins
this.context.plugins,
);
const { project, workspace } = await Project.find(
configuration,
this.context.cwd
this.context.cwd,
);
const report = await StreamReport.start(
@@ -44,7 +44,7 @@ export default class InstallBinCommand extends Command<CommandContext> {
const wrapperPath = ppath.join(binDir, name as Filename);
const binaryPath = ppath.join(
project.cwd,
npath.toPortablePath(binaryFile)
npath.toPortablePath(binaryFile),
);
await this.writeWrapper(wrapperPath, binaryPath, {
configuration,
@@ -56,18 +56,18 @@ export default class InstallBinCommand extends Command<CommandContext> {
await project.resolveEverything({ report, lockfileOnly: true });
const binaries = await scriptUtils.getPackageAccessibleBinaries(
project.topLevelWorkspace.anchoredLocator,
{ project }
{ project },
);
for (const [name, [_, binaryPath]] of binaries.entries()) {
const wrapperPath = ppath.join(binDir, name as Filename);
await this.writeWrapper(
wrapperPath,
npath.toPortablePath(binaryPath),
{ configuration, project }
{ configuration, project },
);
}
}
}
},
);
return report.exitCode();
@@ -79,7 +79,7 @@ export default class InstallBinCommand extends Command<CommandContext> {
{
configuration,
project,
}: { configuration: Configuration; project: Project }
}: { configuration: Configuration; project: Project },
) {
let wrapper;
switch (configuration.get(`nodeLinker`)) {
@@ -88,14 +88,14 @@ export default class InstallBinCommand extends Command<CommandContext> {
const nodeOptions = [];
if (await xfs.existsPromise(pnpPath.cjs)) {
nodeOptions.push(
`--require "${npath.fromPortablePath(pnpPath.cjs)}"`
`--require "${npath.fromPortablePath(pnpPath.cjs)}"`,
);
}
if (await xfs.existsPromise(pnpPath.esmLoader)) {
nodeOptions.push(
`--experimental-loader "${
pathToFileURL(npath.fromPortablePath(pnpPath.esmLoader)).href
}"`
}"`,
);
}
wrapper = renderTmpl(binWrapperPnpTmpl, {
+22 -22
View File
@@ -25,7 +25,7 @@ import { tmpdir } from "os";
// Generator function that runs after `yarn install`.
export default async (
project: Project,
opts: { cache: Cache; report: Report; mode?: InstallMode }
opts: { cache: Cache; report: Report; mode?: InstallMode },
) => {
const { configuration, cwd } = project;
const { cache, report } = opts;
@@ -40,7 +40,7 @@ export default async (
if (project.cwd.startsWith(tempDir)) {
report.reportInfo(
0,
`Skipping Nixify, because ${project.cwd} appears to be a temporary directory`
`Skipping Nixify, because ${project.cwd} appears to be a temporary directory`,
);
return;
}
@@ -57,7 +57,7 @@ export default async (
yarnPathExpr = json(yarnPathAbs);
report.reportWarning(
0,
`The Yarn path ${yarnPathAbs} is outside the project - it may not be reachable by the Nix build`
`The Yarn path ${yarnPathAbs} is outside the project - it may not be reachable by the Nix build`,
);
}
@@ -67,7 +67,7 @@ export default async (
cacheFolderExpr = json(ppath.relative(cwd, cacheFolderAbs));
} else {
throw Error(
`The cache folder ${cacheFolderAbs} is outside the project, this is currently not supported`
`The cache folder ${cacheFolderAbs} is outside the project, this is currently not supported`,
);
}
@@ -84,7 +84,7 @@ export default async (
if (!relativeSource.startsWith(cwd)) {
report.reportWarning(
0,
`The config file ${source} is outside the project - it may not be reachable by the Nix build`
`The config file ${source} is outside the project - it may not be reachable by the Nix build`,
);
}
}
@@ -93,7 +93,7 @@ export default async (
"./" +
ppath.relative(
ppath.dirname(nixExprPath),
ppath.resolve(cwd, 'yarn.lock' as PortablePath)
ppath.resolve(cwd, "yarn.lock" as PortablePath),
);
// Build a list of cache entries so Nix can fetch them.
@@ -149,11 +149,11 @@ export default async (
if (structUtils.isVirtualLocator(pkg)) {
const devirtPkg = project.storedPackages.get(
structUtils.devirtualizeLocator(pkg).locatorHash
structUtils.devirtualizeLocator(pkg).locatorHash,
);
if (!devirtPkg) {
throw Error(
`Assertion failed: The locator should have been registered`
`Assertion failed: The locator should have been registered`,
);
}
@@ -162,11 +162,11 @@ export default async (
if (pkg.reference.startsWith("patch:")) {
const depatchPkg = project.storedPackages.get(
patchUtils.parseLocator(pkg).sourceLocator.locatorHash
patchUtils.parseLocator(pkg).sourceLocator.locatorHash,
);
if (!depatchPkg) {
throw Error(
`Assertion failed: The locator should have been registered`
`Assertion failed: The locator should have been registered`,
);
}
@@ -175,18 +175,18 @@ export default async (
for (const dependency of pkg.dependencies.values()) {
const resolution = project.storedResolutions.get(
dependency.descriptorHash
dependency.descriptorHash,
);
if (!resolution) {
throw Error(
"Assertion failed: The descriptor should have been registered"
"Assertion failed: The descriptor should have been registered",
);
}
const depPkg = project.storedPackages.get(resolution);
if (!depPkg) {
throw Error(
`Assertion failed: The locator should have been registered`
`Assertion failed: The locator should have been registered`,
);
}
@@ -217,13 +217,13 @@ export default async (
ppath.join(
pnpUnpluggedFolder,
structUtils.slugifyLocator(pkg),
structUtils.getIdentVendorPath(pkg)
)
structUtils.getIdentVendorPath(pkg),
),
);
break;
default:
throw Error(
`The nodeLinker ${nodeLinker} is not supported for isolated Nix builds`
`The nodeLinker ${nodeLinker} is not supported for isolated Nix builds`,
);
}
@@ -236,7 +236,7 @@ export default async (
const pkg = project.storedPackages.get(locatorHash);
if (!pkg) {
throw Error(
`Assertion failed: The locator should have been registered`
`Assertion failed: The locator should have been registered`,
);
}
devirtPkg = pkg;
@@ -261,7 +261,7 @@ export default async (
`version = ${json(pkg.version)};`,
`reference = ${json(devirtPkg.reference)};`,
`locators = [\n${locators}];`,
].join(` `)} });`
].join(` `)} });`,
);
}
@@ -273,7 +273,7 @@ export default async (
`yarn nixify inject-build \\`,
` ${json(injectLocatorStr)} \\`,
` $\{${isolatedProp}} \\`,
` ${json(installLocation)}`
` ${json(installLocation)}`,
);
}
if (isolatedIntegration.length > 0) {
@@ -308,7 +308,7 @@ export default async (
await xfs.writeFilePromise(defaultExprPath, defaultExprTmpl);
report.reportInfo(
0,
`A minimal default.nix was created. You may want to customize it.`
`A minimal default.nix was created. You may want to customize it.`,
);
}
}
@@ -355,13 +355,13 @@ export default async (
{
cwd: project.cwd,
strict: true,
}
},
);
}
if (numToPreload !== 0) {
report.reportInfo(
0,
`Preloaded ${numToPreload} packages into the Nix store`
`Preloaded ${numToPreload} packages into the Nix store`,
);
}
} catch (err: any) {
+1 -1
View File
@@ -46,7 +46,7 @@ export const computeFixedOutputStorePath = (
name: string,
hashAlgorithm: string,
hash: Buffer,
storePath = `/nix/store` as PortablePath
storePath = `/nix/store` as PortablePath,
) => {
const hashHex = hash.toString("hex");
+2 -2
View File
@@ -24,7 +24,7 @@ export const upperCamelize = (name: string) =>
export const indent = (
prefix: string,
text: string,
includeEmptyLines = false
includeEmptyLines = false,
): string =>
text
.split("\n")
@@ -41,7 +41,7 @@ export const indent = (
*/
export const renderTmpl = (
tmpl: string,
vars: { [name: string]: string | boolean }
vars: { [name: string]: string | boolean },
): string => {
let result = tmpl;
for (const [name, value] of Object.entries(vars)) {
+6 -6
View File
@@ -2654,12 +2654,12 @@ __metadata:
languageName: node
linkType: hard
"prettier@npm:2.5.1":
version: 2.5.1
resolution: "prettier@npm:2.5.1"
"prettier@npm:3.0.3":
version: 3.0.3
resolution: "prettier@npm:3.0.3"
bin:
prettier: bin-prettier.js
checksum: 21b9408476ea1c544b0e45d51ceb94a84789ff92095abb710942d780c862d0daebdb29972d47f6b4d0f7ebbfb0ffbf56cc2cfa3e3e9d1cca54864af185b15b66
prettier: bin/prettier.cjs
checksum: e10b9af02b281f6c617362ebd2571b1d7fc9fb8a3bd17e371754428cda992e5e8d8b7a046e8f7d3e2da1dcd21aa001e2e3c797402ebb6111b5cd19609dd228e0
languageName: node
linkType: hard
@@ -3359,7 +3359,7 @@ __metadata:
"@yarnpkg/plugin-pnp": ^3.1.0
babel-loader: ^8.1.0
clipanion: ^3.0.0
prettier: 2.5.1
prettier: 3.0.3
raw-loader: ^4.0.1
typescript: 4.5.4
webpack: ^5.35.0