diff --git a/.yarn/versions/5a966911.yml b/.yarn/versions/5a966911.yml new file mode 100644 index 000000000000..49cfdd45ad88 --- /dev/null +++ b/.yarn/versions/5a966911.yml @@ -0,0 +1,2 @@ +releases: + "@yarnpkg/sdks": patch diff --git a/packages/yarnpkg-sdks/sources/generateSdk.ts b/packages/yarnpkg-sdks/sources/generateSdk.ts index b07e8676d89c..fb7b4c5c52a7 100644 --- a/packages/yarnpkg-sdks/sources/generateSdk.ts +++ b/packages/yarnpkg-sdks/sources/generateSdk.ts @@ -205,7 +205,7 @@ export class Wrapper { this.target = target; } - async writeManifest() { + async writeManifest(rawManifest: Record = {}) { const absWrapperPath = ppath.join(this.target, this.name, `package.json`); const topLevelInformation = this.pnpApi.getPackageInformation(this.pnpApi.topLevel)!; @@ -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}); } diff --git a/packages/yarnpkg-sdks/sources/sdks/base.ts b/packages/yarnpkg-sdks/sources/sdks/base.ts index 44e350e2ad48..7a13529c088c 100644 --- a/packages/yarnpkg-sdks/sources/sdks/base.ts +++ b/packages/yarnpkg-sdks/sources/sdks/base.ts @@ -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; };