Files
DefinitelyTyped/types/del/del-tests.ts
2018-03-11 16:38:30 -04:00

48 lines
1.5 KiB
TypeScript

import del = require('del');
let paths = ['build', 'dist/**/*.js'];
del(['tmp/*.js', '!tmp/unicorn.js']);
del(['tmp/*.js', '!tmp/unicorn.js'], { force: true });
del(['tmp/*.js', '!tmp/unicorn.js'], { dryRun: true });
del(['tmp/*.js', '!tmp/unicorn.js'], { concurrency: 20 });
del(['tmp/*.js', '!tmp/unicorn.js'], { cwd: '' });
del(['tmp/*.js', '!tmp/unicorn.js']).then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
del(['tmp/*.js', '!tmp/unicorn.js'], { force: true }).then(
(paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
}
);
del('tmp/*.js');
del('tmp/*.js', { force: true });
del('tmp/*.js', { dryRun: true });
del('tmp/*.js', { concurrency: 20 });
del('tmp/*.js', { cwd: '' });
del('tmp/*.js').then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
del('tmp/*.js', { force: true }).then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
paths = del.sync(['tmp/*.js', '!tmp/unicorn.js']);
paths = del.sync(['tmp/*.js', '!tmp/unicorn.js'], { force: true });
paths = del.sync('tmp/*.js');
paths = del.sync('tmp/*.js', { force: true });
paths = del.sync('tmp/*.js', { dryRun: true });
paths = del.sync('tmp/*.js', { concurrency: 20 });
paths = del.sync('tmp/*.js', { cwd: '' });
const immutable: ReadonlyArray<string> = ['tmp/*.js', '!tmp/unicorn.js'];
const mutable = del(immutable);
const mutablePaths = del.sync(immutable);
mutable.then(paths => paths.push('test'));
mutablePaths.push('test');