Skip to content

Commit 97ec99c

Browse files
committed
fix deps usage issue
1 parent 23ff29f commit 97ec99c

File tree

1 file changed

+5
-32
lines changed

1 file changed

+5
-32
lines changed

packages/devextreme-cli/src/applications/application.angular.js

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,20 @@ const ngCliWithZoneless = new semver('20.0.0');
1818
async function runSchematicCommand(schematicCommand, options, evaluatingOptions) {
1919
const collectionName = 'devextreme-schematics';
2020
let collectionPath = `${collectionName}@${schematicsVersion}`;
21+
let isLocalCollection = false;
2122

2223
if(options['c']) {
2324
collectionPath = `${path.join(process.cwd(), options['c'])}`;
25+
isLocalCollection = true;
2426
delete options['c'];
2527
}
2628

27-
if(!localPackageExists(collectionName)) {
29+
if(!isLocalCollection && !localPackageExists(collectionName)) {
2830
await runNgCommand(['add', collectionPath, '--skip-confirmation=true'], options, evaluatingOptions);
2931
}
3032

31-
const commandArguments = ['g', `${collectionName}:${schematicCommand}`];
33+
const collectionToUse = isLocalCollection ? collectionPath : collectionName;
34+
const commandArguments = ['g', `${collectionToUse}:${schematicCommand}`];
3235

3336
const { [depsVersionTagOptionName]: _, ...optionsToArguments } = options; // eslint-disable-line no-unused-vars
3437
for(let option in optionsToArguments) {
@@ -166,36 +169,6 @@ const addView = (viewName, options) => {
166169
const migrateConfigComponents = async(options = {}) => {
167170
const collectionName = 'devextreme-schematics';
168171

169-
// Check if devextreme-schematics is installed
170-
if(!localPackageExists(collectionName)) {
171-
const prompts = require('prompts');
172-
173-
console.log(`\nThe '${collectionName}' package is required to run this command.`);
174-
175-
const response = await prompts({
176-
type: 'confirm',
177-
name: 'install',
178-
message: `Would you like to install '${collectionName}' now?`,
179-
initial: true
180-
});
181-
182-
if(!response.install) {
183-
console.log('Migration cancelled. Please install devextreme-schematics manually:');
184-
console.log(`npm install -g ${collectionName}@${schematicsVersion}`);
185-
process.exit(1);
186-
}
187-
188-
console.log(`Installing ${collectionName}@${schematicsVersion}...`);
189-
try {
190-
await runCommand('npm', ['install', '-g', `${collectionName}@${schematicsVersion}`], { stdio: 'inherit' });
191-
console.log('Installation completed successfully.');
192-
} catch(error) {
193-
console.error('Failed to install devextreme-schematics. Please install manually:');
194-
console.error(`npm install -g ${collectionName}@${schematicsVersion}`);
195-
process.exit(1);
196-
}
197-
}
198-
199172
const schematicOptions = {
200173
...options
201174
};

0 commit comments

Comments
 (0)