Skip to content

Commit f6caf23

Browse files
amaltsevmgechev
authored andcommitted
Ignoring editor temporary files (mgechev#822)
* Ignoring editor temporary files This is a fix for mgechev#821 -- ignoring temporary files from editors when watching and building. * Tslint fixes, missing semicolon
1 parent ccbe9e5 commit f6caf23

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

tools/config/seed.config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ export class SeedConfig {
6666
{ src: `${this.CSS_SRC}/main.css`, inject: true, vendor: false }
6767
];
6868

69+
// Editor temporary files to ignore in watcher and asset builder.
70+
TEMP_FILES: string[] = [
71+
'**/*___jb_tmp___',
72+
'**/*~',
73+
];
74+
6975
get DEPENDENCIES(): InjectableDependency[] {
7076
return normalizeDependencies(this.NPM_DEPENDENCIES.filter(filterDependency.bind(null, this.ENV)))
7177
.concat(this.APP_ASSETS.filter(filterDependency.bind(null, this.ENV)));

tools/tasks/seed/build.assets.dev.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import * as gulp from 'gulp';
22
import {join} from 'path';
3-
import {APP_SRC, APP_DEST} from '../../config';
3+
import {APP_SRC, APP_DEST, TEMP_FILES} from '../../config';
44

55
export = () => {
6-
return gulp.src([
7-
join(APP_SRC, '**'),
8-
'!' + join(APP_SRC, '**', '*.ts')
9-
])
6+
let paths:string[]=[
7+
join(APP_SRC, '**'),
8+
'!' + join(APP_SRC, '**', '*.ts')
9+
].concat(TEMP_FILES.map((p) => { return '!'+p; }));
10+
11+
return gulp.src(paths)
1012
.pipe(gulp.dest(APP_DEST));
1113
}

tools/tasks/seed/build.assets.prod.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as gulp from 'gulp';
22
import {join} from 'path';
3-
import {APP_SRC, APP_DEST, ASSETS_SRC} from '../../config';
3+
import {APP_SRC, APP_DEST, ASSETS_SRC, TEMP_FILES} from '../../config';
44

55
// TODO There should be more elegant to prevent empty directories from copying
66
let es: any = require('event-stream');
@@ -21,7 +21,7 @@ export = () => {
2121
'!' + join(APP_SRC, '**', '*.css'),
2222
'!' + join(APP_SRC, '**', '*.html'),
2323
'!' + join(ASSETS_SRC, '**', '*.js')
24-
])
24+
].concat(TEMP_FILES.map((p) => { return '!'+p; })))
2525
.pipe(onlyDirs(es))
2626
.pipe(gulp.dest(APP_DEST));
2727
}

tools/utils/seed/watch.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ import * as runSequence from 'run-sequence';
22
import {notifyLiveReload} from '../../utils';
33
import * as gulpLoadPlugins from 'gulp-load-plugins';
44
import {join} from 'path';
5-
import {APP_SRC} from '../../config';
5+
import {APP_SRC,TEMP_FILES} from '../../config';
66
const plugins = <any>gulpLoadPlugins();
77

88
export function watch(taskname: string) {
99
return function () {
10-
plugins.watch(join(APP_SRC, '**'), (e:any) =>
10+
let paths:string[]=[
11+
join(APP_SRC,'**')
12+
].concat(TEMP_FILES.map((p) => { return '!'+p; }));
13+
14+
plugins.watch(paths, (e:any) =>
1115
runSequence(taskname, () => notifyLiveReload(e))
1216
);
1317
};

0 commit comments

Comments
 (0)