1
1
import { spawn } from 'child_process' ;
2
- import { existsSync , readFileSync , statSync , writeFileSync } from 'fs-extra' ;
3
- import { basename , join } from 'path' ;
2
+ import { existsSync , statSync , writeFileSync } from 'fs-extra' ;
3
+ import { join } from 'path' ;
4
4
import { dest , src , task } from 'gulp' ;
5
- import { inlineMetadataResources } from '../util/inline-resources' ;
6
- import { execNodeTask , execTask , sequenceTask } from '../util/task_helpers' ;
5
+ import { execTask , sequenceTask } from '../util/task_helpers' ;
7
6
import { composeRelease } from '../util/package-build' ;
7
+ import { Bundler } from 'scss-bundle' ;
8
8
import {
9
9
COMPONENTS_DIR ,
10
- DIST_BUNDLES ,
11
10
DIST_MATERIAL ,
12
11
DIST_RELEASES ,
13
- DIST_ROOT ,
14
- LICENSE_BANNER ,
15
- PROJECT_ROOT ,
16
12
} from '../constants' ;
17
13
import * as minimist from 'minimist' ;
18
14
19
15
// There are no type definitions available for these imports.
20
- const glob = require ( 'glob' ) ;
21
16
const gulpRename = require ( 'gulp-rename' ) ;
22
17
23
18
/** Parse command-line arguments for release task. */
@@ -32,6 +27,10 @@ const themingEntryPointPath = join(COMPONENTS_DIR, 'core', 'theming', '_all-them
32
27
// Output path for the scss theming bundle.
33
28
const themingBundlePath = join ( releasePath , '_theming.scss' ) ;
34
29
30
+ // Glob that matches all files that might be imported multiple times.
31
+ // Necessary for deduping inside of scss-bundle.
32
+ const themingBundleDedupeGlob = join ( COMPONENTS_DIR , '**/*.scss' ) ;
33
+
35
34
// Matches all pre-built theme css files
36
35
const prebuiltThemeGlob = join ( DIST_MATERIAL , '**/theming/prebuilt/*.css' ) ;
37
36
@@ -51,27 +50,18 @@ task(':package:theming', [':bundle:theming-scss'], () => {
51
50
} ) ;
52
51
53
52
/** Bundles all scss requires for theming into a single scss file in the root of the package. */
54
- task ( ':bundle:theming-scss' , execNodeTask (
55
- 'scss-bundle' ,
56
- 'scss-bundle' , [
57
- '-e' , themingEntryPointPath ,
58
- '-d' , themingBundlePath
59
- ] , { silentStdout : true }
60
- ) ) ;
53
+ task ( ':bundle:theming-scss' , ( ) => {
54
+ new Bundler ( ) . Bundle ( themingEntryPointPath , [ themingBundleDedupeGlob ] ) . then ( result => {
55
+ writeFileSync ( themingBundlePath , result . bundledContent ) ;
56
+ } ) ;
57
+ } ) ;
61
58
62
59
/** Make sure we're logged in. */
63
60
task ( ':publish:whoami' , execTask ( 'npm' , [ 'whoami' ] , {
64
61
silent : true ,
65
62
errMessage : 'You must be logged in to publish.'
66
63
} ) ) ;
67
64
68
- /** Create a typing file that links to the bundled definitions of NGC. */
69
- function createTypingFile ( ) {
70
- writeFileSync ( join ( releasePath , 'material.d.ts' ) ,
71
- LICENSE_BANNER + '\nexport * from "./typings/index";'
72
- ) ;
73
- }
74
-
75
65
task ( ':publish:logout' , execTask ( 'npm' , [ 'logout' ] ) ) ;
76
66
77
67
0 commit comments