Skip to content

Commit

Permalink
cloudflare: generate package-lock.json
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 10, 2020
1 parent 2f60ea4 commit 65b1bbe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions src/targets/cloudflare.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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`')
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '') {
Expand Down

0 comments on commit 65b1bbe

Please sign in to comment.