Skip to content

Commit 683eb5b

Browse files
committed
cleanup
- update readme
1 parent 017070d commit 683eb5b

File tree

4 files changed

+332
-14
lines changed

4 files changed

+332
-14
lines changed

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ node_modules
44
.env
55

66
#figma-export-icons
7-
icons-config.json
7+
icons-config.json
8+
images

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
"iconsPath": "assets/svg/icons"
2222
}
2323
```
24+
Update: from > v1.3.0 you can set the frame to -1 and it will fetch the icons from the whole page.
25+
2426

2527
## Features
2628

Diff for: cli.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const mkdirp = require('mkdirp')
1414
const argv = require('minimist')(process.argv.slice(2))
1515
let config = {}
1616
let figmaClient
17-
let icons
1817
const spinner = ora()
1918

2019
function deleteConfig () {
@@ -158,22 +157,20 @@ function getFigmaFile () {
158157
console.log(chalk.red.bold('Cannot find Icons Page, check your settings'))
159158
return
160159
}
161-
if (config.frame != -1) {
160+
const shouldGetFrame = isNaN(config.frame) && parseInt(config.frame) !== -1
161+
let iconsArray = page.children
162+
if (shouldGetFrame) {
162163
if (!page.children.find(c => c.name === config.frame)) {
163164
console.log(chalk.red.bold('Cannot find Icons Frame in this Page, check your settings'))
164165
return
165166
}
166-
icons = page.children.find(c => c.name === config.frame).children.map((icon) => {
167-
return { id: icon.id, name: icon.name }
168-
})
169-
}
170-
if (config.frame == -1) {
171-
icons = page.children.map((icon) => {
172-
return { id: icon.id, name: icon.name }
173-
})
167+
iconsArray = iconsArray.find(c => c.name === config.frame).children
174168
}
175-
icons = findDuplicates('name', icons)
176-
resolve(icons)
169+
let icons = iconsArray.map((icon) => {
170+
return { id: icon.id, name: icon.name }
171+
})
172+
icons = findDuplicates('name', icons)
173+
resolve(icons)
177174
})
178175
.catch((err) => {
179176
spinner.fail()

Diff for: package-lock.json

+319-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)