Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Write the manifest.json
const bundlePath = path.parse(this.bundle.name)
const contents = await this.resolveAssetContents(asset)
const hotReloadScriptFilename = path.resolve(
bundlePath.dir,
'hot-reload.js'
)
await fs.writeFile(hotReloadScriptFilename, hotReloadScript, {
encoding: 'utf8'
})
const manifestJsonFilename = path.resolve(
bundlePath.dir,
bundlePath.name + '.json'
)
await fs.writeFile(manifestJsonFilename, contents, { encoding: 'utf8' })
// Package the extension (XPI/CRX)
const zipped = await zipDir(this.options.outDir)
const zippedFilename = path.resolve(
artifactsDir,
bundlePath.name + '.zip'
)
this.size = zipped.length
await fs.writeFile(zippedFilename, zipped)
}
async addAsset(asset) {
const artifactsDir = path.resolve(
asset.options.outDir,
'..',
'artifacts'
)
await fs.mkdirp(artifactsDir)
// Write the manifest.json
const bundlePath = path.parse(this.bundle.name)
const contents = await this.resolveAssetContents(asset)
const hotReloadScriptFilename = path.resolve(
bundlePath.dir,
'hot-reload.js'
)
await fs.writeFile(hotReloadScriptFilename, hotReloadScript, {
encoding: 'utf8'
})
const manifestJsonFilename = path.resolve(
bundlePath.dir,
bundlePath.name + '.json'
)
await fs.writeFile(manifestJsonFilename, contents, { encoding: 'utf8' })
// Package the extension (XPI/CRX)
const zipped = await zipDir(this.options.outDir)
const zippedFilename = path.resolve(
artifactsDir,
bundlePath.name + '.zip'
)
this.size = zipped.length
await fs.writeFile(zippedFilename, zipped)
encoding: 'utf8'
})
const manifestJsonFilename = path.resolve(
bundlePath.dir,
bundlePath.name + '.json'
)
await fs.writeFile(manifestJsonFilename, contents, { encoding: 'utf8' })
// Package the extension (XPI/CRX)
const zipped = await zipDir(this.options.outDir)
const zippedFilename = path.resolve(
artifactsDir,
bundlePath.name + '.zip'
)
this.size = zipped.length
await fs.writeFile(zippedFilename, zipped)
}