Skip to content

Commit afd053c

Browse files
authored
Add a single script to build and prepare demos locally (#31616)
1 parent 5b7b285 commit afd053c

File tree

3 files changed

+48
-27
lines changed

3 files changed

+48
-27
lines changed

apps/demos/README.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,68 @@
11
# DevExtreme Demos
22

3-
This repository contains technical DevExtreme demos for Angular, React, Vue, jQuery, ASP.NET MVC, and ASP.NET Core.
3+
This repository contains technical DevExtreme demos for Angular, React, Vue, and jQuery.
44

55
To run the demos on your machine, clone this repository, run `pnpm install`, and follow the instructions below.
66

77
## Prepare Demos for Development
8-
Before running you need execute in `monorepo/root`:
98

10-
```
11-
pnpm run all:build-dev
12-
```
9+
### Run demos locally
1310

14-
To prepare demos for development:
11+
In `monorepo/root`
1512

13+
Build all dependencies and prepare systemJS configs by executing:
1614
```
17-
pnpm run prepare-js
15+
pnpm run demos:prepare
1816
```
1917

20-
Angular, Vue, and React demos can use bundles instead of separate files from `node_modules`. With bundles, demos launch faster but become harder to debug. Run the following command to create the bundles and replace the SystemJS configuration:
21-
18+
Start webserver:
2219
```
23-
pnpm run prepare-bundles
20+
pnpm run demos:start
2421
```
22+
Navigate to http://localhost:8080/.
23+
24+
You can pass additional parameter to specify port. It can be useful when you need to fast switching between one demo on different frameworks.
25+
2526

26-
To return to using separate files from `node_modules`, run `pnpm run prepare-js`.
27+
### Bundled mode
2728

29+
Angular, Vue, and React demos can use bundles instead of separate files from `node_modules`. With bundles, demos launch faster but become harder to debug.
2830

29-
### Launch
31+
In `apps/demos`
32+
33+
Run the following command to create the bundles and replace the SystemJS configuration:
3034

31-
#### Option 1
3235
```
33-
pnpm run launch-demo
36+
pnpm run prepare-bundles
3437
```
3538

36-
#### Option 2
37-
1. Run ```pnpm run webserver ``` from `monorepo/root`
38-
2. Navigate to http://localhost:8080/apps/demos.
39+
To return to using separate files from `node_modules`, run:
3940

40-
You can pass additional parameter to specify port. It can be useful when you need to fast switching between one demo on different frameworks:
41+
```
42+
pnpm run prepare-js
43+
```
4144

42-
### Before Commiting Сhanges
45+
### Before Commiting Changes
4346

44-
For fix autofixed errors:
47+
Auto-fix lint errors:
4548

4649
```
4750
pnpm run fix-lint
4851
```
4952

50-
### Development
53+
### Adding new demo
5154

5255
1. Run the following script to add a new demo:
5356

5457
```
5558
pnpm run add-demo
5659
```
5760
58-
1. Use the built-in CLI to choose or enter the category, the demo name, and the technology for the new demo.
61+
2. Use the built-in CLI to choose or enter the category, the demo name, and the technology for the new demo.
5962
6063
### TS React Infrastructure
6164
62-
1. After you make any changes in React TypeScript sources, run the following command:
65+
After you make any changes in React TypeScript sources, run the following command:
6366
6467
```
6568
pnpm run convert-to-js split
@@ -71,9 +74,7 @@ If you want to run this script on specific folder you can pass it to the argumen
7174
pnpm run convert-to-js "JSDemos/Demos/Diagram/**/React"
7275
```
7376
74-
1. To ensure that React JavaScript and TypeScript sources are always in sync, the following GitHub action is used: "Check generated JS demos".
75-
76-
77+
The "Check generated JS demos" GitHub Action ensures that the React JavaScript and TypeScript sources remain in sync.
7778
## See Also
7879
7980
- [Technical demos online](https://js.devexpress.com/Demos/)

apps/demos/project.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@
102102
"{projectRoot}/**/*"
103103
],
104104
"cache": true
105+
},
106+
"prepare-js": {
107+
"executor": "nx:run-script",
108+
"options": {
109+
"script": "prepare-js"
110+
},
111+
"dependsOn": [
112+
{ "projects": ["devextreme"], "target": "build" },
113+
{ "projects": ["devextreme-angular", "devextreme-react", "devextreme-vue"], "target": "pack" }
114+
],
115+
"inputs": [
116+
"default",
117+
"{projectRoot}/gulpfile.js/**/*",
118+
"{projectRoot}/rollup.devextreme-angular.umd.config.mjs"
119+
],
120+
"outputs": [
121+
"{projectRoot}/Demos/**/config.js"
122+
],
123+
"cache": true
105124
}
106125
},
107126
"namedInputs": {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"all:build": "ts-node tools/scripts/build-all.ts",
2222
"all:build-dev": "pnpm run all:build --dev",
2323
"all:pack-and-copy": "nx run-many -t pack-and-copy",
24-
"webserver": "http-server --port 8080 -c-1"
24+
"demos:prepare": "nx run devextreme-demos:prepare-js",
25+
"demos:start": "http-server ./apps/demos --port 8080 -c-1"
2526
},
2627
"nx": {},
2728
"private": true,

0 commit comments

Comments
 (0)