devexpress-dashboard-cli 22.1.10 → 22.1.11
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/LICENSE +21 -21
- package/README.md +65 -65
- package/commands.json +23 -23
- package/index.js +61 -61
- package/package.json +28 -28
- package/theme-builder.js +46 -46
- package/utils.js +102 -102
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) Developer Express Inc.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Developer Express Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
# DevExpress Dashboard CLI
|
|
2
|
-
|
|
3
|
-
The **DevExpress Dashboard CLI** is a set of command-line tools to be used with the DevExpress Dashboard control.
|
|
4
|
-
|
|
5
|
-
- [Installation](#installation)
|
|
6
|
-
- [Usage](#usage)
|
|
7
|
-
- [License](#license)
|
|
8
|
-
- [Support & Feedback](#support--feedback)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
To install the `devexpress-dashboard-cli` package globally with `npm`, run the following command:
|
|
14
|
-
|
|
15
|
-
```shell
|
|
16
|
-
npm install -g devexpress-dashboard-cli
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Make sure you have [Node.js and npm](https://nodejs.org/en/download/) installed on your machine.
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
Use the **DevExpress Dashboard CLI** to create a custom Dashboard theme or apply a custom DevExtreme theme created with the [ThemeBuilder](https://devexpress.github.io/ThemeBuilder/).
|
|
24
|
-
|
|
25
|
-
The DevExpress Dashboard CLI uses the Dashboard ThemeBuilder's exported json file to generate CSS files for the custom theme.
|
|
26
|
-
|
|
27
|
-
The following command generates custom CSS files:
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
npx devexpress-dashboard-cli build-theme
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Use `--help` to list the available parameters:
|
|
34
|
-
|
|
35
|
-
```shell
|
|
36
|
-
npx devexpress-dashboard-cli build-theme --help
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Arguments | Description
|
|
40
|
-
---------|----------
|
|
41
|
-
`--input-file`| Specifies the json file generated by the DevExtreme ThemeBuilder.
|
|
42
|
-
`--base-theme` | Specifies a base theme's name (the default value is `generic.light`).
|
|
43
|
-
`--output-color-scheme` | Specifies the custom color scheme name (the default value is `custom-scheme`).
|
|
44
|
-
`--output-dir` | Specifies the folder to save output files (the default value is the current directory).
|
|
45
|
-
`--version` | Specifies the target peer dependencies version.
|
|
46
|
-
|
|
47
|
-
See the following topics for information on how to create and apply the custom theme:
|
|
48
|
-
|
|
49
|
-
- [ASP.NET Core Dashboard Control - Customize Themes](https://docs.devexpress.com/Dashboard/119993#customize-themes)
|
|
50
|
-
- [ASP.NET MVC Dashboard Extension - Customize Themes](https://docs.devexpress.com/Dashboard/16983#customize-themes)
|
|
51
|
-
- [ASP.NET Web Forms Dashboard Control - Customize Themes](https://docs.devexpress.com/Dashboard/117353#customize-themes)
|
|
52
|
-
- [Dashboard Component for Angular - Customize Themes](https://docs.devexpress.com/Dashboard/402098#customize-themes)
|
|
53
|
-
- [Dashboard Component for React - Customize Themes](https://docs.devexpress.com/Dashboard/402175#customize-themes)
|
|
54
|
-
- [Dashboard Component for Vue - Customize Themes](https://docs.devexpress.com/Dashboard/402492#customize-themes)
|
|
55
|
-
- [Dashboard Control for JavaScript Applications - Customize Themes](https://docs.devexpress.com/Dashboard/119299#customize-themes)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
## License
|
|
59
|
-
|
|
60
|
-
DevExpress Dashboard CLI is distributed under the **MIT** license (free and open-source), but can only be used with a commercial DevExpress Dashboard software product. You can [review the license terms](https://www.devexpress.com/Support/EULAs/NetComponents.xml) or [download a free trial version](https://go.devexpress.com/DevExpressDownload_UniversalTrial.aspx) of the Dashboard suite at [DevExpress.com](https://www.devexpress.com).
|
|
61
|
-
|
|
62
|
-
## Support & Feedback
|
|
63
|
-
|
|
64
|
-
- Follow [this article](https://docs.devexpress.com/Dashboard/119299/) for general information about themes and styles.
|
|
65
|
-
- For any questions regarding the use of DevExpress Dashboards tools, please refer to our [Support Center](https://www.devexpress.com/Support/Center).
|
|
1
|
+
# DevExpress Dashboard CLI
|
|
2
|
+
|
|
3
|
+
The **DevExpress Dashboard CLI** is a set of command-line tools to be used with the DevExpress Dashboard control.
|
|
4
|
+
|
|
5
|
+
- [Installation](#installation)
|
|
6
|
+
- [Usage](#usage)
|
|
7
|
+
- [License](#license)
|
|
8
|
+
- [Support & Feedback](#support--feedback)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
To install the `devexpress-dashboard-cli` package globally with `npm`, run the following command:
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
npm install -g devexpress-dashboard-cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Make sure you have [Node.js and npm](https://nodejs.org/en/download/) installed on your machine.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Use the **DevExpress Dashboard CLI** to create a custom Dashboard theme or apply a custom DevExtreme theme created with the [ThemeBuilder](https://devexpress.github.io/ThemeBuilder/).
|
|
24
|
+
|
|
25
|
+
The DevExpress Dashboard CLI uses the Dashboard ThemeBuilder's exported json file to generate CSS files for the custom theme.
|
|
26
|
+
|
|
27
|
+
The following command generates custom CSS files:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
npx devexpress-dashboard-cli build-theme
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Use `--help` to list the available parameters:
|
|
34
|
+
|
|
35
|
+
```shell
|
|
36
|
+
npx devexpress-dashboard-cli build-theme --help
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Arguments | Description
|
|
40
|
+
---------|----------
|
|
41
|
+
`--input-file`| Specifies the json file generated by the DevExtreme ThemeBuilder.
|
|
42
|
+
`--base-theme` | Specifies a base theme's name (the default value is `generic.light`).
|
|
43
|
+
`--output-color-scheme` | Specifies the custom color scheme name (the default value is `custom-scheme`).
|
|
44
|
+
`--output-dir` | Specifies the folder to save output files (the default value is the current directory).
|
|
45
|
+
`--version` | Specifies the target peer dependencies version.
|
|
46
|
+
|
|
47
|
+
See the following topics for information on how to create and apply the custom theme:
|
|
48
|
+
|
|
49
|
+
- [ASP.NET Core Dashboard Control - Customize Themes](https://docs.devexpress.com/Dashboard/119993#customize-themes)
|
|
50
|
+
- [ASP.NET MVC Dashboard Extension - Customize Themes](https://docs.devexpress.com/Dashboard/16983#customize-themes)
|
|
51
|
+
- [ASP.NET Web Forms Dashboard Control - Customize Themes](https://docs.devexpress.com/Dashboard/117353#customize-themes)
|
|
52
|
+
- [Dashboard Component for Angular - Customize Themes](https://docs.devexpress.com/Dashboard/402098#customize-themes)
|
|
53
|
+
- [Dashboard Component for React - Customize Themes](https://docs.devexpress.com/Dashboard/402175#customize-themes)
|
|
54
|
+
- [Dashboard Component for Vue - Customize Themes](https://docs.devexpress.com/Dashboard/402492#customize-themes)
|
|
55
|
+
- [Dashboard Control for JavaScript Applications - Customize Themes](https://docs.devexpress.com/Dashboard/119299#customize-themes)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
DevExpress Dashboard CLI is distributed under the **MIT** license (free and open-source), but can only be used with a commercial DevExpress Dashboard software product. You can [review the license terms](https://www.devexpress.com/Support/EULAs/NetComponents.xml) or [download a free trial version](https://go.devexpress.com/DevExpressDownload_UniversalTrial.aspx) of the Dashboard suite at [DevExpress.com](https://www.devexpress.com).
|
|
61
|
+
|
|
62
|
+
## Support & Feedback
|
|
63
|
+
|
|
64
|
+
- Follow [this article](https://docs.devexpress.com/Dashboard/119299/) for general information about themes and styles.
|
|
65
|
+
- For any questions regarding the use of DevExpress Dashboards tools, please refer to our [Support Center](https://www.devexpress.com/Support/Center).
|
package/commands.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"commands": [{
|
|
3
|
-
"name": "build-theme",
|
|
4
|
-
"description": "Build a custom theme",
|
|
5
|
-
"usage": "devexpress-dashboard-cli build-theme [options]",
|
|
6
|
-
"options": [{
|
|
7
|
-
"name": "--input-file",
|
|
8
|
-
"description": "Specifies the json file generated by the DevExtreme ThemeBuilder"
|
|
9
|
-
}, {
|
|
10
|
-
"name": "--base-theme",
|
|
11
|
-
"description": "Specifies a base theme's name (the default value is 'generic.light')"
|
|
12
|
-
}, {
|
|
13
|
-
"name": "--output-color-scheme",
|
|
14
|
-
"description": "Specifies the custom color scheme name (the default value is 'custom-scheme')"
|
|
15
|
-
}, {
|
|
16
|
-
"name": "--output-dir",
|
|
17
|
-
"description": "Specifies the folder to save output files (the default value is the current directory)"
|
|
18
|
-
}, {
|
|
19
|
-
"name": "--version",
|
|
20
|
-
"description": "Specifies the target peer dependencies version"
|
|
21
|
-
}]
|
|
22
|
-
}]
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"commands": [{
|
|
3
|
+
"name": "build-theme",
|
|
4
|
+
"description": "Build a custom theme",
|
|
5
|
+
"usage": "devexpress-dashboard-cli build-theme [options]",
|
|
6
|
+
"options": [{
|
|
7
|
+
"name": "--input-file",
|
|
8
|
+
"description": "Specifies the json file generated by the DevExtreme ThemeBuilder"
|
|
9
|
+
}, {
|
|
10
|
+
"name": "--base-theme",
|
|
11
|
+
"description": "Specifies a base theme's name (the default value is 'generic.light')"
|
|
12
|
+
}, {
|
|
13
|
+
"name": "--output-color-scheme",
|
|
14
|
+
"description": "Specifies the custom color scheme name (the default value is 'custom-scheme')"
|
|
15
|
+
}, {
|
|
16
|
+
"name": "--output-dir",
|
|
17
|
+
"description": "Specifies the folder to save output files (the default value is the current directory)"
|
|
18
|
+
}, {
|
|
19
|
+
"name": "--version",
|
|
20
|
+
"description": "Specifies the target peer dependencies version"
|
|
21
|
+
}]
|
|
22
|
+
}]
|
|
23
|
+
}
|
package/index.js
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const { version } = require('./package.json'),
|
|
3
|
-
{ ensurePeerDependencies, printHelp, processArgs } = require('./utils'),
|
|
4
|
-
{ fork } = require('child_process');
|
|
5
|
-
|
|
6
|
-
const buildThemeCommand = (args) => {
|
|
7
|
-
return new Promise((resolve, reject) => {
|
|
8
|
-
let worker = fork(require.resolve('./theme-builder'));
|
|
9
|
-
|
|
10
|
-
ensurePeerDependencies(args.version)
|
|
11
|
-
.then(() => {
|
|
12
|
-
console.log('Building the theme...');
|
|
13
|
-
|
|
14
|
-
worker.send(args);
|
|
15
|
-
|
|
16
|
-
worker.on("message", (err) => reject(err));
|
|
17
|
-
worker.on('exit', (statusCode) => {
|
|
18
|
-
if(statusCode) {
|
|
19
|
-
reject('Failed to build the theme.');
|
|
20
|
-
} else {
|
|
21
|
-
console.log('Done.')
|
|
22
|
-
resolve();
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
.catch(err => {
|
|
28
|
-
worker.kill();
|
|
29
|
-
reject(err);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const processCommand = async (command, args) => {
|
|
35
|
-
if(!command) {
|
|
36
|
-
if(args.version) {
|
|
37
|
-
console.log(version);
|
|
38
|
-
} else {
|
|
39
|
-
printHelp();
|
|
40
|
-
process.exit();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if(args.help) {
|
|
45
|
-
printHelp(command);
|
|
46
|
-
process.exit();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
switch(command) {
|
|
50
|
-
case 'build-theme':
|
|
51
|
-
await buildThemeCommand(args);
|
|
52
|
-
break;
|
|
53
|
-
default:
|
|
54
|
-
console.error(`Invalid command: ${commands[0]}.`);
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const [commands, options] = processArgs();
|
|
61
|
-
processCommand(commands && commands[0], options)
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { version } = require('./package.json'),
|
|
3
|
+
{ ensurePeerDependencies, printHelp, processArgs } = require('./utils'),
|
|
4
|
+
{ fork } = require('child_process');
|
|
5
|
+
|
|
6
|
+
const buildThemeCommand = (args) => {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
let worker = fork(require.resolve('./theme-builder'));
|
|
9
|
+
|
|
10
|
+
ensurePeerDependencies(args.version)
|
|
11
|
+
.then(() => {
|
|
12
|
+
console.log('Building the theme...');
|
|
13
|
+
|
|
14
|
+
worker.send(args);
|
|
15
|
+
|
|
16
|
+
worker.on("message", (err) => reject(err));
|
|
17
|
+
worker.on('exit', (statusCode) => {
|
|
18
|
+
if(statusCode) {
|
|
19
|
+
reject('Failed to build the theme.');
|
|
20
|
+
} else {
|
|
21
|
+
console.log('Done.')
|
|
22
|
+
resolve();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
})
|
|
27
|
+
.catch(err => {
|
|
28
|
+
worker.kill();
|
|
29
|
+
reject(err);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const processCommand = async (command, args) => {
|
|
35
|
+
if(!command) {
|
|
36
|
+
if(args.version) {
|
|
37
|
+
console.log(version);
|
|
38
|
+
} else {
|
|
39
|
+
printHelp();
|
|
40
|
+
process.exit();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if(args.help) {
|
|
45
|
+
printHelp(command);
|
|
46
|
+
process.exit();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
switch(command) {
|
|
50
|
+
case 'build-theme':
|
|
51
|
+
await buildThemeCommand(args);
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
console.error(`Invalid command: ${commands[0]}.`);
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const [commands, options] = processArgs();
|
|
61
|
+
processCommand(commands && commands[0], options)
|
|
62
62
|
.catch(err => console.error(err instanceof Error ? `Error: ${err.message}` : `Error: ${err}`));
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "devexpress-dashboard-cli",
|
|
3
|
-
"version": "22.1.
|
|
4
|
-
"description": "DevExpress Dashboard CLI",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"devexpress",
|
|
7
|
-
"dashboard",
|
|
8
|
-
"cli",
|
|
9
|
-
"themebuilder",
|
|
10
|
-
"theme",
|
|
11
|
-
"application"
|
|
12
|
-
],
|
|
13
|
-
"bin": {
|
|
14
|
-
"devexpress-dashboard-cli": "index.js"
|
|
15
|
-
},
|
|
16
|
-
"author": "Developer Express Inc.",
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"devextreme-themebuilder": "22.1.
|
|
20
|
-
"devexpress-dashboard": "22.1.
|
|
21
|
-
"@devexpress/analytics-core": "22.1.
|
|
22
|
-
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"less": "3.9.0",
|
|
25
|
-
"minimist": "^1.2.0",
|
|
26
|
-
"sass": "1.43.5",
|
|
27
|
-
"clean-css": "^4.2.1"
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "devexpress-dashboard-cli",
|
|
3
|
+
"version": "22.1.11",
|
|
4
|
+
"description": "DevExpress Dashboard CLI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"devexpress",
|
|
7
|
+
"dashboard",
|
|
8
|
+
"cli",
|
|
9
|
+
"themebuilder",
|
|
10
|
+
"theme",
|
|
11
|
+
"application"
|
|
12
|
+
],
|
|
13
|
+
"bin": {
|
|
14
|
+
"devexpress-dashboard-cli": "index.js"
|
|
15
|
+
},
|
|
16
|
+
"author": "Developer Express Inc.",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"devextreme-themebuilder": "22.1.11",
|
|
20
|
+
"devexpress-dashboard": "22.1.11",
|
|
21
|
+
"@devexpress/analytics-core": "22.1.11"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"less": "3.9.0",
|
|
25
|
+
"minimist": "^1.2.0",
|
|
26
|
+
"sass": "1.43.5",
|
|
27
|
+
"clean-css": "^4.2.1"
|
|
28
|
+
}
|
|
29
29
|
}
|
package/theme-builder.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
const path = require('path'),
|
|
2
|
-
nodeSass = require('sass'),
|
|
3
|
-
nodeLess = require('less/lib/less-node'),
|
|
4
|
-
cleanCSS = require('clean-css');
|
|
5
|
-
|
|
6
|
-
const getCssHeader = (themeName) => {
|
|
7
|
-
const buildDate = new Date().toLocaleDateString('en', { month: 'short', year: 'numeric', day: 'numeric' }),
|
|
8
|
-
devextremeVersion = require('devextreme-themebuilder/package.json').version,
|
|
9
|
-
analyticsVersion = require('@devexpress/analytics-core/package.json').version,
|
|
10
|
-
dashboardVersion = require('devexpress-dashboard/package.json').version;
|
|
11
|
-
|
|
12
|
-
return `\
|
|
13
|
-
/**\n\
|
|
14
|
-
* DevExpress Dashboard Custom Theme: ${themeName}\n\
|
|
15
|
-
* DevExtreme Theme Builder v.${devextremeVersion}\n\
|
|
16
|
-
* DevExpress Analytics v.${analyticsVersion}\n\
|
|
17
|
-
* DevExpress Dashboard v.${dashboardVersion}\n\
|
|
18
|
-
* Build date: ${buildDate}\n\
|
|
19
|
-
*/\n`;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const themeBuilder = async (args) => {
|
|
23
|
-
let devextremeLessPath, devextremeThemeBuilder, analyticsThemeBuilder, dashboardThemeBuilder;
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
devextremeLessPath = path.join(path.dirname(require.resolve("devextreme-themebuilder/package.json")), "data", "less", "bundles");
|
|
27
|
-
devextremeThemeBuilder = require('devextreme-themebuilder');
|
|
28
|
-
analyticsThemeBuilder = require('@devexpress/analytics-core/utils/theme-builder').buildTheme;
|
|
29
|
-
dashboardThemeBuilder = require('devexpress-dashboard/utils/theme-builder').buildTheme;
|
|
30
|
-
} catch(err) {
|
|
31
|
-
process.send(err instanceof Error ? err.message : err);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
nodeLess.options = nodeLess.options || {};
|
|
36
|
-
nodeLess.options['paths'] = [devextremeLessPath];
|
|
37
|
-
nodeLess.options['math'] = 'always';
|
|
38
|
-
|
|
39
|
-
await dashboardThemeBuilder(args, devextremeThemeBuilder, analyticsThemeBuilder, nodeSass, nodeLess, cleanCSS, getCssHeader)
|
|
40
|
-
.catch((err) => {
|
|
41
|
-
process.send(err instanceof Error ? err.message : err);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
})
|
|
44
|
-
.then(() => process.exit(0), () => process.exit(1));
|
|
45
|
-
};
|
|
46
|
-
|
|
1
|
+
const path = require('path'),
|
|
2
|
+
nodeSass = require('sass'),
|
|
3
|
+
nodeLess = require('less/lib/less-node'),
|
|
4
|
+
cleanCSS = require('clean-css');
|
|
5
|
+
|
|
6
|
+
const getCssHeader = (themeName) => {
|
|
7
|
+
const buildDate = new Date().toLocaleDateString('en', { month: 'short', year: 'numeric', day: 'numeric' }),
|
|
8
|
+
devextremeVersion = require('devextreme-themebuilder/package.json').version,
|
|
9
|
+
analyticsVersion = require('@devexpress/analytics-core/package.json').version,
|
|
10
|
+
dashboardVersion = require('devexpress-dashboard/package.json').version;
|
|
11
|
+
|
|
12
|
+
return `\
|
|
13
|
+
/**\n\
|
|
14
|
+
* DevExpress Dashboard Custom Theme: ${themeName}\n\
|
|
15
|
+
* DevExtreme Theme Builder v.${devextremeVersion}\n\
|
|
16
|
+
* DevExpress Analytics v.${analyticsVersion}\n\
|
|
17
|
+
* DevExpress Dashboard v.${dashboardVersion}\n\
|
|
18
|
+
* Build date: ${buildDate}\n\
|
|
19
|
+
*/\n`;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const themeBuilder = async (args) => {
|
|
23
|
+
let devextremeLessPath, devextremeThemeBuilder, analyticsThemeBuilder, dashboardThemeBuilder;
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
devextremeLessPath = path.join(path.dirname(require.resolve("devextreme-themebuilder/package.json")), "data", "less", "bundles");
|
|
27
|
+
devextremeThemeBuilder = require('devextreme-themebuilder');
|
|
28
|
+
analyticsThemeBuilder = require('@devexpress/analytics-core/utils/theme-builder').buildTheme;
|
|
29
|
+
dashboardThemeBuilder = require('devexpress-dashboard/utils/theme-builder').buildTheme;
|
|
30
|
+
} catch(err) {
|
|
31
|
+
process.send(err instanceof Error ? err.message : err);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
nodeLess.options = nodeLess.options || {};
|
|
36
|
+
nodeLess.options['paths'] = [devextremeLessPath];
|
|
37
|
+
nodeLess.options['math'] = 'always';
|
|
38
|
+
|
|
39
|
+
await dashboardThemeBuilder(args, devextremeThemeBuilder, analyticsThemeBuilder, nodeSass, nodeLess, cleanCSS, getCssHeader)
|
|
40
|
+
.catch((err) => {
|
|
41
|
+
process.send(err instanceof Error ? err.message : err);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
})
|
|
44
|
+
.then(() => process.exit(0), () => process.exit(1));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
47
|
process.on("message", async (args) => await themeBuilder(args));
|
package/utils.js
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
const minimist = require('minimist'),
|
|
2
|
-
path = require('path'),
|
|
3
|
-
{ spawn } = require('child_process');
|
|
4
|
-
|
|
5
|
-
const camelCase = str => str.replace(/[-](\w|$)/g, (_, letter) => {
|
|
6
|
-
return letter.toUpperCase();
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const camelize = (object) => {
|
|
10
|
-
let result = {};
|
|
11
|
-
for(let key in object) {
|
|
12
|
-
if(object.hasOwnProperty(key)) {
|
|
13
|
-
const newKey = camelCase(key);
|
|
14
|
-
result[newKey] = object[key];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return result;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const isModuleResolved = (moduleName) => {
|
|
21
|
-
try {
|
|
22
|
-
require(moduleName);
|
|
23
|
-
} catch(e) {
|
|
24
|
-
return !(e instanceof Error && e.code === 'MODULE_NOT_FOUND');
|
|
25
|
-
}
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const installNpmPkgs = (packages) => {
|
|
30
|
-
let isWinOS = /^win/.test(process.platform);
|
|
31
|
-
|
|
32
|
-
let npmCmd = isWinOS ? 'npm.cmd' : 'npm';
|
|
33
|
-
let args = ['install', '--no-save'].concat(packages);
|
|
34
|
-
|
|
35
|
-
return new Promise((resolve, reject) => {
|
|
36
|
-
spawn(npmCmd, args, {cwd: path.join(__dirname, '..'), stdio: 'ignore', windowsVerbatimArguments: true })
|
|
37
|
-
.on('exit', (statusCode) => statusCode ? reject(`Failed to install packages. Status code: ${statusCode}`) : resolve())
|
|
38
|
-
.on('error', (errorMsg) => reject(errorMsg));
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
module.exports = {
|
|
43
|
-
"ensurePeerDependencies": async (depsVersion) => {
|
|
44
|
-
const { peerDependencies } = require('./package.json');
|
|
45
|
-
|
|
46
|
-
let requirePkgs = Object.keys(peerDependencies);
|
|
47
|
-
let installedPkgs = requirePkgs.filter((pkg) => isModuleResolved(`${pkg}/package.json`));
|
|
48
|
-
|
|
49
|
-
if(requirePkgs.length === installedPkgs.length) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if(installedPkgs.length === 0) {
|
|
54
|
-
let pkgsToInstall = requirePkgs.map((pkg) => `${pkg}@${depsVersion || peerDependencies[pkg]}`);
|
|
55
|
-
console.log(`Install peer dependencies: ${pkgsToInstall.join(', ')}.`);
|
|
56
|
-
|
|
57
|
-
await installNpmPkgs(pkgsToInstall);
|
|
58
|
-
console.log('Packages are installed.');
|
|
59
|
-
|
|
60
|
-
} else {
|
|
61
|
-
let missedPkgs = requirePkgs.filter((pkg) => installedPkgs.indexOf(pkg) === -1);
|
|
62
|
-
throw new Error(`The following packages were installed: ${installedPkgs.join(', ')}\n The following packages are missing: ${missedPkgs.join(', ')}`);
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"printHelp": (command) => {
|
|
66
|
-
const { commands } = require('./commands.json');
|
|
67
|
-
let cmdDescr = command && commands.filter(cmd => cmd.name === command)[0];
|
|
68
|
-
|
|
69
|
-
if(!command || !cmdDescr) {
|
|
70
|
-
console.log('Available commands:');
|
|
71
|
-
commands.forEach((cmd) => console.log(` ${cmd.name} - ${cmd.description}`));
|
|
72
|
-
console.log('\nRun "devexpress-dashboard-cli [command name] --help" for information on a certain command');
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
console.log(`Usage: ${cmdDescr.usage}`);
|
|
77
|
-
if(cmdDescr.options) {
|
|
78
|
-
console.log('Arguments:');
|
|
79
|
-
cmdDescr.options.forEach((opt) => console.log(` ${opt.name} - ${opt.description}`));
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"processArgs": () => {
|
|
83
|
-
const args = minimist(process.argv.slice(2), {
|
|
84
|
-
alias: {
|
|
85
|
-
v: 'version',
|
|
86
|
-
h: 'help'
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
const commands = args['_'];
|
|
90
|
-
delete args['_'];
|
|
91
|
-
|
|
92
|
-
// Default values of options
|
|
93
|
-
return [commands,
|
|
94
|
-
{
|
|
95
|
-
"outputColorScheme": "custom-scheme",
|
|
96
|
-
"outputDir": ".",
|
|
97
|
-
"createDevExtremeCss": true, //"Generates the dx.<color-scheme>.css file used to color DevExtreme widgets"
|
|
98
|
-
"createAnalyticsCss": true, //"Generates the dx.analytics.<color-scheme>.css file used to color DevExpress Analytics Components (Dashboards and Reporting)"
|
|
99
|
-
"createMinifiedCss": true, //"Generates minified CSS files"
|
|
100
|
-
...camelize(args)
|
|
101
|
-
}];
|
|
102
|
-
}
|
|
1
|
+
const minimist = require('minimist'),
|
|
2
|
+
path = require('path'),
|
|
3
|
+
{ spawn } = require('child_process');
|
|
4
|
+
|
|
5
|
+
const camelCase = str => str.replace(/[-](\w|$)/g, (_, letter) => {
|
|
6
|
+
return letter.toUpperCase();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const camelize = (object) => {
|
|
10
|
+
let result = {};
|
|
11
|
+
for(let key in object) {
|
|
12
|
+
if(object.hasOwnProperty(key)) {
|
|
13
|
+
const newKey = camelCase(key);
|
|
14
|
+
result[newKey] = object[key];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const isModuleResolved = (moduleName) => {
|
|
21
|
+
try {
|
|
22
|
+
require(moduleName);
|
|
23
|
+
} catch(e) {
|
|
24
|
+
return !(e instanceof Error && e.code === 'MODULE_NOT_FOUND');
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const installNpmPkgs = (packages) => {
|
|
30
|
+
let isWinOS = /^win/.test(process.platform);
|
|
31
|
+
|
|
32
|
+
let npmCmd = isWinOS ? 'npm.cmd' : 'npm';
|
|
33
|
+
let args = ['install', '--no-save'].concat(packages);
|
|
34
|
+
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
spawn(npmCmd, args, {cwd: path.join(__dirname, '..'), stdio: 'ignore', windowsVerbatimArguments: true })
|
|
37
|
+
.on('exit', (statusCode) => statusCode ? reject(`Failed to install packages. Status code: ${statusCode}`) : resolve())
|
|
38
|
+
.on('error', (errorMsg) => reject(errorMsg));
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
module.exports = {
|
|
43
|
+
"ensurePeerDependencies": async (depsVersion) => {
|
|
44
|
+
const { peerDependencies } = require('./package.json');
|
|
45
|
+
|
|
46
|
+
let requirePkgs = Object.keys(peerDependencies);
|
|
47
|
+
let installedPkgs = requirePkgs.filter((pkg) => isModuleResolved(`${pkg}/package.json`));
|
|
48
|
+
|
|
49
|
+
if(requirePkgs.length === installedPkgs.length) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if(installedPkgs.length === 0) {
|
|
54
|
+
let pkgsToInstall = requirePkgs.map((pkg) => `${pkg}@${depsVersion || peerDependencies[pkg]}`);
|
|
55
|
+
console.log(`Install peer dependencies: ${pkgsToInstall.join(', ')}.`);
|
|
56
|
+
|
|
57
|
+
await installNpmPkgs(pkgsToInstall);
|
|
58
|
+
console.log('Packages are installed.');
|
|
59
|
+
|
|
60
|
+
} else {
|
|
61
|
+
let missedPkgs = requirePkgs.filter((pkg) => installedPkgs.indexOf(pkg) === -1);
|
|
62
|
+
throw new Error(`The following packages were installed: ${installedPkgs.join(', ')}\n The following packages are missing: ${missedPkgs.join(', ')}`);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"printHelp": (command) => {
|
|
66
|
+
const { commands } = require('./commands.json');
|
|
67
|
+
let cmdDescr = command && commands.filter(cmd => cmd.name === command)[0];
|
|
68
|
+
|
|
69
|
+
if(!command || !cmdDescr) {
|
|
70
|
+
console.log('Available commands:');
|
|
71
|
+
commands.forEach((cmd) => console.log(` ${cmd.name} - ${cmd.description}`));
|
|
72
|
+
console.log('\nRun "devexpress-dashboard-cli [command name] --help" for information on a certain command');
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
console.log(`Usage: ${cmdDescr.usage}`);
|
|
77
|
+
if(cmdDescr.options) {
|
|
78
|
+
console.log('Arguments:');
|
|
79
|
+
cmdDescr.options.forEach((opt) => console.log(` ${opt.name} - ${opt.description}`));
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"processArgs": () => {
|
|
83
|
+
const args = minimist(process.argv.slice(2), {
|
|
84
|
+
alias: {
|
|
85
|
+
v: 'version',
|
|
86
|
+
h: 'help'
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
const commands = args['_'];
|
|
90
|
+
delete args['_'];
|
|
91
|
+
|
|
92
|
+
// Default values of options
|
|
93
|
+
return [commands,
|
|
94
|
+
{
|
|
95
|
+
"outputColorScheme": "custom-scheme",
|
|
96
|
+
"outputDir": ".",
|
|
97
|
+
"createDevExtremeCss": true, //"Generates the dx.<color-scheme>.css file used to color DevExtreme widgets"
|
|
98
|
+
"createAnalyticsCss": true, //"Generates the dx.analytics.<color-scheme>.css file used to color DevExpress Analytics Components (Dashboards and Reporting)"
|
|
99
|
+
"createMinifiedCss": true, //"Generates minified CSS files"
|
|
100
|
+
...camelize(args)
|
|
101
|
+
}];
|
|
102
|
+
}
|
|
103
103
|
};
|