devextreme-cli 1.12.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # DevExtreme CLI
2
2
 
3
- DevExtreme CLI is a set of command-line tools to be used with the DevExtreme controls library.
3
+ DevExtreme CLI implements command-line tools that help you integrate DevExpress DevExtreme components into your web applications.
4
4
 
5
5
  * [Documentation](https://js.devexpress.com/Documentation/Guide/Getting_Started/DevExtreme_CLI/)
6
6
 
7
7
  ## License ##
8
8
 
9
- **DevExtreme CLI is released as a MIT-licensed (free and open-source) add-on to DevExtreme.**
9
+ **DevExtreme CLI is a free and open-source add-on to DevExtreme, available under the [MIT license](LICENSE).**
10
10
 
11
- Familiarize yourself with the [DevExtreme License](https://js.devexpress.com/Licensing/). [Free trial is available!](http://js.devexpress.com/Buy/)
11
+ License terms for DevExpress DevExtreme are avialable on the [DevExtreme Licensing page](https://js.devexpress.com/Licensing/). To download a free evaluation version, visit the [DevExtreme website](http://js.devexpress.com/Buy/).
12
12
 
13
13
  ## Support & Feedback ##
14
14
 
15
- If you want to report a bug, request a feature, or ask a question, submit an [issue](https://github.com/DevExpress/devextreme-angular/issues) to this repo. Alternatively, you can contact us at the [DevExpress Support Center](https://www.devexpress.com/Support/Center) if you own an active DevExtreme license.
15
+ If you want to report a bug, request a feature, or ask a question, submit an [issue](https://github.com/DevExpress/devextreme-angular/issues) to this repo. You can also submit a ticket to the [DevExpress Support Center](https://www.devexpress.com/Support/Center) if you own an active DevExtreme license.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devextreme-cli",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "description": "DevExtreme CLI",
5
5
  "keywords": [
6
6
  "devexpress",
@@ -43,7 +43,7 @@
43
43
  "minimist": "^1.2.8",
44
44
  "mustache": "^3.2.1",
45
45
  "prompts": "^2.4.2",
46
- "sass": "^1.93.2",
46
+ "sass": "^1.93.3",
47
47
  "semver": "^5.7.2",
48
48
  "strip-bom": "^4.0.0"
49
49
  },
@@ -74,5 +74,5 @@
74
74
  "typescript-eslint-parser": "^22.0.0",
75
75
  "wait-on": "8.0.5"
76
76
  },
77
- "gitHead": "0a56ed4e9c13e1deb23007f0d23f974806878a7f"
77
+ "gitHead": "7af3cab84fb0dee433711d63dd8ed65af4c7d9dd"
78
78
  }
@@ -53,7 +53,6 @@ async function runNgCommand(commandArguments, commandOptions, commandConfig) {
53
53
  }
54
54
 
55
55
  function localPackageExists(packageName) {
56
- // Check local node_modules first
57
56
  const nodeModulesPath = path.join(process.cwd(), 'node_modules');
58
57
  if(fs.existsSync(nodeModulesPath)) {
59
58
  const packageJsonPath = path.join(nodeModulesPath, packageName, 'package.json');
@@ -61,16 +60,41 @@ function localPackageExists(packageName) {
61
60
  return true;
62
61
  }
63
62
  }
63
+ return false;
64
+ }
65
+
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
+ }
64
79
 
65
- // Check if globally installed by trying to resolve the package
66
80
  try {
67
- require.resolve(`${packageName}/package.json`);
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');
68
94
  return true;
69
95
  } catch(e) {
70
- // Package not found globally
96
+ return false;
71
97
  }
72
-
73
- return false;
74
98
  }
75
99
 
76
100
  const hasSutableNgCli = async() => {
@@ -165,9 +189,9 @@ const addView = (viewName, options) => {
165
189
 
166
190
  const migrateConfigComponents = async(options = {}) => {
167
191
  const collectionName = 'devextreme-schematics';
192
+ const collectionPath = getCollectionPath(collectionName);
168
193
 
169
- // Check if devextreme-schematics is installed
170
- if(!localPackageExists(collectionName)) {
194
+ if(!collectionPath) {
171
195
  const prompts = require('prompts');
172
196
 
173
197
  console.log(`\nThe '${collectionName}' package is required to run this command.`);
@@ -175,23 +199,12 @@ const migrateConfigComponents = async(options = {}) => {
175
199
  const response = await prompts({
176
200
  type: 'confirm',
177
201
  name: 'install',
178
- message: `Would you like to install '${collectionName}' now?`,
202
+ message: `Would you like to install '${collectionName}@${schematicsVersion}' in the npm cache?`,
179
203
  initial: true
180
204
  });
181
205
 
182
206
  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}`);
207
+ console.log('Migration cancelled. Install devextreme-schematics manually and rerun the command.');
195
208
  process.exit(1);
196
209
  }
197
210
  }
@@ -200,14 +213,22 @@ const migrateConfigComponents = async(options = {}) => {
200
213
  ...options
201
214
  };
202
215
 
203
- if(schematicOptions.include && typeof schematicOptions.include === 'string') {
204
- schematicOptions.include = schematicOptions.include.split(',').map(s => s.trim());
216
+ const hasSchematicsCli = schematicsCliExists();
217
+ const commandArguments = ['--yes'];
218
+
219
+ if(!hasSchematicsCli) {
220
+ commandArguments.push('-p', '@angular-devkit/schematics-cli');
205
221
  }
206
- if(schematicOptions.scriptInclude && typeof schematicOptions.scriptInclude === 'string') {
207
- schematicOptions.scriptInclude = schematicOptions.scriptInclude.split(',').map(s => s.trim());
222
+
223
+ if(!collectionPath) {
224
+ commandArguments.push('-p', `${collectionName}@${schematicsVersion}`);
208
225
  }
209
226
 
210
- const commandArguments = ['schematics', `${collectionName}:migrate-config-components`];
227
+ const collectionSpecifier = collectionPath
228
+ ? `${collectionPath.replace(/\\/g, '/')}:migrate-config-components`
229
+ : `${collectionName}:migrate-config-components`;
230
+
231
+ commandArguments.push('schematics', collectionSpecifier);
211
232
 
212
233
  const { [depsVersionTagOptionName]: _, ...optionsToArguments } = schematicOptions; // eslint-disable-line no-unused-vars
213
234
  for(let option in optionsToArguments) {