depcopy and configs
This commit is contained in:
parent
2a93e5d2a3
commit
99c2b53ec6
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"presets": [
|
|
||||||
[
|
|
||||||
"@babel/env",
|
|
||||||
{
|
|
||||||
"targets": {
|
|
||||||
"node": "6.7.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
module.exports = function(api) {
|
||||||
|
|
||||||
|
api.cache(true);
|
||||||
|
|
||||||
|
const presets = [['@babel/env', {
|
||||||
|
targets: {
|
||||||
|
'node': '8.6.0'
|
||||||
|
}
|
||||||
|
}]];
|
||||||
|
|
||||||
|
const plugins = [];
|
||||||
|
|
||||||
|
return {
|
||||||
|
presets,
|
||||||
|
plugins
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ import del from 'del';
|
||||||
import copy from 'gulp-copy';
|
import copy from 'gulp-copy';
|
||||||
import rename from 'gulp-rename';
|
import rename from 'gulp-rename';
|
||||||
import inject from 'gulp-inject-string';
|
import inject from 'gulp-inject-string';
|
||||||
import copydeps from 'gulp-npm-copy-deps';
|
import copydeps from './scripts/copydeps';
|
||||||
import file from 'gulp-file';
|
import file from 'gulp-file';
|
||||||
import editjson from 'gulp-json-editor';
|
import editjson from 'gulp-json-editor';
|
||||||
|
|
||||||
|
@ -111,8 +111,11 @@ gulp.task('editor-release', gulp.parallel('editor-main', 'editor-pkg'));
|
||||||
|
|
||||||
// Deps
|
// Deps
|
||||||
|
|
||||||
gulp.task('node-modules', function () {
|
gulp.task('node-modules', function() {
|
||||||
return copydeps('.', 'release/core');
|
return pump([
|
||||||
|
gulp.src(copydeps({ignore: ['fsevents']}), { base: '.' }),
|
||||||
|
gulp.dest('./release/core')
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('node-sass-bindings', gulp.series(function () {
|
gulp.task('node-sass-bindings', gulp.series(function () {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -50,7 +50,6 @@
|
||||||
"gulp-file": "^0.4.0",
|
"gulp-file": "^0.4.0",
|
||||||
"gulp-inject-string": "^1.1.2",
|
"gulp-inject-string": "^1.1.2",
|
||||||
"gulp-json-editor": "^2.5.1",
|
"gulp-json-editor": "^2.5.1",
|
||||||
"gulp-npm-copy-deps": "^1.0.2",
|
|
||||||
"gulp-rename": "^1.4.0",
|
"gulp-rename": "^1.4.0",
|
||||||
"gulp-watch": "^5.0.1",
|
"gulp-watch": "^5.0.1",
|
||||||
"hash-files": "^1.1.1",
|
"hash-files": "^1.1.1",
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
var fs = require('fs');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
|
function getDeps(module) {
|
||||||
|
var pkg = JSON.parse(fs.readFileSync(module.path + '/package.json'));
|
||||||
|
return pkg.dependencies ? Object.keys(pkg.dependencies) : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasChildren(module) {
|
||||||
|
try {
|
||||||
|
fs.statSync(module.path + '/node_modules');
|
||||||
|
return true;
|
||||||
|
} catch(err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function locateDep(module, dep, rootnm = false) {
|
||||||
|
var mPath = (rootnm ? '.' : module.path) + '/node_modules/' + dep;
|
||||||
|
try {
|
||||||
|
fs.statSync(mPath);
|
||||||
|
return {
|
||||||
|
name: dep,
|
||||||
|
path: mPath
|
||||||
|
}
|
||||||
|
} catch(err) {
|
||||||
|
if(!rootnm) return locateDep(module, dep, true);
|
||||||
|
return {
|
||||||
|
name: dep,
|
||||||
|
path: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildDependencyTree(depsRef, module) {
|
||||||
|
if(module.name === null || module.path === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.statSync(module.path + '/package.json');
|
||||||
|
} catch(err) { return; }
|
||||||
|
|
||||||
|
var deps = getDeps(module);
|
||||||
|
|
||||||
|
for(var dep of deps) {
|
||||||
|
var located = locateDep(module, dep);
|
||||||
|
if(!depsRef.find(d => d.path === located.path)) {
|
||||||
|
buildDependencyTree(depsRef, located);
|
||||||
|
depsRef.push(located);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hasChildren(located)) {
|
||||||
|
var childModules = fs.readdirSync(located.path + '/node_modules').map(name => located.path + '/node_modules/' + name).filter(source => fs.statSync(source).isDirectory());
|
||||||
|
for(var childModule of childModules) {
|
||||||
|
buildDependencyTree(depsRef, { name: '!child', path: childModule });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function(config) {
|
||||||
|
var depsRef = [];
|
||||||
|
|
||||||
|
buildDependencyTree(depsRef, {
|
||||||
|
name: '!root',
|
||||||
|
path: '.'
|
||||||
|
});
|
||||||
|
|
||||||
|
for(var dep of depsRef) {
|
||||||
|
if(!dep.path) {
|
||||||
|
if(!dep.name || !config.ignore.includes(dep.name)) {
|
||||||
|
console.warn('DEPENDENCY NOT FOUND:', dep.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var flatten = depsRef.filter(d => d.path && !d.path.replace('./node_modules', '').includes('node_modules'));
|
||||||
|
var star = flatten.map(d => d.path + '/**/*');
|
||||||
|
|
||||||
|
console.log('Found ' + star.length + ' dependencies');
|
||||||
|
return star;
|
||||||
|
}
|
Loading…
Reference in New Issue