@@ -73,15 +73,22 @@ const CSS_WHITELIST = [
7373 'density' ,
7474 'dom' ,
7575 'feature-targeting' ,
76+ 'progress-indicator' ,
7677 'rtl' ,
7778 'shape' ,
7879 'touch-target' ,
7980] ;
8081
82+ const JS_WHITELIST = [
83+ 'animation' ,
84+ 'progress-indicator' ,
85+ ] ;
86+
8187const NOT_AUTOINIT = [
8288 'auto-init' ,
8389 'base' ,
8490 'dom' ,
91+ 'progress-indicator' ,
8592 'tab' , // Only makes sense in context of tab-bar
8693 'tab-indicator' , // Only makes sense in context of tab-bar
8794 'tab-scroller' , // Only makes sense in context of tab-bar
@@ -126,14 +133,17 @@ function checkDependencyAddedInWebpackConfig() {
126133}
127134
128135function checkJSDependencyAddedInWebpackConfig ( ) {
129- const jsconfig = WEBPACK_CONFIG . find ( ( value ) => {
130- return value . name === 'main-js-a-la-carte' ;
131- } ) ;
132- const nameCamel = camelCase ( CLI_PACKAGE_JSON . name . replace ( '@material/' , '' ) ) ;
133- assert . notEqual ( typeof jsconfig . entry [ nameCamel ] , 'undefined' ,
134- 'FAILURE: Component ' + CLI_PACKAGE_JSON . name + ' javascript dependency is not added to webpack ' +
135- 'configuration. Please add ' + nameCamel + ' to ' + WEBPACK_CONFIG_RELATIVE_PATH + '\'s js-components ' +
136- 'entry before commit.' ) ;
136+ const name = getPkgName ( ) ;
137+ if ( JS_WHITELIST . indexOf ( name ) === - 1 ) {
138+ const jsconfig = WEBPACK_CONFIG . find ( ( value ) => {
139+ return value . name === 'main-js-a-la-carte' ;
140+ } ) ;
141+ const nameCamel = camelCase ( CLI_PACKAGE_JSON . name . replace ( '@material/' , '' ) ) ;
142+ assert . notEqual ( typeof jsconfig . entry [ nameCamel ] , 'undefined' ,
143+ 'FAILURE: Component ' + CLI_PACKAGE_JSON . name + ' javascript dependency is not added to webpack ' +
144+ 'configuration. Please add ' + nameCamel + ' to ' + WEBPACK_CONFIG_RELATIVE_PATH + '\'s js-components ' +
145+ 'entry before commit.' ) ;
146+ }
137147}
138148
139149function checkCSSDependencyAddedInWebpackConfig ( ) {
@@ -162,10 +172,13 @@ function checkDependencyAddedInMDCPackage() {
162172}
163173
164174function checkPkgDependencyAddedInMDCPackage ( ) {
165- assert . notEqual ( typeof MASTER_PACKAGE_JSON . dependencies [ CLI_PACKAGE_JSON . name ] , 'undefined' ,
166- 'FAILURE: Component ' + CLI_PACKAGE_JSON . name + ' is not a dependency for MDC Web. ' +
167- 'Please add ' + CLI_PACKAGE_JSON . name + ' to ' + MASTER_PACKAGE_JSON_RELATIVE_PATH +
168- '\' dependencies before commit.' ) ;
175+ const name = getPkgName ( ) ;
176+ if ( ! CSS_WHITELIST . filter ( ( x ) => JS_WHITELIST . includes ( x ) ) . includes ( name ) ) {
177+ assert . notEqual ( typeof MASTER_PACKAGE_JSON . dependencies [ CLI_PACKAGE_JSON . name ] , 'undefined' ,
178+ 'FAILURE: Component ' + CLI_PACKAGE_JSON . name + ' is not a dependency for MDC Web. ' +
179+ 'Please add ' + CLI_PACKAGE_JSON . name + ' to ' + MASTER_PACKAGE_JSON_RELATIVE_PATH +
180+ '\' dependencies before commit.' ) ;
181+ }
169182}
170183
171184function checkCSSDependencyAddedInMDCPackage ( ) {
@@ -185,10 +198,9 @@ function checkCSSDependencyAddedInMDCPackage() {
185198}
186199
187200function checkJSDependencyAddedInMDCPackage ( ) {
188- const NOT_IMPORTED = [ 'animation' ] ;
189201 const name = getPkgName ( ) ;
190202 if ( typeof ( CLI_PACKAGE_JSON . main ) !== 'undefined' &&
191- NOT_IMPORTED . indexOf ( name ) === - 1 ) {
203+ JS_WHITELIST . indexOf ( name ) === - 1 ) {
192204 const nameCamel = camelCase ( CLI_PACKAGE_JSON . name . replace ( '@material/' , '' ) ) ;
193205 const src = fs . readFileSync ( path . join ( process . env . PWD , MASTER_TS_RELATIVE_PATH ) , 'utf8' ) ;
194206 const ast = recast . parse ( src , {
0 commit comments