@cypress-design/vue-icon 0.2.0 → 0.3.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/generate-icons.js CHANGED
@@ -1,25 +1,25 @@
1
- const path = require('path');
2
- const dedent = require('dedent');
3
- const { promises: fs } = require('fs');
4
- const camelcase = require('camelcase');
5
- const { iconsMetadata, iconSet } = require('@cypress-design/icon-registry');
1
+ const path = require('path')
2
+ const dedent = require('dedent')
3
+ const { promises: fs } = require('fs')
4
+ const camelcase = require('camelcase')
5
+ const { iconsMetadata, iconSet } = require('@cypress-design/icon-registry')
6
6
 
7
7
  const iconsComponents = Object.keys(iconsMetadata).map((name) => {
8
- const pascalCaseName = camelcase(name, { pascalCase: true });
9
- const iconMetadata = iconsMetadata[name];
8
+ const pascalCaseName = camelcase(name, { pascalCase: true })
9
+ const iconMetadata = iconsMetadata[name]
10
10
  const availableIds = iconMetadata.availableSizes.map(
11
11
  (size) => `${camelcase(name)}X${size}`
12
- );
12
+ )
13
13
 
14
14
  const iconBodies = iconSet.reduce((acc, icon) => {
15
- const sizeIndex = availableIds.indexOf(icon.name);
15
+ const sizeIndex = availableIds.indexOf(icon.name)
16
16
  if (sizeIndex > -1) {
17
- acc[iconMetadata.availableSizes[sizeIndex]] = icon.data;
17
+ acc[iconMetadata.availableSizes[sizeIndex]] = icon.data
18
18
  }
19
- return acc;
20
- }, {});
19
+ return acc
20
+ }, {})
21
21
  return dedent`
22
- export const Icon${pascalCaseName} = (props: Omit<iconsRegistry.Icon${pascalCaseName}Props, 'name'>) => {
22
+ export const Icon${pascalCaseName} = (props: SVGAttributes & Omit<iconsRegistry.Icon${pascalCaseName}Props, 'name'>) => {
23
23
  const { sizeWithDefault: size, compiledClasses } = iconsRegistry.getComponentAttributes({ ...(props as any), availableSizes: ${JSON.stringify(
24
24
  iconMetadata.availableSizes
25
25
  )} })
@@ -39,21 +39,21 @@ const iconsComponents = Object.keys(iconsMetadata).map((name) => {
39
39
  compiledClasses
40
40
  }))
41
41
  }
42
- `;
43
- });
42
+ `
43
+ })
44
44
 
45
45
  writeFile(`
46
46
  import * as iconsRegistry from '@cypress-design/icon-registry'
47
47
  import { compileVueIconProperties } from './Icon'
48
- import { h } from 'vue'
48
+ import { h, type SVGAttributes } from 'vue'
49
49
 
50
50
  ${iconsComponents.join('\n\n\n')}
51
- `);
51
+ `)
52
52
 
53
53
  async function writeFile(fileContents) {
54
54
  await fs.writeFile(
55
55
  path.resolve(__dirname, './TreeShakableIcons.ts'),
56
56
  fileContents,
57
57
  'utf-8'
58
- );
58
+ )
59
59
  }
package/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { iconsMetadata } from '@cypress-design/icon-registry';
2
- export type { WindiColor } from '@cypress-design/icon-registry';
3
- export { default } from './Icon';
4
- export * from './TreeShakableIcons';
1
+ import type { iconsMetadata } from '@cypress-design/icon-registry'
2
+ export type { WindiColor } from '@cypress-design/icon-registry'
3
+ export { default } from './Icon'
4
+ export * from './TreeShakableIcons'
5
5
 
6
- export type IconId = keyof typeof iconsMetadata;
6
+ export type IconId = keyof typeof iconsMetadata
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress-design/vue-icon",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "files": [
5
5
  "*"
6
6
  ],
@@ -20,11 +20,11 @@
20
20
  "build:types": "yarn vue-tsc --project ./tsconfig.build.json"
21
21
  },
22
22
  "dependencies": {
23
- "@cypress-design/icon-registry": "^0.2.0"
23
+ "@cypress-design/icon-registry": "^0.3.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "camelcase": "^6.3.0",
27
27
  "dedent": "^0.7.0"
28
28
  },
29
29
  "license": "MIT"
30
- }
30
+ }
@@ -2,6 +2,6 @@
2
2
  "extends": "../../../tsconfig.vue.json",
3
3
  "include": ["./*.vue", "./index.ts"],
4
4
  "compilerOptions": {
5
- "outDir": "dist",
5
+ "outDir": "dist"
6
6
  }
7
7
  }
package/vite.config.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as path from 'path';
2
- import generateViteConfig from '../../root.vite.config';
1
+ import * as path from 'path'
2
+ import generateViteConfig from '../../root.vite.config'
3
3
 
4
4
  export default generateViteConfig({
5
5
  entry: path.resolve(__dirname, './index.ts'),
6
6
  name: 'Icon',
7
- });
7
+ })
package/Icon.cy.tsx DELETED
@@ -1,8 +0,0 @@
1
- import { IconObjectBookCode } from './index'
2
- import { mount } from 'cypress/vue';
3
-
4
- describe('Icon', () => {
5
- it('renders correctly', () => {
6
- mount(() => <IconObjectBookCode fillColor="red-100" strokeColor="red-500" secondaryFillColor="indigo-100" secondaryStrokeColor="indigo-600"/>)
7
- })
8
- })