@atls-ui-generators/icons 1.0.5 → 1.1.0
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/CHANGELOG.md +12 -0
- package/README.md +16 -4
- package/dist/icons.generator.js +37 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/replacement-utils/create-replacements/create-replacements.interfaces.d.ts +2 -0
- package/dist/replacement-utils/create-replacements/create-replacements.util.d.ts +2 -0
- package/dist/replacement-utils/create-replacements/create-replacements.util.js +10 -0
- package/dist/replacement-utils/create-replacements/index.d.ts +1 -0
- package/dist/replacement-utils/create-replacements/index.js +1 -0
- package/dist/replacement-utils/create-replacements/tests/create-replacements.test.constants.d.ts +2 -0
- package/dist/replacement-utils/create-replacements/tests/create-replacements.test.constants.js +37 -0
- package/dist/replacement-utils/create-replacements/tests/create-replacements.test.interfaces.d.ts +6 -0
- package/dist/replacement-utils/create-replacements/tests/create-replacements.test.interfaces.js +1 -0
- package/dist/replacement-utils/get-color-replacement/get-color-replacement.interfaces.js +1 -0
- package/dist/replacement-utils/index.d.ts +2 -0
- package/dist/replacement-utils/index.js +2 -0
- package/dist/{utils → svgr-utils}/compile-icons.util.js +8 -5
- package/dist/svgr-utils/create-files.util.js +23 -0
- package/dist/svgr-utils/read-files.util.d.ts +2 -0
- package/dist/svgr-utils/read-files.util.js +7 -0
- package/dist/{utils → svgr-utils}/svgr-build.util.js +2 -2
- package/package.json +37 -17
- package/dist/generator.js +0 -35
- package/dist/utils/create-files.util.js +0 -28
- package/dist/utils/read-files.util.d.ts +0 -2
- package/dist/utils/read-files.util.js +0 -11
- /package/dist/{generator.d.ts → icons.generator.d.ts} +0 -0
- /package/dist/{get-color-replacement/get-color-replacement.interfaces.js → replacement-utils/create-replacements/create-replacements.interfaces.js} +0 -0
- /package/dist/{get-color-replacement → replacement-utils/get-color-replacement}/get-color-replacement.interfaces.d.ts +0 -0
- /package/dist/{get-color-replacement → replacement-utils/get-color-replacement}/get-color-replacement.util.d.ts +0 -0
- /package/dist/{get-color-replacement → replacement-utils/get-color-replacement}/get-color-replacement.util.js +0 -0
- /package/dist/{get-color-replacement → replacement-utils/get-color-replacement}/index.d.ts +0 -0
- /package/dist/{get-color-replacement → replacement-utils/get-color-replacement}/index.js +0 -0
- /package/dist/{utils → svgr-utils}/compile-icons.util.d.ts +0 -0
- /package/dist/{utils → svgr-utils}/create-files.util.d.ts +0 -0
- /package/dist/{utils → svgr-utils}/index.d.ts +0 -0
- /package/dist/{utils → svgr-utils}/index.js +0 -0
- /package/dist/{utils → svgr-utils}/svgr-build.util.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
# [1.1.0](https://github.com/atls/hyperion/compare/@atls-ui-generators/icons@1.0.5...@atls-ui-generators/icons@1.1.0) (2025-03-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* **generators:** icons generator ([#600](https://github.com/atls/hyperion/issues/600)) ([931f921](https://github.com/atls/hyperion/commit/931f921489d382f9a4e0a37c39d6082ed131f3f9))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
3
15
|
## [1.0.5](https://github.com/atls/hyperion/compare/@atls-ui-generators/icons@1.0.4...@atls-ui-generators/icons@1.0.5) (2025-02-19)
|
|
4
16
|
|
|
5
17
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Appearance генератор
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
### Использование
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
-
|
|
5
|
+
```
|
|
6
|
+
generate-icons --help
|
|
7
|
+
|
|
8
|
+
generate-icons ./src/icons -i ./svg -r ./src/replacements.ts
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Разработка
|
|
12
|
+
|
|
13
|
+
Запуск тестов
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
yarn test unit create-replacements.test.ts
|
|
17
|
+
yarn test unit get-color-replacement.test.ts
|
|
18
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { lstatSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { program } from 'commander';
|
|
5
|
+
import { createLogger } from '@atls-ui-generators/utils';
|
|
6
|
+
import { processFile } from '@atls-ui-generators/utils';
|
|
7
|
+
import { svgrBuild } from './svgr-utils/index.js';
|
|
8
|
+
const logger = createLogger('icons-generator');
|
|
9
|
+
try {
|
|
10
|
+
program
|
|
11
|
+
.name('Icons generator')
|
|
12
|
+
.argument('path <string>', 'Path to save the icons')
|
|
13
|
+
.requiredOption('-i, --icons path <string>', 'Path to icons svg dir')
|
|
14
|
+
.option('-r, --replacements path <string>', 'Path to replacements file')
|
|
15
|
+
.parse(process.argv);
|
|
16
|
+
const path = program.args.at(0);
|
|
17
|
+
const { icons: iconsPath, replacements: replacementsPath } = program.opts();
|
|
18
|
+
assert.ok(path && typeof path === 'string', 'Path to save the icons is required');
|
|
19
|
+
assert.ok(lstatSync(path).isDirectory(), 'Path to save icons should point to a directory.');
|
|
20
|
+
assert.ok(iconsPath && typeof iconsPath === 'string', 'Icons svg path is required');
|
|
21
|
+
assert.ok(lstatSync(iconsPath).isDirectory(), 'Icons path should point to a directory');
|
|
22
|
+
let replacements = {};
|
|
23
|
+
if (replacementsPath) {
|
|
24
|
+
assert.ok(typeof replacementsPath === 'string', 'Replacements path should be string');
|
|
25
|
+
assert.ok(lstatSync(replacementsPath).isFile(), 'Replacements path should point to a file');
|
|
26
|
+
logger.info(`Extract replacements from ${replacementsPath}`);
|
|
27
|
+
const absoluteReplacementsPath = join(process.cwd(), replacementsPath);
|
|
28
|
+
const exports = processFile(absoluteReplacementsPath);
|
|
29
|
+
replacements = Object.values(exports)?.[0];
|
|
30
|
+
}
|
|
31
|
+
logger.info(`Icon generation started into ${path}`);
|
|
32
|
+
await svgrBuild(iconsPath, path, replacements);
|
|
33
|
+
logger.info(`Generated into ${path}`);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
logger.error(error);
|
|
37
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './utils/index.js';
|
|
1
|
+
export * from './replacement-utils/index.js';
|
|
2
|
+
export * from './svgr-utils/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./utils/index.js";
|
|
1
|
+
export * from "./replacement-utils/index.js";
|
|
2
|
+
export * from "./svgr-utils/index.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getColorReplacement } from '../get-color-replacement/index.js';
|
|
2
|
+
export const createReplacements = (replacementIcons) => Object.entries(replacementIcons).reduce((replacement, [icon, value]) => {
|
|
3
|
+
if (Array.isArray(value)) {
|
|
4
|
+
return {
|
|
5
|
+
...replacement,
|
|
6
|
+
[icon]: value.reduce((colors, color) => ({ ...colors, ...getColorReplacement({ color }) }), {}),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
return { ...replacement, [icon]: getColorReplacement({ color: value }) };
|
|
10
|
+
}, {});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './create-replacements.util.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./create-replacements.util.js";
|
package/dist/replacement-utils/create-replacements/tests/create-replacements.test.constants.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const testCases = [
|
|
2
|
+
{
|
|
3
|
+
replacementIcons: {},
|
|
4
|
+
expectedResult: {},
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
replacementIcons: {
|
|
8
|
+
CircleIcon: '#18181B',
|
|
9
|
+
LeftIcon: '#18181B',
|
|
10
|
+
},
|
|
11
|
+
expectedResult: {
|
|
12
|
+
CircleIcon: {
|
|
13
|
+
'#18181B': '{(props.color && vars.colors[props.color]) || props.color || "#18181B"}',
|
|
14
|
+
},
|
|
15
|
+
LeftIcon: {
|
|
16
|
+
'#18181B': '{(props.color && vars.colors[props.color]) || props.color || "#18181B"}',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
replacementIcons: {
|
|
22
|
+
CircleIcon: ['#18181B', '#000000'],
|
|
23
|
+
LeftIcon: ['#18181B', '#000000', '#0000FF'],
|
|
24
|
+
},
|
|
25
|
+
expectedResult: {
|
|
26
|
+
CircleIcon: {
|
|
27
|
+
'#18181B': '{(props.color && vars.colors[props.color]) || props.color || "#18181B"}',
|
|
28
|
+
'#000000': '{(props.color && vars.colors[props.color]) || props.color || "#000000"}',
|
|
29
|
+
},
|
|
30
|
+
LeftIcon: {
|
|
31
|
+
'#18181B': '{(props.color && vars.colors[props.color]) || props.color || "#18181B"}',
|
|
32
|
+
'#000000': '{(props.color && vars.colors[props.color]) || props.color || "#000000"}',
|
|
33
|
+
'#0000FF': '{(props.color && vars.colors[props.color]) || props.color || "#0000FF"}',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
];
|
package/dist/replacement-utils/create-replacements/tests/create-replacements.test.interfaces.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,21 +2,24 @@ import { transform } from '@svgr/core';
|
|
|
2
2
|
const createSvgrTemplate = (withReplacement) => ({ jsx, componentName }, { tpl }) => tpl `
|
|
3
3
|
import type { IconProps } from '../icons.interfaces.js'
|
|
4
4
|
|
|
5
|
+
import type { FC } from 'react'
|
|
6
|
+
|
|
5
7
|
import React from 'react'
|
|
6
|
-
import { memo } from 'react'
|
|
7
8
|
import { clsx } from 'clsx'
|
|
8
9
|
|
|
9
10
|
${withReplacement ? `import { vars } from '@ui/theme'` : ''}
|
|
10
11
|
|
|
11
12
|
import { iconSprinkles } from '../icon.css.js'
|
|
12
13
|
|
|
13
|
-
export const ${componentName} =
|
|
14
|
+
export const ${componentName}: FC<IconProps> = (props) => {
|
|
14
15
|
const { className, style, otherProps } = iconSprinkles(props)
|
|
15
16
|
|
|
17
|
+
const iconStyle = { ...style, ...otherProps.style }
|
|
18
|
+
|
|
16
19
|
return (
|
|
17
20
|
${jsx}
|
|
18
21
|
)
|
|
19
|
-
}
|
|
22
|
+
}
|
|
20
23
|
`;
|
|
21
24
|
export const compileIcons = async (icons, replacements) => Promise.all(icons.map(async (icon) => ({
|
|
22
25
|
name: icon.fileName,
|
|
@@ -26,8 +29,8 @@ export const compileIcons = async (icons, replacements) => Promise.all(icons.map
|
|
|
26
29
|
template: createSvgrTemplate(Boolean(replacements[icon.name])),
|
|
27
30
|
plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'],
|
|
28
31
|
svgProps: {
|
|
29
|
-
className:
|
|
30
|
-
style: '{
|
|
32
|
+
className: `{clsx(className, typeof otherProps?.className === 'string' && otherProps.className)}`,
|
|
33
|
+
style: '{iconStyle}',
|
|
31
34
|
},
|
|
32
35
|
replaceAttrValues: { ...replacements[icon.name] },
|
|
33
36
|
}, { componentName: icon.name.replace('50+', 'FiftyPlus') }),
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { pretty } from '@atls-ui-generators/utils';
|
|
4
|
+
const writeSourceFile = async (source, targetDir) => {
|
|
5
|
+
const filename = path.join(targetDir, `${source.name}.tsx`);
|
|
6
|
+
const data = await pretty(source.code);
|
|
7
|
+
fs.writeFileSync(filename, data);
|
|
8
|
+
};
|
|
9
|
+
const writeIndexFile = (sources, targetDir) => {
|
|
10
|
+
const filename = path.join(targetDir, 'index.ts');
|
|
11
|
+
const data = `${sources
|
|
12
|
+
.sort((sourceA, sourceB) => sourceA.name.localeCompare(sourceB.name))
|
|
13
|
+
.map((source) => `export * from './${source.name}.js'`)
|
|
14
|
+
.join('\n')}\n`;
|
|
15
|
+
fs.writeFileSync(filename, data);
|
|
16
|
+
};
|
|
17
|
+
export const createFiles = async (sources, targetDir) => {
|
|
18
|
+
if (!fs.existsSync(targetDir)) {
|
|
19
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
20
|
+
}
|
|
21
|
+
await Promise.all(sources.map(async (source) => writeSourceFile(source, targetDir)));
|
|
22
|
+
writeIndexFile(sources, targetDir);
|
|
23
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import glob from 'glob
|
|
1
|
+
import { glob } from 'glob';
|
|
2
2
|
import { compileIcons } from './compile-icons.util.js';
|
|
3
3
|
import { createFiles } from './create-files.util.js';
|
|
4
4
|
import { readFiles } from './read-files.util.js';
|
|
@@ -12,7 +12,7 @@ export const svgrBuild = async (iconsPath, targetDir, replacements) => {
|
|
|
12
12
|
return iconsPath;
|
|
13
13
|
};
|
|
14
14
|
const files = await glob(`${prettifyIconsPath()}/*.svg`);
|
|
15
|
-
const icons =
|
|
15
|
+
const icons = readFiles(files);
|
|
16
16
|
const sources = await compileIcons(icons.filter((icon) => icon.source), replacements);
|
|
17
17
|
await createFiles(sources, targetDir);
|
|
18
18
|
};
|
package/package.json
CHANGED
|
@@ -1,45 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atls-ui-generators/icons",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"generate-icons": "dist/generator.js"
|
|
8
|
+
"generate-icons": "dist/icons.generator.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "yarn library build",
|
|
15
|
+
"generate-icons": "tsx src/icons.generator.ts",
|
|
15
16
|
"prepack": "yarn run build",
|
|
16
17
|
"postpack": "rm -rf dist"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"@atls-ui-generators/utils": "
|
|
20
|
-
"@atls/config-prettier": "0.0.5",
|
|
21
|
-
"@atls/prettier-plugin": "0.0.7",
|
|
22
|
-
"@babel/standalone": "7.22.20",
|
|
20
|
+
"@atls-ui-generators/utils": "1.0.3",
|
|
23
21
|
"@svgr/core": "8.1.0",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"glob": "
|
|
28
|
-
"glob-promise": "5.0.0",
|
|
29
|
-
"prettier": "2.8.8"
|
|
22
|
+
"@swc-node/register": "1.9.0",
|
|
23
|
+
"@swc/core": "1.6.1",
|
|
24
|
+
"commander": "13.1.0",
|
|
25
|
+
"glob": "11.0.1"
|
|
30
26
|
},
|
|
31
27
|
"devDependencies": {
|
|
32
|
-
"@types/
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"@types/node": "20.11.5",
|
|
36
|
-
"@types/prettier": "2.7.3"
|
|
28
|
+
"@types/node": "22.13.8",
|
|
29
|
+
"tsx": "4.19.3",
|
|
30
|
+
"typescript": "5.5.4"
|
|
37
31
|
},
|
|
38
32
|
"publishConfig": {
|
|
39
33
|
"access": "public",
|
|
34
|
+
"exports": {
|
|
35
|
+
"./package.json": "./package.json",
|
|
36
|
+
".": {
|
|
37
|
+
"import": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./replacement": {
|
|
42
|
+
"import": "./dist/replacement-utils/index.js",
|
|
43
|
+
"types": "./dist/replacement-utils/index.d.ts",
|
|
44
|
+
"default": "./dist/replacement-utils/index.js"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
40
47
|
"main": "dist/index.js",
|
|
41
48
|
"typings": "dist/index.d.ts"
|
|
42
49
|
},
|
|
43
50
|
"typecheckSkipLibCheck": true,
|
|
51
|
+
"exports": {
|
|
52
|
+
"./package.json": "./package.json",
|
|
53
|
+
".": {
|
|
54
|
+
"import": "./dist/index.js",
|
|
55
|
+
"types": "./dist/index.d.ts",
|
|
56
|
+
"default": "./dist/index.js"
|
|
57
|
+
},
|
|
58
|
+
"./replacement": {
|
|
59
|
+
"import": "./dist/replacement-utils/index.js",
|
|
60
|
+
"types": "./dist/replacement-utils/index.d.ts",
|
|
61
|
+
"default": "./dist/replacement-utils/index.js"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
44
64
|
"typings": "dist/index.d.ts"
|
|
45
65
|
}
|
package/dist/generator.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { transform } from '@babel/standalone';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { readFileSync } from 'fs';
|
|
4
|
-
import { lstatSync } from 'fs';
|
|
5
|
-
import { existsSync } from 'fs';
|
|
6
|
-
import { mkdirSync } from 'fs';
|
|
7
|
-
import { join } from 'path';
|
|
8
|
-
import assert from 'assert';
|
|
9
|
-
import { svgrBuild } from './utils/index.js';
|
|
10
|
-
const command = new Command()
|
|
11
|
-
.name('Icons generator')
|
|
12
|
-
.argument('path <string>', 'Path to save icons')
|
|
13
|
-
.option('-i, --icons path <string>', 'Path to icons dir')
|
|
14
|
-
.option('-r, --replacements path <string>', 'Path to replacements file')
|
|
15
|
-
.action(async (path, options) => {
|
|
16
|
-
assert.ok(options.icons, 'Icons dir path is required');
|
|
17
|
-
const iconsPath = join(process.cwd(), options.icons);
|
|
18
|
-
const genPath = join(process.cwd(), path);
|
|
19
|
-
if (!existsSync(genPath)) {
|
|
20
|
-
mkdirSync(genPath);
|
|
21
|
-
}
|
|
22
|
-
assert.ok(lstatSync(genPath).isDirectory(), 'Path to save icons should point to a directory.');
|
|
23
|
-
assert.ok(lstatSync(iconsPath).isDirectory(), 'Icons path should point to a directory.');
|
|
24
|
-
let replacements = {};
|
|
25
|
-
if (options.replacements) {
|
|
26
|
-
const replacementsFile = readFileSync(join(process.cwd(), options.replacements)).toString('utf-8');
|
|
27
|
-
const { code } = transform(replacementsFile, { presets: ['env'] });
|
|
28
|
-
if (!code)
|
|
29
|
-
throw Error('Could not read the file');
|
|
30
|
-
replacements = eval(code);
|
|
31
|
-
}
|
|
32
|
-
await svgrBuild(iconsPath, genPath, replacements);
|
|
33
|
-
console.log(`Generated into ${genPath}`);
|
|
34
|
-
});
|
|
35
|
-
command.parse();
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as prettierPlugin from '@atls/prettier-plugin';
|
|
2
|
-
import atlsPrettierConfig from '@atls/config-prettier';
|
|
3
|
-
import fs from 'fs-extra-promise';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import parserBabel from 'prettier/parser-babel.js';
|
|
6
|
-
import parserTypescript from 'prettier/parser-typescript.js';
|
|
7
|
-
import prettier from 'prettier/standalone.js';
|
|
8
|
-
const prettierConfig = 'default' in atlsPrettierConfig ? atlsPrettierConfig.default : atlsPrettierConfig;
|
|
9
|
-
const writeSourceFile = async (source, targetDir) => {
|
|
10
|
-
const filename = path.join(targetDir, `${source.name}.tsx`);
|
|
11
|
-
const config = prettierConfig;
|
|
12
|
-
const data = prettier.format(source.code, {
|
|
13
|
-
...config,
|
|
14
|
-
filepath: path.join(targetDir, `${source.name}.tsx`),
|
|
15
|
-
plugins: [parserTypescript, parserBabel, prettierPlugin],
|
|
16
|
-
});
|
|
17
|
-
await fs.writeFileAsync(filename, data);
|
|
18
|
-
};
|
|
19
|
-
const writeIndexFile = async (sources, targetDir) => {
|
|
20
|
-
const filename = path.join(targetDir, 'index.ts');
|
|
21
|
-
const data = `${sources.map((source) => `export * from './${source.name}.js'`).join('\n')}\n`;
|
|
22
|
-
await fs.writeFileAsync(filename, data);
|
|
23
|
-
};
|
|
24
|
-
export const createFiles = async (sources, targetDir) => {
|
|
25
|
-
await fs.ensureDir(targetDir);
|
|
26
|
-
await Promise.all(sources.map(async (source) => writeSourceFile(source, targetDir)));
|
|
27
|
-
await writeIndexFile(sources, targetDir);
|
|
28
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import camelcase from 'camelcase';
|
|
2
|
-
import fs from 'fs-extra-promise';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
const createIcon = async (iconPath) => ({
|
|
5
|
-
name: `${camelcase(path.basename(iconPath, path.extname(iconPath)), {
|
|
6
|
-
pascalCase: true,
|
|
7
|
-
}).replace('50+', 'FiftyPlus')}Icon`,
|
|
8
|
-
fileName: `${path.basename(iconPath, path.extname(iconPath)).replace('50+', 'FiftyPlus')}.icon`,
|
|
9
|
-
source: (await fs.readFileAsync(iconPath)).toString(),
|
|
10
|
-
});
|
|
11
|
-
export const readFiles = async (files) => Promise.all(files.map(createIcon));
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|