devextreme-cli 1.11.2 → 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 +4 -4
- package/index.js +8 -0
- package/package.json +4 -4
- package/src/application.js +23 -0
- package/src/applications/application.angular.js +102 -5
- package/src/commands.json +18 -0
- package/src/utility/latest-versions.js +3 -3
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# DevExtreme CLI
|
|
2
2
|
|
|
3
|
-
DevExtreme CLI
|
|
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
|
|
9
|
+
**DevExtreme CLI is a free and open-source add-on to DevExtreme, available under the [MIT license](LICENSE).**
|
|
10
10
|
|
|
11
|
-
|
|
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.
|
|
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/index.js
CHANGED
|
@@ -39,6 +39,14 @@ if(args.help) {
|
|
|
39
39
|
const run = async(commands, options) => {
|
|
40
40
|
if(application.isApplicationCommand(commands[0])) {
|
|
41
41
|
await application.run(commands, options, devextremeConfig.read());
|
|
42
|
+
} else if(application.isMigrationCommand(commands[0])) {
|
|
43
|
+
if(!commands[1]) {
|
|
44
|
+
console.error('Please specify a change name for migration.');
|
|
45
|
+
printHelp('migrate');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
await application.run(['migrate', commands[1], ...commands.slice(2)], options, { applicationEngine: 'angular' });
|
|
49
|
+
return;
|
|
42
50
|
} else if(themeBuilder.isThemeBuilderCommand(commands[0])) {
|
|
43
51
|
options.command = commands[0];
|
|
44
52
|
themeBuilder.run(options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devextreme-cli",
|
|
3
|
-
"version": "1.
|
|
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.
|
|
46
|
+
"sass": "^1.93.3",
|
|
47
47
|
"semver": "^5.7.2",
|
|
48
48
|
"strip-bom": "^4.0.0"
|
|
49
49
|
},
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
52
52
|
"@typescript-eslint/parser": "^4.33.0",
|
|
53
53
|
"babel-eslint": "^10.1.0",
|
|
54
|
-
"create-vite": "7.1.
|
|
54
|
+
"create-vite": "7.1.3",
|
|
55
55
|
"cross-env": "^5.2.1",
|
|
56
56
|
"eslint": "^7.32.0",
|
|
57
57
|
"eslint-config-angular": "^0.5.0",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"typescript-eslint-parser": "^22.0.0",
|
|
75
75
|
"wait-on": "8.0.5"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "7af3cab84fb0dee433711d63dd8ed65af4c7d9dd"
|
|
78
78
|
}
|
package/src/application.js
CHANGED
|
@@ -9,11 +9,20 @@ const isApplicationCommand = (command) => {
|
|
|
9
9
|
return [ 'new', 'add' ].includes(command);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
const isMigrationCommand = (command) => {
|
|
13
|
+
return [ 'migrate' ].includes(command);
|
|
14
|
+
};
|
|
15
|
+
|
|
12
16
|
const handleWrongAppType = (appType, command) => {
|
|
13
17
|
console.error(`The '${appType}' application type is not valid`);
|
|
14
18
|
printHelp(command);
|
|
15
19
|
};
|
|
16
20
|
|
|
21
|
+
const handleWrongChangeName = (changeName, command) => {
|
|
22
|
+
console.error(`The '${changeName}' change name is not valid`);
|
|
23
|
+
printHelp(command);
|
|
24
|
+
};
|
|
25
|
+
|
|
17
26
|
const createReact = async(appName, options, command) => {
|
|
18
27
|
const reactAppType = await getReactAppType(options['app-type']);
|
|
19
28
|
|
|
@@ -30,12 +39,25 @@ const createReact = async(appName, options, command) => {
|
|
|
30
39
|
};
|
|
31
40
|
|
|
32
41
|
const run = async(commands, options, devextremeConfig) => {
|
|
42
|
+
|
|
33
43
|
if(!commands[1]) {
|
|
34
44
|
console.error('Command is incomplete. Please specify parameters.');
|
|
35
45
|
printHelp(commands[0]);
|
|
36
46
|
return;
|
|
37
47
|
}
|
|
38
48
|
|
|
49
|
+
if(commands[0] === 'migrate') {
|
|
50
|
+
const changeName = commands[1];
|
|
51
|
+
switch(changeName) {
|
|
52
|
+
case 'angular-config-components':
|
|
53
|
+
await angularApplication.migrateConfigComponents(options);
|
|
54
|
+
return;
|
|
55
|
+
default:
|
|
56
|
+
handleWrongChangeName(changeName, commands[0]);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
39
61
|
if(commands[0] === 'new') {
|
|
40
62
|
const app = commands[1];
|
|
41
63
|
const appName = commands[2] || 'my-app';
|
|
@@ -104,5 +126,6 @@ const run = async(commands, options, devextremeConfig) => {
|
|
|
104
126
|
|
|
105
127
|
module.exports = {
|
|
106
128
|
isApplicationCommand,
|
|
129
|
+
isMigrationCommand,
|
|
107
130
|
run
|
|
108
131
|
};
|
|
@@ -54,12 +54,47 @@ async function runNgCommand(commandArguments, commandOptions, commandConfig) {
|
|
|
54
54
|
|
|
55
55
|
function localPackageExists(packageName) {
|
|
56
56
|
const nodeModulesPath = path.join(process.cwd(), 'node_modules');
|
|
57
|
-
if(
|
|
58
|
-
|
|
57
|
+
if(fs.existsSync(nodeModulesPath)) {
|
|
58
|
+
const packageJsonPath = path.join(nodeModulesPath, packageName, 'package.json');
|
|
59
|
+
if(fs.existsSync(packageJsonPath)) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
59
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
|
+
}
|
|
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
|
+
}
|
|
60
90
|
|
|
61
|
-
|
|
62
|
-
|
|
91
|
+
function schematicsCliExists() {
|
|
92
|
+
try {
|
|
93
|
+
require.resolve('@angular-devkit/schematics-cli/package.json');
|
|
94
|
+
return true;
|
|
95
|
+
} catch(e) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
63
98
|
}
|
|
64
99
|
|
|
65
100
|
const hasSutableNgCli = async() => {
|
|
@@ -152,6 +187,67 @@ const addView = (viewName, options) => {
|
|
|
152
187
|
runSchematicCommand('add-view', schematicOptions);
|
|
153
188
|
};
|
|
154
189
|
|
|
190
|
+
const migrateConfigComponents = async(options = {}) => {
|
|
191
|
+
const collectionName = 'devextreme-schematics';
|
|
192
|
+
const collectionPath = getCollectionPath(collectionName);
|
|
193
|
+
|
|
194
|
+
if(!collectionPath) {
|
|
195
|
+
const prompts = require('prompts');
|
|
196
|
+
|
|
197
|
+
console.log(`\nThe '${collectionName}' package is required to run this command.`);
|
|
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 cancelled. Install devextreme-schematics manually and rerun the command.');
|
|
208
|
+
process.exit(1);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const schematicOptions = {
|
|
213
|
+
...options
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const hasSchematicsCli = schematicsCliExists();
|
|
217
|
+
const commandArguments = ['--yes'];
|
|
218
|
+
|
|
219
|
+
if(!hasSchematicsCli) {
|
|
220
|
+
commandArguments.push('-p', '@angular-devkit/schematics-cli');
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if(!collectionPath) {
|
|
224
|
+
commandArguments.push('-p', `${collectionName}@${schematicsVersion}`);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const collectionSpecifier = collectionPath
|
|
228
|
+
? `${collectionPath.replace(/\\/g, '/')}:migrate-config-components`
|
|
229
|
+
: `${collectionName}:migrate-config-components`;
|
|
230
|
+
|
|
231
|
+
commandArguments.push('schematics', collectionSpecifier);
|
|
232
|
+
|
|
233
|
+
const { [depsVersionTagOptionName]: _, ...optionsToArguments } = schematicOptions; // eslint-disable-line no-unused-vars
|
|
234
|
+
for(let option in optionsToArguments) {
|
|
235
|
+
const value = optionsToArguments[option];
|
|
236
|
+
if(value !== undefined && value !== null && value !== '') {
|
|
237
|
+
if(Array.isArray(value)) {
|
|
238
|
+
if(value.length > 0) {
|
|
239
|
+
commandArguments.push(`--${dasherize(option)}=${value.join(',')}`);
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
commandArguments.push(`--${dasherize(option)}=${value}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Use runCommand directly with npx to work outside Angular workspace
|
|
248
|
+
return runCommand('npx', commandArguments, { stdio: 'inherit' });
|
|
249
|
+
};
|
|
250
|
+
|
|
155
251
|
const changeMainTs = (appPath) => {
|
|
156
252
|
const filePath = path.join(appPath, 'src', 'main.ts');
|
|
157
253
|
|
|
@@ -174,5 +270,6 @@ module.exports = {
|
|
|
174
270
|
install,
|
|
175
271
|
create,
|
|
176
272
|
addTemplate,
|
|
177
|
-
addView
|
|
273
|
+
addView,
|
|
274
|
+
migrateConfigComponents
|
|
178
275
|
};
|
package/src/commands.json
CHANGED
|
@@ -48,6 +48,24 @@
|
|
|
48
48
|
"name": "devextreme-angular",
|
|
49
49
|
"description": "Add DevExtreme to an Angular application"
|
|
50
50
|
}]
|
|
51
|
+
}, {
|
|
52
|
+
"name": "migrate",
|
|
53
|
+
"description": "Migration commands for DevExtreme applications",
|
|
54
|
+
"usage": "devextreme migrate <change name> [options]",
|
|
55
|
+
"arguments": [{
|
|
56
|
+
"name": "angular-config-components",
|
|
57
|
+
"description": "Migrate to the latest DevExtreme configuration components.",
|
|
58
|
+
"options": [{
|
|
59
|
+
"name": "--include",
|
|
60
|
+
"description": "Template file glob patterns to include (default: **/*.html). You can pass multiple patterns as a comma-separated string (e.g. \"**/a.html,**/b.html\") or as an array (e.g. [\"**/a.html\",\"**/b.html\"])."
|
|
61
|
+
}, {
|
|
62
|
+
"name": "--script-include",
|
|
63
|
+
"description": "TypeScript/JavaScript file glob patterns to scan for inline templates (default: **/*.ts,**/*.js). You can pass multiple patterns as a comma-separated string or as an array. Pass an empty value ('' or []) to disable."
|
|
64
|
+
}, {
|
|
65
|
+
"name": "--dry",
|
|
66
|
+
"description": "Run in dry mode to preview changes without applying them (default: false)."
|
|
67
|
+
}]
|
|
68
|
+
}]
|
|
51
69
|
}, {
|
|
52
70
|
"name": "build-theme",
|
|
53
71
|
"description": "Build a custom color scheme",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const packageJson = require('../../package.json');
|
|
2
2
|
module.exports = {
|
|
3
|
-
'devextreme': '25.1.
|
|
4
|
-
'devextreme-react': '25.1.
|
|
5
|
-
'devextreme-vue': '25.1.
|
|
3
|
+
'devextreme': '25.1.6',
|
|
4
|
+
'devextreme-react': '25.1.6',
|
|
5
|
+
'devextreme-vue': '25.1.6',
|
|
6
6
|
'create-vite': '7.0.0',
|
|
7
7
|
'create-vue': '3.17.0',
|
|
8
8
|
'create-next-app': '15.3.4',
|