()
| 23 | } |
| 24 | |
| 25 | async function preparePackageJSON() { |
| 26 | const binPath = Object.values(packageJSON.contents.bin ?? {})[0] |
| 27 | if (!binPath) { |
| 28 | throw new Error('Did not find a non-empty binary entry in `package.json`, so the `npx` flow will not work.') |
| 29 | } |
| 30 | |
| 31 | const newPackageJSON = { |
| 32 | ...packageJSON.contents, |
| 33 | main: './dist/index.js', |
| 34 | name: 'netlify', |
| 35 | bin: { |
| 36 | npxnetlify: binPath, |
| 37 | }, |
| 38 | } |
| 39 | |
| 40 | console.log(`Writing updated package.json to ${packageJSON.path}...`) |
| 41 | await writeFile(packageJSON.path, `${JSON.stringify(newPackageJSON, null, 2)}\n`) |
| 42 | } |
| 43 | |
| 44 | await preparePackageJSON() |
no test coverage detected