MCPcopy Create free account
hub / github.com/netlify/cli / preparePackageJSON

Function preparePackageJSON

scripts/netlifyPackage.js:25–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23}
24
25async 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
44await preparePackageJSON()

Callers 1

netlifyPackage.jsFile · 0.85

Calls 2

logMethod · 0.80
writeFileFunction · 0.50

Tested by

no test coverage detected