Skip to content

Commit 70c9d06

Browse files
committed
Migrate from webpack/gulp to Astro
1 parent 36e3b60 commit 70c9d06

File tree

112 files changed

+7792
-44531
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+7792
-44531
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 7 deletions
This file was deleted.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
/tmp/
1313
/tests/
1414

15+
# Astro / Vite build output:
16+
/.astro
17+
/dist
18+
/public/assets/code-viewer
19+
1520
# browser auto-generated files:
1621
/browser/node_modules
1722
/browser/src/samples

README.md

Lines changed: 71 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[![Node.js CI](https://github.com/IgniteUI/igniteui-wc-examples/actions/workflows/node.js.yml/badge.svg)](https://github.com/IgniteUI/igniteui-wc-examples/actions/workflows/node.js.yml)
99

10-
This repository contains over 300 examples on how to use [Ignite UI for Web ](https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/general-getting-started.html) components:
10+
This repository contains over 300 examples on how to use [Ignite UI for Web Components](https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/general-getting-started.html):
1111

1212
- Charts:
1313
[Area](https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/charts/types/area-chart),
@@ -44,165 +44,115 @@ This repository contains over 300 examples on how to use [Ignite UI for Web ](ht
4444

4545
## Branches
4646

47-
> **_NOTE:_** You should use [master](https://github.com/IgniteUI/igniteui-wc-examples/tree/master) branch of this repository if you want to run samples on your computer. Use the [vnext](https://github.com/IgniteUI/igniteui-wc-examples/tree/vnext) branch only when you want to contribute new samples to this repository.
47+
> **_NOTE:_** Use the [master](https://github.com/IgniteUI/igniteui-wc-examples/tree/master) branch to run samples locally. Use the [vnext](https://github.com/IgniteUI/igniteui-wc-examples/tree/vnext) branch only when contributing new samples.
4848
4949
## Preview
5050

51-
You can preview and browse all samples in this repository by opening our [Web Components Browser](https://www.infragistics.com/webcomponents-demos/samples/index). Alternatively, you you can view these samples with detailed information in our [Web Component Documentation](https://infragistics.com/webcomponentssite/components/general-getting-started.html).
51+
You can preview and browse all samples by opening our [Web Components Browser](https://www.infragistics.com/webcomponents-demos/samples/index). Alternatively, view samples with detailed documentation in the [Web Components Documentation](https://infragistics.com/webcomponentssite/components/general-getting-started.html).
5252

53-
In addition, you can run each sample project individually from the [./samples](./samples) folder or you can run from the [./browser](./browser) folder to browse all samples in one website (see instructions below). You can run each sample on Code Sandbox website by clicking on the **Edit Sandbox** button in a readme file of sample project, e.g.
53+
In addition, you can run each sample project individually from the [./samples](./samples) folder or you can run project containing all samples `npm run dev` to browse all samples in one website (see instructions below). You can run each sample on Code Sandbox website by clicking on the **Edit Sandbox** button in a readme file of sample project, e.g.
5454

5555
[./samples/charts/category-chart/overview/README.md](./samples/charts/category-chart/overview/README.md)
5656

5757

5858
## Setup
5959

60-
To set up this project locally, clone this repository:
61-
```
60+
Clone the repository and install dependencies:
61+
62+
```bash
6263
git clone https://github.com/IgniteUI/igniteui-wc-examples.git
64+
cd igniteui-wc-examples
6365
git checkout master
66+
npm install
6467
```
6568

66-
## Running Individual Sample
67-
68-
Follow these instructions to run a single sample on your computer:
69-
70-
- in VS Code, open a folder with existing sample, e.g.
71-
72-
[./samples/charts/category-chart/overview](./samples/charts/category-chart/overview)
73-
74-
- type `npm install --legacy-peer-deps` command in terminal window
75-
76-
- type `npm run start` command in terminal window
77-
78-
- Wait until the build is completed and then open [http://localhost:4200](http://localhost:4200) in your browser.
79-
80-
At this point, you should see a website hosted example of [Ignite UI for Web Components](https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/general-getting-started.html)
81-
69+
## Running All Samples (Dev Server)
8270

83-
## Running All Samples
71+
Start the Astro development server:
8472

85-
Follow these instructions to run all samples locally in a browser application.
86-
87-
- open VS Code
88-
89-
- select **View** - **Terminal** menu item
73+
```bash
74+
npm run dev
75+
```
9076

91-
- type `npm install --legacy-peer-deps` command in terminal window
77+
Open [http://localhost:4200](http://localhost:4200) in your browser. You will see a navigation sidebar listing all samples. The dev server compiles samples on demand — no full build required.
9278

93-
This will install required packages and [Ignite UI for Web Components](https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/general-getting-started.html) packages from npm website:
79+
## Building for Production
9480

95-
- [igniteui-webcomponents-core](https://www.npmjs.com/package/igniteui-webcomponents-core)
96-
- [igniteui-webcomponents-core](https://www.npmjs.com/package/igniteui-webcomponents-dashboards)
97-
- [igniteui-webcomponents-charts](https://www.npmjs.com/package/igniteui-webcomponents-charts)
98-
- [igniteui-webcomponents-excel](https://www.npmjs.com/package/igniteui-webcomponents-excel)
99-
- [igniteui-webcomponents-gauges](https://www.npmjs.com/package/igniteui-webcomponents-gauges)
100-
- [igniteui-webcomponents-grids](https://www.npmjs.com/package/igniteui-webcomponents-grids)
101-
- [igniteui-webcomponents-maps](https://www.npmjs.com/package/igniteui-webcomponents-maps)
102-
- [igniteui-webcomponents-spreadsheet](https://www.npmjs.com/package/igniteui-webcomponents-spreadsheet)
103-
- [igniteui-webcomponents-datasources](https://www.npmjs.com/package/igniteui-webcomponents-datasources)
81+
```bash
82+
npm run build
83+
```
10484

105-
Next, follow these steps:
85+
This runs two steps automatically:
86+
1. **`prebuild`** — generates `public/assets/code-viewer/**/*.json` files used by the docs site to display sample source code tabs
87+
2. **`astro build`** — compiles all ~900+ samples into static HTML + JS in `dist/`
10688

107-
- type `npm run start` command in terminal window to start the browser application locally
89+
To preview the production build locally:
10890

109-
- Wait until the build is completed and then open [http://localhost:4200](http://localhost:4200) in your browser. You should see a website with navigation menu for browning all samples in this repository.
91+
```bash
92+
npm run preview
93+
```
11094

111-
![Samples Browser Preview](./browser/public/images/preview.PNG)
95+
Opens [http://localhost:4200](http://localhost:4200) serving the `dist/` output exactly as it would be deployed.
11296

113-
## Adding New Sample
97+
## Adding a New Sample
11498

115-
- create a new branch from the `vnext` branch
99+
1. Create a new branch from `vnext`
116100

117-
- open a folder with existing sample, e.g.
101+
2. Copy an existing sample folder as a starting point, e.g.:
118102
```
119-
./samples/charts/category-chart/axis-options/
103+
./samples/charts/category-chart/axis-options/ → ./samples/charts/category-chart/axis-types/
120104
```
121-
- copy the sample and rename the new folder, e.g.
122-
```
123-
./samples/charts/category-chart/axis-types/
124-
```
125-
- open the newly created folder in VS Code
126105

127-
- rename the .ts file in src folder, using this naming convention:
106+
3. The folder structure must be exactly **`samples/{group}/{component}/{name}/`** with:
107+
- `index.html` — sample markup (only the content inside `<body>`, wrapped in `<div id="root">`)
108+
- `src/index.ts` — sample TypeScript entry point, exporting a class (e.g. `export class Sample { ... }`)
109+
- `package.json` — with `"main": "src/index.ts"` (used by Astro to discover the sample)
128110

129-
`ControlNameSampleName.ts`
111+
4. Implement your sample in `src/index.ts`. Export the class but **do not** instantiate it at the module level — the browser app calls `new Sample()` automatically when the page loads.
130112

113+
5. Start the dev server and verify:
114+
```bash
115+
npm run dev
131116
```
132-
./samples/charts/category-chart/axis-types/src/CategoryChartAxisTypes.ts
133-
```
134-
135-
- open the .ts file
136-
137-
- rename class to the name of .tsx file
117+
- The new sample appears in the navigation sidebar
118+
- It loads without errors in the browser console
138119

139-
- type `npm install --legacy-peer-deps` command in terminal window
140-
141-
- type `npm run start` command in terminal window
142-
143-
- implement the new sample in the .tsx file
144-
145-
- close the new sample project in VS Code
146-
147-
- delete `node_modules` folder in the new sample project
148-
149-
- follow instructions in the next section
150-
151-
## Verify New Sample
152-
153-
- type `npm run start` command in terminal window
154-
155-
- open [http://localhost:4200](http://localhost:4200) in your browser
156-
157-
- verify that the new sample is listed in the navigation menu
158-
159-
- verify that the new sample loads by clicking navigation link
160-
161-
- verify that there are no errors in DEV console
162-
163-
- take a screenshot of the new sample with navigation menu
164-
165-
- commit your changes
166-
167-
- create a pull request and target the `vnext` branch
120+
6. Regenerate the code-viewer JSON files:
121+
```bash
122+
npm run generate:code-viewer
123+
```
168124

169-
- paste the screenshot in you pull request
125+
7. Commit, push, and open a pull request targeting `vnext`. Include a screenshot of the running sample.
170126

171-
- submit your pull request
127+
## Updating Ignite UI Package Versions
172128

129+
Do **not** manually edit version strings in `package.json` files.
173130

174-
## Updating Packages in Samples
131+
- Open [./scripts/update-ig.js](./scripts/update-ig.js)
132+
- Update the version in the `packageUpgrades` array
133+
- Run from the repo root:
134+
```bash
135+
npm run update:ig
136+
npm install
137+
```
138+
- Create and merge a pull request with the updated `package.json` files
175139

176-
NOTE Do NOT find replace version of packages in package.json files.
140+
## Scripts Reference
177141

178-
- open this repo in VS Code
179-
- open [./browser/tasks/gulp-samples.js](./browser/tasks/gulp-samples.js) file
180-
- navigate to the `updateIG` function
181-
- update version of packages in `packageUpgrades` array
182-
- open terminal window
183-
- run `cd browser` command
184-
- run the `gulp updateIG` command
185-
- run `npm install --legacy-peer-deps` command
186-
- create AND merge a pull request with changes in all package.json files in this repository
187-
- create 2nd pull request with similar changes in `/editor-templates/WebComponents/main-template/package.json` of the [igniteui-xplat-examples](https://github.com/IgniteUI/igniteui-xplat-examples) repository.
142+
| Script | Description |
143+
|--------|-------------|
144+
| `npm run dev` | Start Astro dev server on port 4200 |
145+
| `npm run build` | Generate code-viewer JSONs then build static site to `dist/` |
146+
| `npm run preview` | Serve the `dist/` production build on port 4200 |
147+
| `npm run generate:code-viewer` | Regenerate `public/assets/code-viewer/**/*.json` |
148+
| `npm run update:ig` | Update Ignite UI package versions across all sample `package.json` files |
149+
| `npm run check` | Run Astro TypeScript type-checking |
188150

189151
## Learn More
190152

191-
To learn more about **Ignite UI for Web Components** components, check out the [Web Components documentation](https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/general-getting-started.html).
192-
193-
194-
# Updating Version of IgniteUI Packages
195-
196-
Perform these steps to update version of **Ignite UI for WebComponent** packages in all samples. NOTE that the order of these steps is very important.
197-
198-
- open this repo in VS Code
199-
- open [gulp-samples.js](./browser/tasks/gulp-samples.js) file
200-
- navigate to the `updateIG` function
201-
- change version of **Ignite UI for WebComponent** packages in the `packageUpgrades` array
202-
- open terminal window
203-
- run `gulp updateIG` command
204-
- run `npm install --legacy-peer-deps` command
205-
- create pull request with your changes
206-
- open the [Igniteui-xplat-example](https://github.com/IgniteUI/igniteui-xplat-examples) repo in VS Code
207-
- update version of **Ignite UI for WebComponent** packages in [WC template](https://github.com/IgniteUI/igniteui-xplat-examples/blob/23.2.x/editor-templates/WebComponents/main-template/package.json)
208-
- create pull request with your changes in [Igniteui-xplat-example](https://github.com/IgniteUI/igniteui-xplat-examples) repo
153+
To learn more about **Ignite UI for Web Components**, check out the [Web Components documentation](https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/general-getting-started.html).
154+
- run `npm install --legacy-peer-deps`
155+
- create a pull request with your changes
156+
- open the [igniteui-xplat-examples](https://github.com/IgniteUI/igniteui-xplat-examples) repo in VS Code
157+
- update the version of **Ignite UI for WebComponent** packages in the [WC template](https://github.com/IgniteUI/igniteui-xplat-examples/blob/23.2.x/editor-templates/WebComponents/main-template/package.json)
158+
- create a pull request with your changes in the [igniteui-xplat-examples](https://github.com/IgniteUI/igniteui-xplat-examples) repo

0 commit comments

Comments
 (0)