@atls-ui-generators/icons 1.0.1 → 1.0.2
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/dist/generator.js +2 -2
- package/dist/get-color-replacement/get-color-replacement.interfaces.d.ts +5 -0
- package/dist/get-color-replacement/get-color-replacement.interfaces.js +2 -0
- package/dist/get-color-replacement/get-color-replacement.util.d.ts +2 -0
- package/dist/{get-color-replacement.util.js → get-color-replacement/get-color-replacement.util.js} +1 -1
- package/dist/get-color-replacement/index.d.ts +1 -0
- package/dist/get-color-replacement/index.js +17 -0
- package/dist/icons.interfaces.d.ts +13 -0
- package/dist/icons.interfaces.js +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/utils/compile-icons.util.d.ts +4 -0
- package/dist/utils/compile-icons.util.js +28 -0
- package/dist/utils/create-files.util.d.ts +2 -0
- package/dist/utils/create-files.util.js +57 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/read-files.util.d.ts +2 -0
- package/dist/utils/read-files.util.js +18 -0
- package/dist/utils/svgr-build.util.d.ts +2 -0
- package/dist/utils/svgr-build.util.js +25 -0
- package/package.json +3 -2
- package/dist/get-color-replacement.util.d.ts +0 -5
- package/dist/svgr.d.ts +0 -1
- package/dist/svgr.js +0 -88
package/dist/generator.js
CHANGED
|
@@ -11,7 +11,7 @@ const fs_3 = require("fs");
|
|
|
11
11
|
const fs_4 = require("fs");
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const assert_1 = __importDefault(require("assert"));
|
|
14
|
-
const
|
|
14
|
+
const utils_1 = require("./utils");
|
|
15
15
|
const command = new commander_1.Command()
|
|
16
16
|
.name('Icons generator')
|
|
17
17
|
.argument('path <string>', 'Path to save icons')
|
|
@@ -34,7 +34,7 @@ const command = new commander_1.Command()
|
|
|
34
34
|
throw Error('Could not read the file');
|
|
35
35
|
replacements = eval(code);
|
|
36
36
|
}
|
|
37
|
-
await (0,
|
|
37
|
+
await (0, utils_1.svgrBuild)(iconsPath, genPath, replacements);
|
|
38
38
|
console.log(`Generated into ${genPath}`);
|
|
39
39
|
});
|
|
40
40
|
command.parse();
|
package/dist/{get-color-replacement.util.js → get-color-replacement/get-color-replacement.util.js}
RENAMED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getColorReplacement = void 0;
|
|
4
4
|
const getColorReplacement = (options) => ({
|
|
5
|
-
[options.color]: `{(vars.colors${(options.themePaths || []).reduce((str, prop) => `${str}.${prop}`, '')}[props.color
|
|
5
|
+
[options.color]: `{(props.color && vars.colors${(options.themePaths || []).reduce((str, prop) => `${str}.${prop}`, '')}[props.color]) || props.color || "${options.color}"}`,
|
|
6
6
|
});
|
|
7
7
|
exports.getColorReplacement = getColorReplacement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './get-color-replacement.util';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-color-replacement.util"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Config } from '@svgr/core';
|
|
2
|
+
export interface Icon {
|
|
3
|
+
name: string;
|
|
4
|
+
source: string;
|
|
5
|
+
fileName: string;
|
|
6
|
+
}
|
|
7
|
+
export interface Source {
|
|
8
|
+
name: string;
|
|
9
|
+
code: string;
|
|
10
|
+
withReplacement: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type Replacements = Record<string, Record<string, string>>;
|
|
13
|
+
export type CreateSvgrTemplate = (withReplacement: boolean) => Config['template'];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './get-color-replacement
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './get-color-replacement';
|
|
2
|
+
export * from './utils';
|
package/dist/index.js
CHANGED
|
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./get-color-replacement
|
|
18
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./get-color-replacement"), exports);
|
|
18
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileIcons = void 0;
|
|
4
|
+
const core_1 = require("@svgr/core");
|
|
5
|
+
const createSvgrTemplate = (withReplacement) => ({ jsx, componentName }, { tpl }) => tpl `
|
|
6
|
+
import type { IconProps } from '../icons.interfaces.js'
|
|
7
|
+
|
|
8
|
+
import React from 'react'
|
|
9
|
+
import { memo } from 'react'
|
|
10
|
+
|
|
11
|
+
${withReplacement ? `import { vars } from '@atls-ui-admin/theme'` : ''}
|
|
12
|
+
|
|
13
|
+
export const ${componentName} = memo((props: IconProps) => (
|
|
14
|
+
${jsx}
|
|
15
|
+
))
|
|
16
|
+
`;
|
|
17
|
+
const compileIcons = async (icons, replacements) => Promise.all(icons.map(async (icon) => ({
|
|
18
|
+
name: icon.fileName,
|
|
19
|
+
code: await (0, core_1.transform)(icon.source.replace(/mask0/g, icon.name), {
|
|
20
|
+
icon: true,
|
|
21
|
+
typescript: true,
|
|
22
|
+
template: createSvgrTemplate(Boolean(replacements[icon.name])),
|
|
23
|
+
plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'],
|
|
24
|
+
replaceAttrValues: replacements[icon.name] || {},
|
|
25
|
+
}, { componentName: icon.name.replace('50+', 'FiftyPlus') }),
|
|
26
|
+
withReplacement: Boolean(replacements[icon.name]),
|
|
27
|
+
})));
|
|
28
|
+
exports.compileIcons = compileIcons;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.createFiles = void 0;
|
|
30
|
+
const prettierPlugin = __importStar(require("@atls/prettier-plugin"));
|
|
31
|
+
const config_prettier_1 = __importDefault(require("@atls/config-prettier"));
|
|
32
|
+
const fs_extra_promise_1 = __importDefault(require("fs-extra-promise"));
|
|
33
|
+
const path_1 = __importDefault(require("path"));
|
|
34
|
+
const parser_babel_1 = __importDefault(require("prettier/parser-babel"));
|
|
35
|
+
const parser_typescript_1 = __importDefault(require("prettier/parser-typescript"));
|
|
36
|
+
const standalone_1 = __importDefault(require("prettier/standalone"));
|
|
37
|
+
const writeSourceFile = async (source, targetDir) => {
|
|
38
|
+
const filename = path_1.default.join(targetDir, `${source.name}.tsx`);
|
|
39
|
+
const config = config_prettier_1.default;
|
|
40
|
+
const data = standalone_1.default.format(source.code, {
|
|
41
|
+
...config,
|
|
42
|
+
filepath: path_1.default.join(targetDir, `${source.name}.tsx`),
|
|
43
|
+
plugins: [parser_typescript_1.default, parser_babel_1.default, prettierPlugin],
|
|
44
|
+
});
|
|
45
|
+
await fs_extra_promise_1.default.writeFileAsync(filename, data);
|
|
46
|
+
};
|
|
47
|
+
const writeIndexFile = async (sources, targetDir) => {
|
|
48
|
+
const filename = path_1.default.join(targetDir, 'index.ts');
|
|
49
|
+
const data = `${sources.map((source) => `export * from './${source.name}.js'`).join('\n')}\n`;
|
|
50
|
+
await fs_extra_promise_1.default.writeFileAsync(filename, data);
|
|
51
|
+
};
|
|
52
|
+
const createFiles = async (sources, targetDir) => {
|
|
53
|
+
await fs_extra_promise_1.default.ensureDir(targetDir);
|
|
54
|
+
await Promise.all(sources.map(async (source) => writeSourceFile(source, targetDir)));
|
|
55
|
+
await writeIndexFile(sources, targetDir);
|
|
56
|
+
};
|
|
57
|
+
exports.createFiles = createFiles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './svgr-build.util';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./svgr-build.util"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readFiles = void 0;
|
|
7
|
+
const camelcase_1 = __importDefault(require("camelcase"));
|
|
8
|
+
const fs_extra_promise_1 = __importDefault(require("fs-extra-promise"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const createIcon = async (iconPath) => ({
|
|
11
|
+
name: `${(0, camelcase_1.default)(path_1.default.basename(iconPath, path_1.default.extname(iconPath)), {
|
|
12
|
+
pascalCase: true,
|
|
13
|
+
}).replace('50+', 'FiftyPlus')}Icon`,
|
|
14
|
+
fileName: `${path_1.default.basename(iconPath, path_1.default.extname(iconPath)).replace('50+', 'FiftyPlus')}.icon`,
|
|
15
|
+
source: (await fs_extra_promise_1.default.readFileAsync(iconPath)).toString(),
|
|
16
|
+
});
|
|
17
|
+
const readFiles = async (files) => Promise.all(files.map(createIcon));
|
|
18
|
+
exports.readFiles = readFiles;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.svgrBuild = void 0;
|
|
7
|
+
const glob_promise_1 = __importDefault(require("glob-promise"));
|
|
8
|
+
const compile_icons_util_1 = require("./compile-icons.util");
|
|
9
|
+
const create_files_util_1 = require("./create-files.util");
|
|
10
|
+
const read_files_util_1 = require("./read-files.util");
|
|
11
|
+
const svgrBuild = async (iconsPath, targetDir, replacements) => {
|
|
12
|
+
const prettifyIconsPath = () => {
|
|
13
|
+
const parts = iconsPath.split('');
|
|
14
|
+
if (parts[parts.length - 1] === '/') {
|
|
15
|
+
parts.pop();
|
|
16
|
+
return parts.join('');
|
|
17
|
+
}
|
|
18
|
+
return iconsPath;
|
|
19
|
+
};
|
|
20
|
+
const files = await (0, glob_promise_1.default)(`${prettifyIconsPath()}/*.svg`);
|
|
21
|
+
const icons = await (0, read_files_util_1.readFiles)(files);
|
|
22
|
+
const sources = await (0, compile_icons_util_1.compileIcons)(icons.filter((icon) => icon.source), replacements);
|
|
23
|
+
await (0, create_files_util_1.createFiles)(sources, targetDir);
|
|
24
|
+
};
|
|
25
|
+
exports.svgrBuild = svgrBuild;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atls-ui-generators/icons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@atls/config-prettier": "0.0.5",
|
|
20
20
|
"@atls/prettier-plugin": "0.0.7",
|
|
21
21
|
"@babel/standalone": "7.22.20",
|
|
22
|
-
"@svgr/core": "
|
|
22
|
+
"@svgr/core": "8.1.0",
|
|
23
23
|
"camelcase": "6.3.0",
|
|
24
24
|
"commander": "9.5.0",
|
|
25
25
|
"fs-extra-promise": "1.0.1",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"prettier": "2.8.8"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
+
"@types/babel__core": "7.20.5",
|
|
31
32
|
"@types/babel__standalone": "7.1.7",
|
|
32
33
|
"@types/fs-extra-promise": "1.0.12",
|
|
33
34
|
"@types/prettier": "2.7.3"
|
package/dist/svgr.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const build: (iconsPath: string, targetDir: string, replacements: object) => Promise<void>;
|
package/dist/svgr.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.build = void 0;
|
|
30
|
-
const prettierPlugin = __importStar(require("@atls/prettier-plugin"));
|
|
31
|
-
const config_prettier_1 = __importDefault(require("@atls/config-prettier"));
|
|
32
|
-
const core_1 = __importDefault(require("@svgr/core"));
|
|
33
|
-
const standalone_1 = require("prettier/standalone");
|
|
34
|
-
const camelcase_1 = __importDefault(require("camelcase"));
|
|
35
|
-
const fs_extra_promise_1 = __importDefault(require("fs-extra-promise"));
|
|
36
|
-
const glob_promise_1 = __importDefault(require("glob-promise"));
|
|
37
|
-
const path_1 = __importDefault(require("path"));
|
|
38
|
-
const parser_babel_1 = __importDefault(require("prettier/parser-babel"));
|
|
39
|
-
const parser_typescript_1 = __importDefault(require("prettier/parser-typescript"));
|
|
40
|
-
const svgrTemplate = ({ template }, opts, { componentName, jsx }) => {
|
|
41
|
-
const typeScriptTpl = template.smart({ plugins: ['typescript', 'prettier'] });
|
|
42
|
-
return typeScriptTpl.ast `
|
|
43
|
-
import React from 'react'
|
|
44
|
-
import { vars } from '@ui/theme'
|
|
45
|
-
import type { IconProps } from '../icons.interfaces'
|
|
46
|
-
|
|
47
|
-
export const ${componentName} = React.memo((props: IconProps) => (
|
|
48
|
-
${jsx}
|
|
49
|
-
))
|
|
50
|
-
`;
|
|
51
|
-
};
|
|
52
|
-
const read = async (files) => Promise.all(files.map(async (iconPath) => ({
|
|
53
|
-
name: `${(0, camelcase_1.default)(path_1.default.basename(iconPath, path_1.default.extname(iconPath)), {
|
|
54
|
-
pascalCase: true,
|
|
55
|
-
}).replace('50+', 'FiftyPlus')}Icon`,
|
|
56
|
-
source: (await fs_extra_promise_1.default.readFileAsync(iconPath)).toString(),
|
|
57
|
-
})));
|
|
58
|
-
const compile = async (icons, replacements) => Promise.all(icons.map(async (icon) => ({
|
|
59
|
-
name: icon.name,
|
|
60
|
-
code: await (0, core_1.default)(icon.source.replace(/mask0/g, icon.name), {
|
|
61
|
-
icon: true,
|
|
62
|
-
template: svgrTemplate,
|
|
63
|
-
replaceAttrValues: replacements[icon.name] || {},
|
|
64
|
-
}, { componentName: icon.name.replace('50+', 'FiftyPlus') }),
|
|
65
|
-
})));
|
|
66
|
-
const save = async (sources, targetDir) => Promise.all(sources.map((source) => fs_extra_promise_1.default.writeFileAsync(path_1.default.join(targetDir, `${source.name}.tsx`), (0, standalone_1.format)(`/* eslint-disable */\n${source?.code || ''}`, {
|
|
67
|
-
...config_prettier_1.default,
|
|
68
|
-
filepath: path_1.default.join(targetDir, `${source.name}.tsx`),
|
|
69
|
-
plugins: [parser_typescript_1.default, parser_babel_1.default, prettierPlugin],
|
|
70
|
-
}))));
|
|
71
|
-
const createIndex = (sources, targetDir) => fs_extra_promise_1.default.writeFileAsync(path_1.default.join(targetDir, 'index.ts'), `${sources.map((source) => `export * from './${source.name}'`).join('\n')}\n`);
|
|
72
|
-
const build = async (iconsPath, targetDir, replacements) => {
|
|
73
|
-
const prettifyIconsPath = () => {
|
|
74
|
-
const parts = iconsPath.split('');
|
|
75
|
-
if (parts[parts.length - 1] === '/') {
|
|
76
|
-
parts.pop();
|
|
77
|
-
return parts.join('');
|
|
78
|
-
}
|
|
79
|
-
return iconsPath;
|
|
80
|
-
};
|
|
81
|
-
const files = await (0, glob_promise_1.default)(`${prettifyIconsPath()}/*.svg`);
|
|
82
|
-
const icons = await read(files);
|
|
83
|
-
const sources = await compile(icons.filter((icon) => icon.source), replacements);
|
|
84
|
-
await fs_extra_promise_1.default.ensureDir(targetDir);
|
|
85
|
-
await save(sources, targetDir);
|
|
86
|
-
await createIndex(sources, targetDir);
|
|
87
|
-
};
|
|
88
|
-
exports.build = build;
|