@enplug/scripts
Advanced tools
Comparing version 1.1.15-dev1 to 1.1.15-dev10
@@ -7,2 +7,3 @@ #! /usr/bin/env node | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const shell = require('shelljs'); | ||
@@ -27,9 +28,19 @@ const rootPath = __dirname.split('node_modules')[0]; | ||
*/ | ||
copyOfflineSupportWorker() { | ||
let src = path.join(rootPath, 'node_modules/@enplug/sdk-player/src/lib/offline-app-sw.js'); | ||
let dest = path.join(rootPath, 'app/dist'); | ||
console.log('path', src, dist); | ||
let readStream = fs.createReadStream(src); | ||
readStream.pipe(fs.createWriteStream(dest)); | ||
function copyOfflineSupportWorker() { | ||
let configPath = path.join(rootPath, 'src/app/offline.config.json'); | ||
let srcFilePath = path.join(rootPath, 'node_modules/@enplug/sdk-player/src/lib/offline-app-sw.js'); | ||
let destFilePath = path.join(rootPath, 'dist/offline-app-sw.js'); | ||
let offlineConfig = require(configPath); | ||
// let readStream = fs.createReadStream(src); | ||
// readStream.pipe(fs.createWriteStream(dest)); | ||
fs.readFile(srcFilePath, 'utf8', (err, data) => { | ||
if (err) { | ||
return console.log(err); | ||
} | ||
var offlineServiceWorkerFile = data.replace(/<% config %>/g, JSON.stringify(offlineConfig)); | ||
fs.writeFile(destFilePath, offlineServiceWorkerFile, 'utf8', (err) => { | ||
if (err) return console.log(err); | ||
}); | ||
}); | ||
} | ||
@@ -51,3 +62,3 @@ | ||
copyOfflineSupportWorker(); | ||
runBuild(); | ||
runBuild(); | ||
copyOfflineSupportWorker(); |
{ | ||
"name": "@enplug/scripts", | ||
"version": "1.1.15-dev1", | ||
"version": "1.1.15-dev10", | ||
"description": "Enplug scripts", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
13041
371
8