Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(preset-icons): load collections (#1723)
- Loading branch information
Showing
6 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import path from 'path' | ||
import { fileURLToPath } from 'url' | ||
import fs from 'fs-extra' | ||
|
||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = path.dirname(__filename) | ||
const out = path.resolve(__dirname, '../packages/preset-icons') | ||
|
||
async function prepareJSON() { | ||
const dir = path.resolve(__dirname, '../node_modules/@iconify/json/json') | ||
await fs.ensureDir(dir) | ||
|
||
const collections = (await fs.readdir(dir)).map(file => file.replace(/\.json$/, '')) | ||
await fs.writeJSON(path.resolve(out, 'src/collections.json'), collections) | ||
} | ||
|
||
async function prepare() { | ||
await prepareJSON() | ||
} | ||
|
||
prepare() |