cloudflare: generate package-lock.json

This commit is contained in:
Pooya Parsa 2020-11-10 23:38:22 +01:00
parent 2a6d4f38d0
commit dc6154fea8
2 changed files with 5 additions and 10 deletions

View File

@ -1,7 +1,6 @@
import { resolve } from 'path'
import { writeFile } from 'fs-extra'
import consola from 'consola'
import { extendTarget, prettyPath } from '../utils'
import { extendTarget, writeFile } from '../utils'
import { SLSOptions, SLSTarget } from '../config'
import { worker } from './worker'
@ -12,13 +11,9 @@ export const cloudflare: SLSTarget = extendTarget(worker, {
],
hooks: {
async done ({ targetDir }: SLSOptions) {
const pkgPath = resolve(targetDir, 'package.json')
const pkg = {
private: true,
main: './_nuxt.js'
}
await writeFile(pkgPath, JSON.stringify(pkg, null, 2))
consola.info('Generated', prettyPath(pkgPath))
await writeFile(resolve(targetDir, 'package.json'), JSON.stringify({ private: true, main: './_nuxt.js' }, null, 2))
await writeFile(resolve(targetDir, 'package-lock.json'), JSON.stringify({ lockfileVersion: 1 }, null, 2))
consola.success('Ready to run `wrangler publish`')
}
}

View File

@ -37,7 +37,7 @@ export function tryImport (dir: string, path: string) {
export async function writeFile (file, contents) {
await fse.mkdirp(dirname(file))
await fse.writeFile(file, contents, 'utf-8')
consola.info('Generated ', prettyPath(file))
consola.info('Generated', prettyPath(file))
}
export function resolvePath (options: SLSOptions, path: UnresolvedPath, resolveBase: string = '') {