Skip to content

Commit

Permalink
fix(sdks): support Prettier v3
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Apr 25, 2023
1 parent 4927819 commit 96b4b1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .yarn/versions/5a966911.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@yarnpkg/sdks": patch
5 changes: 3 additions & 2 deletions packages/yarnpkg-sdks/sources/generateSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class Wrapper {
this.target = target;
}

async writeManifest() {
async writeManifest(rawManifest: Record<string, any> = {}) {
const absWrapperPath = ppath.join(this.target, this.name, `package.json`);

const topLevelInformation = this.pnpApi.getPackageInformation(this.pnpApi.topLevel)!;
Expand All @@ -223,10 +223,11 @@ export class Wrapper {
version: `${manifest.version}-sdk`,
main: manifest.main,
type: `commonjs`,
...rawManifest,
});
}

async writeBinary(relPackagePath: PortablePath, options: TemplateOptions = {}) {
async writeBinary(relPackagePath: PortablePath, options: TemplateOptions & {requirePath?: PortablePath} = {}) {
await this.writeFile(relPackagePath, {...options, mode: 0o755});
}

Expand Down
6 changes: 4 additions & 2 deletions packages/yarnpkg-sdks/sources/sdks/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export const generateEslintBaseWrapper: GenerateBaseWrapper = async (pnpApi: Pnp
export const generatePrettierBaseWrapper: GenerateBaseWrapper = async (pnpApi: PnpApi, target: PortablePath) => {
const wrapper = new Wrapper(`prettier` as PortablePath, {pnpApi, target});

await wrapper.writeManifest();
await wrapper.writeManifest({
main: `./index.js`,
});

await wrapper.writeBinary(`index.js` as PortablePath);
await wrapper.writeBinary(`index.js` as PortablePath, {requirePath: `` as PortablePath});

return wrapper;
};
Expand Down

0 comments on commit 96b4b1c

Please sign in to comment.