@cloud-ru/ft-gulp-icon-builder 1.0.1-preview-9dae167.0 → 1.0.1-preview-de2b26f.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.
@@ -1,6 +1,7 @@
1
1
  type Params = {
2
2
  src: string;
3
3
  dest: string;
4
+ getComponentName?: (fileName: string) => string;
4
5
  };
5
- export declare function gulpSvgIndexFile({ src, dest }: Params): import("stream").Transform;
6
+ export declare function gulpSvgIndexFile({ src, dest, getComponentName }: Params): import("stream").Transform;
6
7
  export {};
@@ -23,7 +23,7 @@ const capitalizeFirstLetter = (str) => {
23
23
  return str.charAt(0).toUpperCase() + str.slice(1);
24
24
  };
25
25
  const removeLeadingSlash = (str) => str.replace(/^\/+/, '');
26
- function gulpSvgIndexFile({ src, dest }) {
26
+ function gulpSvgIndexFile({ src, dest, getComponentName = capitalizeFirstLetter }) {
27
27
  const folders = {};
28
28
  const getTail = (fullPath) => removeLeadingSlash(fullPath.replace(node_path_1.default.resolve(process.cwd(), src), ''));
29
29
  return (0, createPipeTransformer_1.createPipeTransformer)({
@@ -52,7 +52,7 @@ function gulpSvgIndexFile({ src, dest }) {
52
52
  {
53
53
  // index file for all
54
54
  const folderName = node_path_1.default.basename(folder);
55
- const componentName = capitalizeFirstLetter(folderName);
55
+ const componentName = getComponentName(folderName);
56
56
  imports.push(`export { default as ${componentName} } from './${folderName}';`);
57
57
  if (!indexFile) {
58
58
  indexFile = node_path_1.default.resolve(dest, getTail(node_path_1.default.dirname(folder)), 'index.tsx');
@@ -1,6 +1,7 @@
1
1
  type Params = {
2
2
  src: string;
3
3
  dest: string;
4
+ getComponentName?: (fileName: string) => string;
4
5
  };
5
- export declare function gulpSvgIndexFile({ src, dest }: Params): import("stream").Transform;
6
+ export declare function gulpSvgIndexFile({ src, dest, getComponentName }: Params): import("stream").Transform;
6
7
  export {};
@@ -17,7 +17,7 @@ const capitalizeFirstLetter = (str) => {
17
17
  return str.charAt(0).toUpperCase() + str.slice(1);
18
18
  };
19
19
  const removeLeadingSlash = (str) => str.replace(/^\/+/, '');
20
- export function gulpSvgIndexFile({ src, dest }) {
20
+ export function gulpSvgIndexFile({ src, dest, getComponentName = capitalizeFirstLetter }) {
21
21
  const folders = {};
22
22
  const getTail = (fullPath) => removeLeadingSlash(fullPath.replace(path.resolve(process.cwd(), src), ''));
23
23
  return createPipeTransformer({
@@ -46,7 +46,7 @@ export function gulpSvgIndexFile({ src, dest }) {
46
46
  {
47
47
  // index file for all
48
48
  const folderName = path.basename(folder);
49
- const componentName = capitalizeFirstLetter(folderName);
49
+ const componentName = getComponentName(folderName);
50
50
  imports.push(`export { default as ${componentName} } from './${folderName}';`);
51
51
  if (!indexFile) {
52
52
  indexFile = path.resolve(dest, getTail(path.dirname(folder)), 'index.tsx');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ft-gulp-icon-builder",
3
- "version": "1.0.1-preview-9dae167.0",
3
+ "version": "1.0.1-preview-de2b26f.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  ""
@@ -46,5 +46,5 @@
46
46
  "@types/vinyl": "2.0.12",
47
47
  "gulp-cli": "3.1.0"
48
48
  },
49
- "gitHead": "d9a5d712461f1d0375f1cda6fcfbaaf2c06a44c0"
49
+ "gitHead": "ca3fc38a43b7923ede61fa944295ad9ffe0c8d8c"
50
50
  }
@@ -7,6 +7,7 @@ import { getComponent } from './utils/index-template';
7
7
  type Params = {
8
8
  src: string;
9
9
  dest: string;
10
+ getComponentName?: (fileName: string) => string;
10
11
  };
11
12
 
12
13
  const capitalizeFirstLetter = (str: string): string => {
@@ -16,7 +17,7 @@ const capitalizeFirstLetter = (str: string): string => {
16
17
 
17
18
  const removeLeadingSlash = (str: string): string => str.replace(/^\/+/, '');
18
19
 
19
- export function gulpSvgIndexFile({ src, dest }: Params) {
20
+ export function gulpSvgIndexFile({ src, dest, getComponentName = capitalizeFirstLetter }: Params) {
20
21
  const folders: Record<string, string[]> = {};
21
22
 
22
23
  const getTail = (fullPath: string) => removeLeadingSlash(fullPath.replace(path.resolve(process.cwd(), src), ''));
@@ -53,7 +54,7 @@ export function gulpSvgIndexFile({ src, dest }: Params) {
53
54
  {
54
55
  // index file for all
55
56
  const folderName = path.basename(folder);
56
- const componentName = capitalizeFirstLetter(folderName);
57
+ const componentName = getComponentName(folderName);
57
58
  imports.push(`export { default as ${componentName} } from './${folderName}';`);
58
59
  if (!indexFile) {
59
60
  indexFile = path.resolve(dest, getTail(path.dirname(folder)), 'index.tsx');