forked from ionic-team/ionic-app-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreprocess.ts
More file actions
38 lines (30 loc) Β· 1.14 KB
/
preprocess.ts
File metadata and controls
38 lines (30 loc) Β· 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { join } from 'path';
import { Logger } from './logger/logger';
import * as Constants from './util/constants';
import { BuildError } from './util/errors';
import { GlobResult, globAll } from './util/glob-util';
import { getBooleanPropertyValue, getStringPropertyValue } from './util/helpers';
import { BuildContext, ChangedFile } from './util/interfaces';
import { bundleCoreComponents } from './core/bundle-components';
export function preprocess(context: BuildContext) {
const logger = new Logger(`preprocess`);
return preprocessWorker(context).then(() => {
logger.finish();
})
.catch((err: Error) => {
const error = new BuildError(err.message);
error.isFatal = true;
throw logger.fail(error);
});
}
function preprocessWorker(context: BuildContext) {
const bundlePromise = bundleCoreComponents(context);
return Promise.all([bundlePromise]);
}
export function preprocessUpdate(changedFiles: ChangedFile[], context: BuildContext) {
const promises: Promise<any>[] = [];
if (changedFiles.some(cf => cf.ext === '.scss')) {
promises.push(bundleCoreComponents(context));
}
return Promise.all(promises);
}