@@ -63,40 +63,6 @@ function localPackageExists(packageName) {
6363 return false ;
6464}
6565
66- function getLocalCollectionPath ( packageName ) {
67- const nodeModulesPath = path . join ( process . cwd ( ) , 'node_modules' , packageName , 'src' , 'collection.json' ) ;
68- if ( fs . existsSync ( nodeModulesPath ) ) {
69- return nodeModulesPath ;
70- }
71- return null ;
72- }
73-
74- function getCollectionPath ( packageName ) {
75- const localPath = getLocalCollectionPath ( packageName ) ;
76- if ( localPath ) {
77- return localPath ;
78- }
79-
80- try {
81- const packageJsonPath = require . resolve ( `${ packageName } /package.json` ) ;
82- const collectionPath = path . join ( path . dirname ( packageJsonPath ) , 'src' , 'collection.json' ) ;
83- if ( fs . existsSync ( collectionPath ) ) {
84- return collectionPath ;
85- }
86- } catch ( e ) { }
87-
88- return null ;
89- }
90-
91- function schematicsCliExists ( ) {
92- try {
93- require . resolve ( '@angular-devkit/schematics-cli/package.json' ) ;
94- return true ;
95- } catch ( e ) {
96- return false ;
97- }
98- }
99-
10066const hasSutableNgCli = async ( ) => {
10167 const localVersion = ngVersion . getLocalNgVersion ( ) ;
10268
@@ -189,44 +155,17 @@ const addView = (viewName, options) => {
189155
190156const migrateConfigComponents = async ( options = { } ) => {
191157 const collectionName = 'devextreme-schematics' ;
192- const collectionPath = getCollectionPath ( collectionName ) ;
193-
194- if ( ! collectionPath ) {
195- const prompts = require ( 'prompts' ) ;
196-
197- console . log ( `\nRequired package is missing: '${ collectionName } '` ) ;
198-
199- const response = await prompts ( {
200- type : 'confirm' ,
201- name : 'install' ,
202- message : `Would you like to install '${ collectionName } @${ schematicsVersion } ' in the npm cache?` ,
203- initial : true
204- } ) ;
205-
206- if ( ! response . install ) {
207- console . log ( 'Migration was canceled.' ) ;
208- process . exit ( 1 ) ;
209- }
210- }
211158
212159 const schematicOptions = {
213160 ...options
214161 } ;
215162
216- const hasSchematicsCli = schematicsCliExists ( ) ;
217163 const commandArguments = [ '--yes' ] ;
218164
219- if ( ! hasSchematicsCli ) {
220- commandArguments . push ( '-p' , '@angular-devkit/schematics-cli' ) ;
221- }
222-
223- if ( ! collectionPath ) {
224- commandArguments . push ( '-p' , `${ collectionName } @${ schematicsVersion } ` ) ;
225- }
165+ commandArguments . push ( '-p' , '@angular-devkit/schematics-cli' ) ;
166+ commandArguments . push ( '-p' , `${ collectionName } @${ schematicsVersion } ` ) ;
226167
227- const collectionSpecifier = collectionPath
228- ? `${ collectionPath . replace ( / \\ / g, '/' ) } :migrate-config-components`
229- : `${ collectionName } :migrate-config-components` ;
168+ const collectionSpecifier = `${ collectionName } :migrate-config-components` ;
230169
231170 commandArguments . push ( 'schematics' , collectionSpecifier ) ;
232171
0 commit comments