Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'url-loader',
'webpack-cli',
'webpack-dev-server',
'yarn',
],
// skip calculation of missing dependencies
skipMissing: true,
ignoreDirs: [
'dist',
'dll',
'release',
'src/dist',
],
// the target special parsers
specials: [
depcheck.special.babel,
depcheck.special.eslint,
depcheck.special.webpack,
],
};
depcheck(path.join(__dirname, '..'), options, (unused) => {
const unusedDependencies = _.get(unused, 'dependencies', null);
const unusedDevDependencies = _.get(unused, 'devDependencies', null);
if (!_.isEmpty(unusedDependencies)) {
console.log(chalk.yellow.bold('Unused dependencies'));
console.log(chalk.yellow(_.join(unusedDependencies, '\n')));
}
if (!_.isEmpty(unusedDevDependencies)) {
console.log(chalk.yellow.bold('Unused devDependencies'));
console.log(chalk.yellow(_.join(unusedDevDependencies, '\n')));
}
'clean',
'lint',
'scripts',
'cover',
'test'
)(done);
});
// Examine package.json for unused deps (except for frontend and gulp)
gulp.task('depcheck', g.depcheck({
ignoreMatches : [
'babel-preset-es2015'
],
specials : [
depcheck.special['gulp-load-plugins']
]
}));
// What to do when you run `$ gulp`
gulp.task('default', done => {
g.sequence(
[ 'david', 'depcheck' ],
'build',
'watch'
)(done);
});
gulp.task('_unused-dependencies', done => {
gulpDepcheck({
ignoreDirs: configuration.exclude,
ignoreMatches: [ 'roboter-client', 'roboter-server' ],
parsers: {
'*.js': depcheck.parser.es6,
'*.jsx': depcheck.parser.jsx
},
detectors: [
depcheck.detector.requireCallExpression,
depcheck.detector.importDeclaration
],
specials: [
depcheck.special.babel,
depcheck.special.eslint,
depcheck.special.mocha,
depcheck.special.webpack
]
})().
then(done).
catch(err => {
if (
err.message.includes('You have unused dependencies') ||
err.message.includes('You have missing dependencies')
) {
gutil.log(err.message);
return done();
}
gulpDepcheck({
ignoreDirs: configuration.exclude,
ignoreMatches: [ 'roboter-client', 'roboter-server' ],
parsers: {
'*.js': depcheck.parser.es6,
'*.jsx': depcheck.parser.jsx
},
detectors: [
depcheck.detector.requireCallExpression,
depcheck.detector.importDeclaration
],
specials: [
depcheck.special.babel,
depcheck.special.eslint,
depcheck.special.mocha,
depcheck.special.webpack
]
})().
then(done).
catch(err => {
if (
err.message.includes('You have unused dependencies') ||
err.message.includes('You have missing dependencies')
) {
gutil.log(err.message);
return done();
}
done(err);
});
});
.on('data', (file) => {
options.parsers[file.path] = [
parser,
depcheck.special.babel,
depcheck.special.bin,
depcheck.special.eslint,
depcheck.special.webpack
];
})
.on('end', (err) => {
.on('data', (file: { path: string }) => {
depcheckOptions.parsers[file.path] = [
(content: string, filename: string) => {
return babylon.parse(
this.transpileService.transpile(content, filename),
{sourceType: 'module'}
);
},
depcheck.special.babel,
depcheck.special.bin,
depcheck.special.eslint,
depcheck.special.webpack
];
})
.on('end', (err: Error) => {
'tsconfig-paths',
'typescript'
],
parsers: {
'*.js': depcheck.parser.es6,
'*.jsx': depcheck.parser.jsx,
'*.ts': depcheck.parser.typescript,
'*.tsx': depcheck.parser.typescript
},
detectors: [
depcheck.detector.requireCallExpression,
depcheck.detector.importDeclaration
],
specials: [
depcheck.special.babel,
depcheck.special.bin,
depcheck.special.eslint,
depcheck.special.mocha,
depcheck.special.webpack
]
};
const {
invalidDirs,
invalidFiles,
dependencies,
devDependencies
} = await depcheck(directory, depcheckOptions);
if (invalidFiles.length > 0) {
throw new errors.FileParsingFailed(`Unable to parse some files: ${invalidFiles.join(', ')}`);
}
'ts-node',
'tsconfig-paths',
'typescript'
],
parsers: {
'*.js': depcheck.parser.es6,
'*.jsx': depcheck.parser.jsx,
'*.ts': depcheck.parser.typescript,
'*.tsx': depcheck.parser.typescript
},
detectors: [
depcheck.detector.requireCallExpression,
depcheck.detector.importDeclaration
],
specials: [
depcheck.special.babel,
depcheck.special.bin,
depcheck.special.eslint,
depcheck.special.mocha,
depcheck.special.webpack
]
};
const {
invalidDirs,
invalidFiles,
dependencies,
devDependencies
} = await depcheck(directory, depcheckOptions);
if (invalidFiles.length > 0) {
throw new errors.FileParsingFailed(`Unable to parse some files: ${invalidFiles.join(', ')}`);
.on('data', (file) => {
options.parsers[file.path] = [
parser,
depcheck.special.babel,
depcheck.special.bin,
depcheck.special.eslint,
depcheck.special.webpack
];
})
.on('end', (err) => {
.map((special) => depcheck.special[special])
.filter(Boolean);