@stacksjs/iconify-generator 0.2.18 → 0.2.20
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 +2 -2
- package/src/index.ts +12 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/iconify-generator",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.20",
|
|
5
5
|
"description": "Generator for Iconify icon packages",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
"dev": "bun build.ts --watch"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@stacksjs/iconify-core": "0.2.
|
|
36
|
+
"@stacksjs/iconify-core": "0.2.20"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -260,6 +260,7 @@ export function generatePackageJson(
|
|
|
260
260
|
],
|
|
261
261
|
scripts: {
|
|
262
262
|
build: 'bun build.ts',
|
|
263
|
+
prepublishOnly: 'bun build.ts',
|
|
263
264
|
},
|
|
264
265
|
dependencies: {
|
|
265
266
|
'@stacksjs/iconify-core': 'workspace:*',
|
|
@@ -808,10 +809,19 @@ export async function generatePackage(
|
|
|
808
809
|
}
|
|
809
810
|
|
|
810
811
|
/**
|
|
811
|
-
* Convert kebab-case to camelCase
|
|
812
|
+
* Convert kebab-case to a valid JS identifier in camelCase form.
|
|
813
|
+
* Iconify allows names that start with digits (e.g. "2", "3d-move") and
|
|
814
|
+
* names containing dots/slashes — none of which are legal JS identifiers.
|
|
815
|
+
* Prefix with `_` when the first char isn't [A-Za-z_$], and replace any
|
|
816
|
+
* remaining illegal chars with `_` so downstream `export { default as X }`
|
|
817
|
+
* always parses.
|
|
812
818
|
*/
|
|
813
819
|
export function toCamelCase(str: string): string {
|
|
814
|
-
|
|
820
|
+
let camel = str.replace(/-([a-z0-9])/g, g => g[1].toUpperCase())
|
|
821
|
+
camel = camel.replace(/[^a-zA-Z0-9_$]/g, '_')
|
|
822
|
+
if (/^[0-9]/.test(camel))
|
|
823
|
+
camel = `_${camel}`
|
|
824
|
+
return camel
|
|
815
825
|
}
|
|
816
826
|
|
|
817
827
|
/**
|