@jupyterlab/buildutils
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -10,2 +10,3 @@ "use strict"; | ||
var path = require("path"); | ||
var utils = require("./utils"); | ||
/** | ||
@@ -24,3 +25,3 @@ * A namespace for JupyterLab build utilities. | ||
var packageDir = path.dirname(packageDataPath); | ||
var packageData = require(packageDataPath); | ||
var packageData = utils.readJSONFile(packageDataPath); | ||
var extension = normalizeExtension(packageData); | ||
@@ -35,3 +36,4 @@ var schemaDir = extension.schemaDir, themeDir = extension.themeDir; | ||
try { | ||
var oldPackageData = require(path.join(destination_1, 'package.json')); | ||
var oldPackagePath = path.join(destination_1, 'package.json'); | ||
var oldPackageData = utils.readJSONFile(oldPackagePath); | ||
if (oldPackageData.version === packageData.version) { | ||
@@ -38,0 +40,0 @@ fs.removeSync(destination_1); |
@@ -99,2 +99,11 @@ "use strict"; | ||
}); | ||
// Ensure dependencies and dev dependencies. | ||
data.dependencies = deps; | ||
data.devDependencies = devDeps; | ||
if (Object.keys(data.dependencies).length === 0) { | ||
delete data.dependencies; | ||
} | ||
if (Object.keys(data.devDependencies).length === 0) { | ||
delete data.devDependencies; | ||
} | ||
if (utils.writePackageData(path.join(pkgPath, 'package.json'), data)) { | ||
@@ -101,0 +110,0 @@ messages.push('Updated package.json'); |
@@ -29,2 +29,3 @@ "use strict"; | ||
'@jupyterlab/theme-light-extension': ['font-awesome'], | ||
'@jupyterlab/services': ['node-fetch', 'ws'], | ||
'@jupyterlab/vega2-extension': ['d3', 'vega', 'vega-lite'] | ||
@@ -71,3 +72,3 @@ }; | ||
} | ||
lines.push("import \"" + name + "\";"); | ||
lines.push('import \'' + name + '\';'); | ||
if (!valid) { | ||
@@ -88,6 +89,6 @@ messages.push("Updated: " + name); | ||
} | ||
var newIndex = lines.join('\n'); | ||
var newIndex = lines.join('\n') + '\n'; | ||
if (newIndex !== index) { | ||
messages.push('Index changed'); | ||
fs.writeFileSync(indexPath, lines.join('\n')); | ||
fs.writeFileSync(indexPath, lines.join('\n') + '\n'); | ||
} | ||
@@ -154,3 +155,3 @@ return messages; | ||
if (utils.writePackageData(corePath, corePackage)) { | ||
return ['Updated core']; | ||
return ['Updated dev mode']; | ||
} | ||
@@ -157,0 +158,0 @@ return []; |
@@ -10,2 +10,5 @@ "use strict"; | ||
var utils = require("./utils"); | ||
// Ensure the repo is in a stable state. | ||
utils.run('jlpm run build:utils'); | ||
utils.run('jlpm integrity'); | ||
// Get the dev mode package.json file. | ||
@@ -17,2 +20,3 @@ var data = utils.readJSONFile('./dev_mode/package.json'); | ||
data['scripts']['build:prod'] = "webpack --define process.env.NODE_ENV=\"'production'\""; | ||
data['jupyterlab']['buildDir'] = './build'; | ||
data['jupyterlab']['outputDir'] = '..'; | ||
@@ -23,8 +27,10 @@ data['jupyterlab']['staticDir'] = '../static'; | ||
utils.writePackageData(path.join(staging, 'package.json'), data); | ||
// Update our index file and webpack file. | ||
// Update our staging files. | ||
fs.copySync('./dev_mode/index.js', './jupyterlab/staging/index.js'); | ||
fs.copySync('./dev_mode/webpack.config.js', './jupyterlab/staging/webpack.config.js'); | ||
// Update the jlpm.lock file. | ||
fs.copySync('./dev_mode/templates', './jupyterlab/staging/templates'); | ||
// Create a new yarn.lock file to ensure it is correct. | ||
fs.removeSync(path.join(staging, 'yarn.lock')); | ||
utils.run('jlpm', { cwd: staging }); | ||
// Build the core assets. | ||
utils.run('jlpm run build:prod', { cwd: staging }); |
{ | ||
"name": "@jupyterlab/buildutils", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "JupyterLab - Build Utilities", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/jupyterlab/jupyterlab", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
46697
1249
20