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