@yahoo/uds-icons 2.8.1 โ 2.8.2
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/package.json +3 -2
- package/README.md +0 -230
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yahoo/uds-icons",
|
|
3
3
|
"description": "Yahoo Universal System Icons",
|
|
4
|
-
"version": "2.8.
|
|
4
|
+
"version": "2.8.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist/**",
|
|
@@ -97,5 +97,6 @@
|
|
|
97
97
|
"production": "PVSsdT9z4uw7gg0JKMO8Ue",
|
|
98
98
|
"staging": "0xfg2MvbEgByxuctMTEhyY"
|
|
99
99
|
}
|
|
100
|
-
}
|
|
100
|
+
},
|
|
101
|
+
"license": "MIT"
|
|
101
102
|
}
|
package/README.md
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
# UDS Icons Package
|
|
2
|
-
|
|
3
|
-
This package contains the icon generation pipeline for the Universal Design System (UDS). It automatically fetches icons from Figma, processes them, and generates optimized SVG files with proper TypeScript types.
|
|
4
|
-
|
|
5
|
-
> **๐ User Documentation**: For information about using icons in your applications, see the [Icon system design documentation](https://www.uds.build/docs/architecture/icons).
|
|
6
|
-
|
|
7
|
-
## Release Process
|
|
8
|
-
|
|
9
|
-
The icon release process is fully automated through GitHub Actions and consists of several key components working together to ensure reliable, consistent icon updates.
|
|
10
|
-
|
|
11
|
-
### Overview
|
|
12
|
-
|
|
13
|
-
The release process follows this workflow:
|
|
14
|
-
|
|
15
|
-
1. **Manual Trigger** โ GitHub Action workflow is manually triggered
|
|
16
|
-
2. **Icon Generation** โ SVGs are fetched from Figma and processed
|
|
17
|
-
3. **Change Detection** โ Git diff analysis identifies new, modified, or deleted icons
|
|
18
|
-
4. **Code Connect Upload** โ Icons are uploaded to Figma Code Connect (if changes detected)
|
|
19
|
-
5. **Pull Request Creation** โ Automated PR is created with detailed change summary
|
|
20
|
-
|
|
21
|
-
### Detailed Process Steps
|
|
22
|
-
|
|
23
|
-
#### 1. Workflow Trigger
|
|
24
|
-
|
|
25
|
-
The process begins when the `Generate Icon Release` workflow is manually triggered via GitHub Actions. This workflow:
|
|
26
|
-
|
|
27
|
-
- Runs on Ubuntu with Node.js 18+
|
|
28
|
-
- Uses Bun for package management and script execution
|
|
29
|
-
- Requires several environment variables:
|
|
30
|
-
- `FIGMA_ACCESS_TOKEN`: For accessing Figma API
|
|
31
|
-
- `TURBO_TOKEN` & `TURBO_TEAM`: For Turborepo caching
|
|
32
|
-
- `GITHUB_TOKEN`: For creating PRs and accessing repo
|
|
33
|
-
- `MAX_OLD_SPACE_SIZE`: For Node.js memory allocation
|
|
34
|
-
|
|
35
|
-
#### 2. Icon Generation (`generateSVGs.ts`)
|
|
36
|
-
|
|
37
|
-
The core icon generation process fetches and processes icons from Figma:
|
|
38
|
-
|
|
39
|
-
**Environment Detection:**
|
|
40
|
-
|
|
41
|
-
- Automatically detects production vs staging environment based on `NODE_ENV`
|
|
42
|
-
- Uses different Figma file IDs for production (`_figma.fileKey.production`) vs staging (`_figma.fileKey.staging`)
|
|
43
|
-
- Supports manual override via `--figmaId` argument
|
|
44
|
-
|
|
45
|
-
**Figma File Processing:**
|
|
46
|
-
|
|
47
|
-
- Fetches the main Figma file with plugin data and branch support
|
|
48
|
-
- Retrieves local variables and all referenced library variables
|
|
49
|
-
- Processes color variables to build CSS variable mappings for light/dark themes
|
|
50
|
-
- Handles both main files and branch files with appropriate URL generation
|
|
51
|
-
|
|
52
|
-
**Icon Extraction:**
|
|
53
|
-
|
|
54
|
-
- Processes two main Figma pages: "Icons" and "Multicolor Icons"
|
|
55
|
-
- Extracts component sets and their variants
|
|
56
|
-
- Maps multicolor variants to base icons using predefined mappings
|
|
57
|
-
- Validates icon structure and generates detailed issue reports
|
|
58
|
-
|
|
59
|
-
**SVG Processing:**
|
|
60
|
-
|
|
61
|
-
- Exports icons in chunks of 500 (Figma API limit)
|
|
62
|
-
- Applies color processing to replace Figma colors with CSS variables
|
|
63
|
-
- Generates optimized SVGs with simplified strokes and absolute bounds
|
|
64
|
-
- Saves processed files to the assets directory
|
|
65
|
-
|
|
66
|
-
#### 3. Change Detection (`generateDiff.ts`)
|
|
67
|
-
|
|
68
|
-
After icon generation, the system analyzes what has changed:
|
|
69
|
-
|
|
70
|
-
**Git Analysis:**
|
|
71
|
-
|
|
72
|
-
- Compares generated icons against the previous commit
|
|
73
|
-
- Categorizes changes into three types:
|
|
74
|
-
- **New**: Previously untracked icon files
|
|
75
|
-
- **Modified**: Existing icons with changes
|
|
76
|
-
- **Deleted**: Icons that were removed
|
|
77
|
-
|
|
78
|
-
**Output Generation:**
|
|
79
|
-
|
|
80
|
-
- Creates detailed markdown diff report (`tmp/diff.md`)
|
|
81
|
-
- Generates appropriate PR title with date and change type
|
|
82
|
-
- Creates commit message with conventional commit format
|
|
83
|
-
- Handles breaking changes (deletions) with proper semantic versioning
|
|
84
|
-
|
|
85
|
-
**Change Classification:**
|
|
86
|
-
|
|
87
|
-
- `feat`: New icons added or breaking changes (deletions)
|
|
88
|
-
- `fix`: Existing icons modified
|
|
89
|
-
- `chore`: Minor updates or no significant changes
|
|
90
|
-
|
|
91
|
-
#### 4. Conditional Processing
|
|
92
|
-
|
|
93
|
-
The workflow includes intelligent conditional logic:
|
|
94
|
-
|
|
95
|
-
**No Changes Detected:**
|
|
96
|
-
|
|
97
|
-
- If no new, modified, or deleted icons are found
|
|
98
|
-
- Workflow completes successfully with "No new icons or changes detected" message
|
|
99
|
-
- No PR is created, no Figma Code Connect upload occurs
|
|
100
|
-
|
|
101
|
-
**Changes Detected:**
|
|
102
|
-
|
|
103
|
-
- Proceeds with Figma Code Connect upload
|
|
104
|
-
- Creates detailed PR with change summary
|
|
105
|
-
- Generates artifacts for debugging (icon-code-connect.json)
|
|
106
|
-
|
|
107
|
-
#### 5. Figma Code Connect Integration
|
|
108
|
-
|
|
109
|
-
When changes are detected, icons are automatically uploaded to Figma Code Connect:
|
|
110
|
-
|
|
111
|
-
- Uploads processed icon data to Figma's Code Connect service
|
|
112
|
-
- Enables seamless integration between design and development
|
|
113
|
-
- Creates debugging artifacts for API request inspection
|
|
114
|
-
|
|
115
|
-
#### 6. Pull Request Creation
|
|
116
|
-
|
|
117
|
-
The final step creates a comprehensive pull request:
|
|
118
|
-
|
|
119
|
-
**Automated Git Operations:**
|
|
120
|
-
|
|
121
|
-
- Creates new branch with timestamp: `feat/icons-update-{timestamp}`
|
|
122
|
-
- Commits all changes with generated commit message
|
|
123
|
-
- Pushes branch to remote repository
|
|
124
|
-
|
|
125
|
-
**PR Details:**
|
|
126
|
-
|
|
127
|
-
- **Title**: Follows conventional commit format with date
|
|
128
|
-
- Example: `feat(Icons): add new icons ยท 2024-01-15`
|
|
129
|
-
- **Body**: Includes detailed change summary with categorized lists
|
|
130
|
-
- **Labels**: Automatically applied based on change types
|
|
131
|
-
- **Reviewers**: Can be configured for required reviews
|
|
132
|
-
|
|
133
|
-
### Configuration
|
|
134
|
-
|
|
135
|
-
#### Environment Variables
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
# Required for Figma API access
|
|
139
|
-
FIGMA_ACCESS_TOKEN=your_figma_token_here
|
|
140
|
-
|
|
141
|
-
# For Turborepo optimization
|
|
142
|
-
TURBO_TOKEN=your_turbo_token
|
|
143
|
-
TURBO_TEAM=your_team_name
|
|
144
|
-
|
|
145
|
-
# For GitHub operations
|
|
146
|
-
GITHUB_TOKEN=your_github_token
|
|
147
|
-
|
|
148
|
-
# For Node.js memory allocation
|
|
149
|
-
MAX_OLD_SPACE_SIZE=8192
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
#### Figma File Configuration
|
|
153
|
-
|
|
154
|
-
The system supports multiple Figma files:
|
|
155
|
-
|
|
156
|
-
```json
|
|
157
|
-
{
|
|
158
|
-
"_figma": {
|
|
159
|
-
"fileKey": {
|
|
160
|
-
"production": "your_production_file_id",
|
|
161
|
-
"staging": "your_staging_file_id"
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
#### Script Arguments
|
|
168
|
-
|
|
169
|
-
The generation script supports several command-line arguments:
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
# Required arguments
|
|
173
|
-
--assetsDir ./generated/icons # Output directory for SVG files
|
|
174
|
-
--outputDir ./src # Output directory for TypeScript files
|
|
175
|
-
|
|
176
|
-
# Optional arguments
|
|
177
|
-
--figmaId custom_file_id # Override default Figma file ID
|
|
178
|
-
--dryRun # Run without generating files
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Error Handling
|
|
182
|
-
|
|
183
|
-
The release process includes comprehensive error handling:
|
|
184
|
-
|
|
185
|
-
- **Figma API Errors**: Graceful handling of API failures with detailed error messages
|
|
186
|
-
- **File System Errors**: Proper cleanup and directory management
|
|
187
|
-
- **Git Operations**: Safe git commands with error checking
|
|
188
|
-
- **Memory Management**: Configurable Node.js memory limits for large icon sets
|
|
189
|
-
|
|
190
|
-
### Monitoring and Debugging
|
|
191
|
-
|
|
192
|
-
**Workflow Artifacts:**
|
|
193
|
-
|
|
194
|
-
- `icon-code-connect.json`: Debugging artifact for Figma Code Connect API requests
|
|
195
|
-
- `tmp/issues.md`: Detailed validation issues and warnings
|
|
196
|
-
- `tmp/diff.md`: Complete change summary for review
|
|
197
|
-
|
|
198
|
-
**Logging:**
|
|
199
|
-
|
|
200
|
-
- Progress bars for long-running operations
|
|
201
|
-
- Spinner indicators for async operations
|
|
202
|
-
- Detailed console output for troubleshooting
|
|
203
|
-
- Environment variable debugging information
|
|
204
|
-
|
|
205
|
-
### Best Practices
|
|
206
|
-
|
|
207
|
-
1. **Always test in staging first**: Use staging Figma file for testing changes
|
|
208
|
-
2. **Review generated PRs**: Always review the automated PR before merging
|
|
209
|
-
3. **Monitor memory usage**: Large icon sets may require increased `MAX_OLD_SPACE_SIZE`
|
|
210
|
-
4. **Validate changes**: Check the generated diff report for unexpected changes
|
|
211
|
-
5. **Handle breaking changes**: Icon deletions require careful consideration and communication
|
|
212
|
-
|
|
213
|
-
### Troubleshooting
|
|
214
|
-
|
|
215
|
-
**Common Issues:**
|
|
216
|
-
|
|
217
|
-
- **Memory errors**: Increase `MAX_OLD_SPACE_SIZE` environment variable
|
|
218
|
-
- **Figma API limits**: Process automatically handles 500-icon chunks
|
|
219
|
-
- **Missing tokens**: Ensure all required environment variables are set
|
|
220
|
-
- **Branch conflicts**: Workflow uses concurrency control to prevent conflicts
|
|
221
|
-
|
|
222
|
-
**Debug Steps:**
|
|
223
|
-
|
|
224
|
-
1. Check workflow logs for detailed error messages
|
|
225
|
-
2. Verify environment variables are correctly set
|
|
226
|
-
3. Confirm Figma file access and permissions
|
|
227
|
-
4. Review generated artifacts for additional context
|
|
228
|
-
5. Test with `--dryRun` flag to validate configuration
|
|
229
|
-
|
|
230
|
-
This automated release process ensures consistent, reliable icon updates while maintaining proper version control and change tracking throughout the UDS ecosystem.
|