-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathigniteui-wc-grid-examples.yml
More file actions
201 lines (172 loc) · 7.17 KB
/
igniteui-wc-grid-examples.yml
File metadata and controls
201 lines (172 loc) · 7.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
trigger:
branches:
include:
- vnext
- master
# This pipeline is meant to build specific branches for deployment. It's not meant to be a part of PR validation.
pr: none
parameters:
- name: isVerbose
displayName: 'Get verbose output from steps - where configurable'
type: boolean
default: false
- name: shouldCleanPostExecution
displayName: 'Clean all pipeline dirs after the pipeline finishes?'
type: boolean
default: true
name: $(Year:yyyy).$(Month).$(DayOfMonth)-r$(Rev:.r)
stages:
- stage: Build
pool:
vmImage: ubuntu-latest
demands: npm
jobs:
- job: BuildSamples
steps:
- checkout: 'self'
clean: true
- task: NodeTool@0
displayName: 'Install Node'
inputs:
versionSource: 'spec'
versionSpec: '20.x'
- task: Bash@3
displayName: 'Create download artifact per sample (Shell)'
inputs:
targetType: 'inline'
script: |
create_zips() {
local rootPath="$1"
if [ -d "$rootPath" ]; then
# Get all first-level subdirectories in the specified root path
subdirectories=$(find "$rootPath" -mindepth 1 -maxdepth 1 -type d)
for subdirectory in $subdirectories; do
# Extract the directory name from the path
dirName=$(basename "$subdirectory")
# Give each sample a version in its package.json file - for traceability
cd "$subdirectory"
echo "Setting project version in package.json to $(Build.BuildNumber) for $dirName"
npm version $(Build.BuildNumber) --no-git-tag-version
# Check if the directory name is already camel-case
if [[ "$dirName" =~ ^[A-Z]+[a-z]+([A-Z][a-z]*)*$ ]]; then
# If already camel-case, print it as is
echo "$dirName"
else
# Convert to camel-case (capitalize first letters and remove hyphens)
dirName=$(echo "$dirName" | sed -E 's/(^|-)([a-z])/\U\2/g')
fi
echo "Processing directory: $dirName"
# Define the name for the zip file
zipName="$(Build.ArtifactStagingDirectory)/IgniteUI_WebComponents_ApplicationSample_${dirName}_Source.zip"
echo "Creating ZIP: $zipName"
# Compress the directory into a ZIP file
(cd "$subdirectory" && zip -r "$zipName" .)
done
fi
}
# Pass 1: All first-level directories in projects/
create_zips "$(Build.SourcesDirectory)/projects"
# Pass 2: All first-level directories in projects/charts/
create_zips "$(Build.SourcesDirectory)/projects/charts"
echo "All sample projects have been compressed and saved to the artifacts directory."
- task: PublishPipelineArtifact@1
displayName: 'Publish Samples Sources zips'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'samplesSourcesZips'
publishLocation: 'pipeline'
- task: Npm@1
displayName: 'Register licensed npm registry in .npmrc'
inputs:
verbose: ${{ parameters.isVerbose }}
command: 'custom'
workingDir: '$(Build.SourcesDirectory)'
customCommand: 'config -L project set @infragistics:registry=https://packages.infragistics.com/npm/js-licensed/'
customEndpoint: 'public proget'
- task: npmAuthenticate@0
displayName: '[IG Production ProGet] npm authenticate'
inputs:
workingFile: '$(Build.SourcesDirectory)/.npmrc'
customEndpoint: 'public proget'
- task: Npm@1
displayName: 'npm install --legacy-peer-deps'
inputs:
verbose: ${{ parameters.isVerbose }}
command: custom
workingDir: '$(Build.SourcesDirectory)'
customCommand: 'install --legacy-peer-deps'
customEndpoint: 'public proget'
- task: Npm@1
displayName: 'Install Ignite UI CLI globally'
inputs:
verbose: ${{ parameters.isVerbose }}
command: custom
workingDir: '$(Build.SourcesDirectory)'
customCommand: 'install -g igniteui-cli'
- task: PowerShell@2
displayName: 'Update vite.config to licensed'
inputs:
failOnStderr: true
showWarnings: true
workingDirectory: '$(Build.SourcesDirectory)'
targetType: 'inline'
script: |
#Update vite.config.ts
$viteConfig = Get-Content -Raw ./vite.config.ts
$updatedViteConfig = $viteConfig -replace 'igniteui-webcomponents-', '@infragistics/igniteui-webcomponents-'
$updatedViteConfig | Set-Content ./vite.config.ts
- task: Bash@3
displayName: 'Run Ignite UI Upgrade in Root and All Project Subdirectories'
inputs:
targetType: 'inline'
script: |
echo "Running Ignite UI package upgrade at root level..."
npx ig upgrade-packages --skip-install
echo "Running Ignite UI package upgrade in all project subdirectories..."
for dir in $(Build.SourcesDirectory)/projects/*/; do
if [ -d "$dir" ]; then
echo "Processing: $dir"
(cd "$dir" && npx ig upgrade-packages --skip-install)
fi
done
- task: Npm@1
displayName: 'npm install --legacy-peer-deps'
inputs:
verbose: ${{ parameters.isVerbose }}
command: custom
workingDir: '$(Build.SourcesDirectory)'
customCommand: 'install --legacy-peer-deps'
- task: PowerShell@2
displayName: 'Replace references to IG trial packages with licensed ones in TSX files'
inputs:
failOnStderr: true
showWarnings: true
workingDirectory: '$(Build.SourcesDirectory)'
targetType: 'inline'
script: |
Get-ChildItem -Include "*.tsx","*.ts" -Recurse | ForEach {
Write-Host "Processing file: $($_.FullName)"
$content = Get-Content $_.FullName
$updatedContent = $content | ForEach-Object {
$_ -replace '(from|import)\s?[''"](igniteui-webcomponents-[^''"]+|dockmanager.*)[''"]', '$1 "@infragistics/$2"'
}
if ($updatedContent -ne $content) {
Write-Host "Replacements applied in: $($_.FullName)"
$updatedContent | Set-Content $_.FullName
}
}
- task: Npm@1
displayName: 'npm run build:ci'
inputs:
verbose: ${{ parameters.isVerbose }}
command: custom
workingDir: '$(Build.SourcesDirectory)'
customCommand: 'run build:ci'
- task: PublishPipelineArtifact@1
displayName: 'Publish app'
inputs:
targetPath: '$(Build.SourcesDirectory)/dist'
artifact: 'dist.grid-demos-wc'
publishLocation: 'pipeline'
- ${{ if eq(parameters.shouldCleanPostExecution, true) }}:
- task: PostBuildCleanup@4