You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
var amdWrap = require("amd-wrap-legacy");
|
|
var glob = require("glob");
|
|
var path = require('path');
|
|
var fs = require('fs');
|
|
var mkdirp = require("mkdirp");
|
|
|
|
var source = "./notebook/static-src";
|
|
var destination = "./notebook/static";
|
|
|
|
glob(path.join(source, "**/*.js"), function(err, files) {
|
|
if (err) {
|
|
console.error('Could not glob files.', err);
|
|
} else {
|
|
files.forEach(function(file, index) {
|
|
var toFile = path.join(destination, path.relative(source, file));
|
|
fs.readFile(file, 'utf8', function (err, data) {
|
|
if (err) {
|
|
console.error('Could not read file ' + file, err);
|
|
} else {
|
|
mkdirp(path.dirname(toFile), function(err) {
|
|
if (err) {
|
|
console.error('Could not mkdirp ', err);
|
|
} else {
|
|
fs.writeFile(toFile, amdWrap(data), function(err) {
|
|
if(err) {
|
|
return console.error('Could not write file ' + toFile, err);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|