Skip to content

Commit 3218842

Browse files
authored
Migrate from webpack/gulp to Astro (#1195)
1 parent 6d7cac5 commit 3218842

116 files changed

Lines changed: 8003 additions & 44551 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
2+
#
3+
# Prerequisites – igniteui-actions repo:
4+
# - A workflow that handles event_type 'wc-samples-cd' (add one, or confirm the correct event name).
5+
6+
name: Build and Deploy - WC Samples EN
7+
permissions:
8+
contents: read
9+
10+
on:
11+
push:
12+
branches:
13+
- vnext
14+
- master
15+
workflow_dispatch:
16+
inputs:
17+
branch:
18+
description: 'Branch to build and deploy (e.g. vnext)'
19+
required: true
20+
21+
env:
22+
BRANCH_REF: ${{ github.event.inputs.branch && format('refs/heads/{0}', github.event.inputs.branch) || github.ref }}
23+
24+
jobs:
25+
build-and-deploy:
26+
name: Build and Deploy - WC Samples EN
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
ref: ${{ env.BRANCH_REF }}
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: '22.x'
40+
41+
- name: Create .npmrc file
42+
run: |
43+
if [ -f ".npmrc" ]; then
44+
rm .npmrc
45+
fi
46+
touch .npmrc
47+
48+
- name: Configure licensed @infragistics registry
49+
run: |
50+
echo "@infragistics:registry=https://packages.infragistics.com/npm/js-licensed/" >> .npmrc
51+
echo "//packages.infragistics.com/npm/js-licensed/:username=${{ secrets.INFRAGISTICS_NPM_USER }}" >> .npmrc
52+
echo "//packages.infragistics.com/npm/js-licensed/:_auth=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc
53+
54+
- name: npm install --legacy-peer-deps
55+
run: npm install --legacy-peer-deps
56+
57+
# "Uninstall all IG trial packages & re-install their licensed versions"
58+
- name: Replace trial IG packages with licensed versions
59+
shell: pwsh
60+
run: |
61+
Get-Content -Path ./.npmrc
62+
$packageJson = Get-Content -Raw ./package.json | ConvertFrom-Json
63+
$npmUninstallPackages = "npm uninstall --save "
64+
$npmInstallPackages = "npm install --legacy-peer-deps "
65+
$packageJson.dependencies.PSObject.Properties | `
66+
Where-Object {
67+
$_.Name.StartsWith("igniteui-webcomponents-") -or $_.Name.StartsWith("igniteui-dockmanager")
68+
} | `
69+
ForEach-Object {
70+
$npmUninstallPackages += $_.Name + " "
71+
$npmInstallPackages += "@infragistics/" + $_.Name + "@" + $_.Value + " "
72+
}
73+
Write-Host $npmUninstallPackages
74+
Write-Host $npmInstallPackages
75+
Invoke-Expression -Command "$npmUninstallPackages"
76+
Invoke-Expression -Command "$npmInstallPackages"
77+
78+
- name: npm run build
79+
run: npm run build
80+
env:
81+
BASE_PATH: /webcomponents-demos
82+
83+
# Package the contents of dist folder as a zip artifact
84+
- name: Create zip artifact
85+
run: |
86+
cd dist
87+
zip -r ${{ github.workspace }}/WebComponentsSamples.zip ./
88+
89+
- name: Upload artifact
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: WebComponentsSamplesBrowser
93+
path: WebComponentsSamples.zip
94+
retention-days: 1
95+
96+
- name: Get app token
97+
id: app-token
98+
uses: actions/create-github-app-token@v2
99+
with:
100+
app-id: ${{ secrets.IGNITEUI_GITHUB_APP_ID }}
101+
private-key: ${{ secrets.IGNITEUI_GITHUB_APP_PRIVATE_KEY }}
102+
owner: IgniteUI
103+
repositories: igniteui-actions
104+
105+
- name: Trigger Deploy Workflow in IgniteUI Actions
106+
uses: actions/github-script@v8
107+
with:
108+
github-token: ${{ steps.app-token.outputs.token }}
109+
script: |
110+
await github.rest.repos.createDispatchEvent({
111+
owner: 'IgniteUI',
112+
repo: 'igniteui-actions',
113+
event_type: 'wc-samples-cd',
114+
client_payload: {
115+
calling_branch: "${{ env.BRANCH_REF }}",
116+
repository: "${{ github.repository }}",
117+
run_id: "${{ github.run_id }}",
118+
artifact_name: "WebComponentsSamplesBrowser",
119+
ref: "${{ github.ref }}",
120+
sha: "${{ github.sha }}",
121+
branch: "${{ github.ref_name }}",
122+
}
123+
});

.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)