Skip to content

Commit

Permalink
fix: nuxt-start-edge missing resources
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo committed Aug 29, 2018
1 parent 67528f1 commit aeb33e0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions scripts/release-edge
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env node

const { resolve } = require('path')
const { resolve, join } = require('path')
const { spawnSync } = require('child_process')
const { readFileSync, writeFileSync, copySync, ensureDirSync } = require('fs-extra')
const { readFileSync, writeFileSync, copySync } = require('fs-extra')

class NuxtEdgePublisher {
static copyBin(moduleName, binName) {
const binFile = resolve(__dirname, '..', 'bin', binName)
const moduleBin = resolve(__dirname, '..', moduleName, 'bin')
ensureDirSync(moduleBin)
copySync(binFile, resolve(moduleBin, binName))
static copyFiles(moduleName, src, fieNames) {
const srcDir = resolve(__dirname, '..', src)
const moduleDir = resolve(__dirname, '..', moduleName, src)
for (const file of fieNames) {
copySync(resolve(srcDir, file), resolve(moduleDir, file))
}
}

static changePackageName(module = '') {
Expand Down Expand Up @@ -43,7 +44,8 @@ class NuxtEdgePublisher {
writeFileSync(packagePath, JSON.stringify(p, null, 2) + '\r\n')

if (module === 'start') {
this.copyBin('start', 'nuxt-start')
this.copyFiles(module, 'dist', ['nuxt-start.js'])
this.copyFiles(module, 'bin', ['nuxt-start', join('common', 'utils.js')])
}

return p
Expand Down

0 comments on commit aeb33e0

Please sign in to comment.