mirror of
https://github.com/desktop/desktop
synced 2024-09-19 16:12:20 +00:00
Convert generate-octicons to TypeScript
This commit is contained in:
parent
b324c812d5
commit
d7b3ec0b5c
|
@ -107,6 +107,7 @@
|
|||
"@types/uuid": "^3.4.0",
|
||||
"@types/winston": "^2.2.0",
|
||||
"prettier": "~1.7.0",
|
||||
"@types/xml2js": "^0.4.0",
|
||||
"tslint-config-prettier": "^1.1.0",
|
||||
"tslint-react": "~3.0.0"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/* generate-octicons
|
||||
*
|
||||
* Utility script for generating a strongly typed representation of all
|
||||
|
@ -9,11 +7,11 @@
|
|||
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const process = require('process')
|
||||
const xml2js = require('xml2js')
|
||||
const path = require('path')
|
||||
const toCamelCase = require('to-camel-case')
|
||||
import fs = require('fs')
|
||||
import process = require('process')
|
||||
import xml2js = require('xml2js')
|
||||
import path = require('path')
|
||||
import toCamelCase = require('to-camel-case')
|
||||
|
||||
const filePath = path.resolve(
|
||||
__dirname,
|
||||
|
@ -26,7 +24,16 @@ const filePath = path.resolve(
|
|||
|
||||
const file = fs.readFileSync(filePath)
|
||||
|
||||
xml2js.parseString(file, function(err, result) {
|
||||
interface XML2JSResult {
|
||||
svg: { symbol: ReadonlyArray<XML2JSNode> }
|
||||
}
|
||||
interface XML2JSNode {
|
||||
$: { [key: string]: string }
|
||||
path: ReadonlyArray<XML2JSNode>
|
||||
|
||||
}
|
||||
|
||||
xml2js.parseString(file, function(err, result: XML2JSResult) {
|
||||
const viewBoxRe = /0 0 (\d+) (\d+)/
|
||||
const out = fs.createWriteStream(
|
||||
path.resolve(__dirname, '../app/src/ui/octicons/octicons.generated.ts')
|
Loading…
Reference in a new issue