Skip to content

Commit f5a014e

Browse files
Move proicons package
1 parent d4d836e commit f5a014e

81 files changed

Lines changed: 684 additions & 7139 deletions

Some content is hidden

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

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"vue.server.includeLanguages": [
44
"vue"
55
],
6+
"[javascript]": {
7+
"editor.defaultFormatter": "esbenp.prettier-vscode"
8+
},
9+
"[typescript]": {
10+
"editor.defaultFormatter": "esbenp.prettier-vscode"
11+
},
612
"npm.packageManager": "bun",
713
"npm.scriptRunner": "bun"
814
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
</td>
6767
<td>
6868
<a href="https://procode-software.github.io/proicons/docs/javascript-api">Documentation</a> |
69-
<a href="https://github.com/ProCode-Software/proicons/tree/main/src">GitHub</a>
69+
<a href="https://github.com/ProCode-Software/proicons/tree/main/packages/proicons">GitHub</a>
7070
</td>
7171
</tr>
7272
<tr>

ROADMAP.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# ProIcons Roadmap
2-
This project is a work in progress and still has some things incomplete. Here are some things that are currently being planned for this project. Note that this list is subject to change and items can be added or removed.
2+
Here are some things that are currently being planned for this project. Note that this list is subject to change and items can be added or removed.
33

4-
## Icon Browser
5-
An online browser to view all icons in the package, available on https://procode-software.github.io/proicons/icons.
4+
## Website Redesign
5+
Redesign the homepage, and possibly the rest of the website.
66

77
## Figma Plugin
8-
[*Available in preview*](https://github.com/ProCode-Software/proicons-figma)
8+
**Available in preview:** https://github.com/ProCode-Software/proicons-figma
99

1010
A Figma plugin that will allow you to add ProIcons into your design. It will also have the ability to automatically update ProIcons in your file.
1111

1212
The plugin source code is available in the [proicons-figma](https://github.com/ProCode-Software/proicons-figma) repository and will be published to Figma Community in the future.
1313

1414
## Roblox Plugin
15-
A free and open-source plugin will be available to download for copying and adding icons into your game.
15+
> [!IMPORTANT]
16+
> Due to Roblox API changes, new icons aren't being uploaded to Roblox.
17+
18+
~~A free and open-source plugin will be available to download for copying and adding icons into your game.~~

bin/addIconFiles.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import lockfile from '../icons/icons.lock.json' with { type: 'json' }
1414
import { createSvgNodes } from './build/createSvgNodes.ts'
1515
import { getCliParams } from './helpers/getCliParam.ts'
1616
import { prettierFormat } from './helpers/prettierFormat.ts'
17-
import { camelCase, kebabCase, pascalCase } from './helpers/rename.ts'
17+
import { camelCase, kebabCase, pascalCase } from '@proicons/shared'
1818

1919
const __dirname = fileURLToPath(dirname(import.meta.url))
2020
const __rootdir = resolve(__dirname, '../')
@@ -36,9 +36,7 @@ if (shouldCleanDir) rmSync(outDir, { recursive: true, force: true })
3636
if (!existsSync(outDir) || shouldCleanDir) mkdirSync(outDir, { recursive: true })
3737

3838
const files = readdirSync(inDir)
39-
40-
/** @type {{ name: string, path: string, friendlyName: string }[]} */
41-
const modules = []
39+
const modules: { name: string, path: string, friendlyName: string }[] = []
4240

4341
if (files.length !== Object.keys(icons).length)
4442
throw new Error(
@@ -123,12 +121,11 @@ Promise.all(
123121
)
124122
}
125123
if (shouldCreateDataFiles) {
126-
const formatAndWrite = async (data, file) => {
124+
const formatAndWrite = async (data: any, file: string) => {
127125
const formatted = await prettierFormat(
128126
'export default ' + JSON.stringify(data) + ' as const',
129127
'babel-ts'
130128
)
131-
132129
writeFileSync(resolve(process.cwd(), 'src', file), formatted)
133130
}
134131

bin/build.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import pkg from '../package.json' with { type: 'json' }
1010
import { buildFont } from './build/build-font.ts'
1111
import { prettierFormat } from './helpers/prettierFormat.ts'
1212
import convertPathToRect from '@proicons/svgo-plugins/convertPathToRect'
13-
import * as rename from './helpers/rename.ts'
13+
import * as rename from '@proicons/shared'
1414
import { type Config as SVGOConfig } from 'svgo'
1515

1616
const __rootdir = resolve(import.meta.dirname, '../')
@@ -140,7 +140,8 @@ function createLockfile() {
140140
const config: IconsJSON = JSON.parse(readFileSync(iconsJsonPath, 'utf-8'))
141141

142142
Object.keys(config).forEach(friendlyName => {
143-
const lockfileItem: LockfileItem = lockfile.icons[friendlyName as keyof typeof lockfile.icons]
143+
const lockfileItem: LockfileItem =
144+
lockfile.icons[friendlyName as keyof typeof lockfile.icons]
144145

145146
if (!lockfileItem) {
146147
lockfile.icons[friendlyName] = {

bin/build/build-font.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export async function buildFont(rebuild: boolean) {
5757
fontHeight: 500,
5858
codepoints,
5959
templates: {
60-
html: path.resolve('tools/data/html-font.hbs'),
60+
html: path.resolve('./bin/build/templates/codepoints.hbs'),
6161
},
6262
fontTypes: [
6363
FontAssetType.TTF,

bin/build/createSvgNodes.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ export function createSvgNodes(svg: string): IconNode[] {
77
const svgElement = parser.window.document.querySelector('svg')
88

99
function renderNodeList(element: Element): IconNode[] {
10-
const nodeArray = []
11-
10+
const nodeArray: IconNode[] = []
1211
for (const child of element.children) {
13-
const nodeItem = [
12+
const nodeItem: IconNode = [
1413
child.tagName,
1514
child.attributes.length > 0
1615
? Object.fromEntries(
@@ -21,7 +20,6 @@ export function createSvgNodes(svg: string): IconNode[] {
2120
]
2221
nodeArray.push(nodeItem)
2322
}
24-
2523
return nodeArray
2624
}
2725
return renderNodeList(svgElement)
Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
1-
import icons from '../../../icons/icons.json' with { type: 'json' }
2-
import lockfile from '../../../icons/icons.lock.json' with { type: 'json' }
3-
import { camelCase, pascalCase } from '../../helpers/rename.ts'
1+
import _ic from '../../../icons/icons.json' with { type: 'json' }
2+
import _lf from '../../../icons/icons.lock.json' with { type: 'json' }
3+
import { camelCase, DeprecatedIcon, Icon, Lockfile, pascalCase } from '@proicons/shared'
4+
import { LockfileIcon, IconsJSON } from '@proicons/shared'
45

56
export type Node = import('../createSvgNodes.ts').IconNode
67

8+
export interface IconData {
9+
pascalName: string
10+
camelName: string
11+
friendlyName: string
12+
lockfileItem: LockfileIcon
13+
iconData: Icon
14+
deprecationData: DeprecatedIcon
15+
/** Base64 SVG data */
16+
rawSvgData: string
17+
}
18+
19+
const lockfile: Lockfile = _lf
20+
const icons: IconsJSON = _ic
21+
722
/**
823
* Gets information about an icon
924
*/
1025
export function getData(moduleName: string) {
1126
const pascalName = moduleName.replace(/Icon$/, '')
1227
const friendlyName = Object.keys(icons).find(key => pascalCase(key) == pascalName)
28+
if (!friendlyName) throw new Error(`Icon ${friendlyName} not found`)
1329
const camelName = camelCase(friendlyName)
1430

15-
if (!friendlyName) {
16-
throw new Error(`Icon ${camelName} not found`)
17-
}
18-
19-
const lockfileItem: (typeof lockfile.icons)[keyof typeof lockfile.icons] =
20-
lockfile.icons[friendlyName]
21-
22-
const iconData: typeof icons.Add = icons[friendlyName]
23-
24-
/** @type {{version: string, alternative: string}?} */
25-
const deprecationData = lockfile.deprecated?.[friendlyName]
31+
const lockfileItem: LockfileIcon = lockfile.icons[friendlyName]
32+
const iconData: Icon = icons[friendlyName]
33+
const deprecationData: DeprecatedIcon | undefined =
34+
lockfile.deprecated?.[friendlyName]
2635

2736
const rawSvgData = Buffer.from(
2837
iconData.icon.trim().replace(/currentColor/g, '#ffffff')
@@ -35,7 +44,6 @@ export function getData(moduleName: string) {
3544
lockfileItem,
3645
iconData,
3746
deprecationData,
38-
/** Base64 SVG data */
3947
rawSvgData,
4048
}
4149
}

bin/generateChangelog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { writeFileSync } from 'fs'
22
import { resolve } from 'path'
33
import lockfile from '../icons/icons.lock.json' with { type: 'json' }
44
import pkg from '../package.json' with { type: 'json' }
5-
import { kebabCase } from './helpers/rename.ts'
5+
import { kebabCase } from '@proicons/shared'
66
const { version } = pkg
77

88
const shouldWrite = process.argv.includes('-w') || process.argv.includes('--write')

0 commit comments

Comments
 (0)