alouette-icons 1.0.0-beta.1

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/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ # EditorConfig helps developers define and maintain consistent
2
+ # coding styles between different editors and IDEs
3
+ # http://editorconfig.org
4
+
5
+ root = true
6
+
7
+ [*]
8
+ indent_style = space
9
+ indent_size = 2
10
+ end_of_line = lf
11
+ charset = utf-8
12
+ trim_trailing_whitespace = true
13
+ insert_final_newline = true
package/.eslintrc.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "root": true,
3
+ "extends": ["@pob/eslint-config/root-module"],
4
+ "ignorePatterns": ["*.d.ts", "/dist"]
5
+ }
package/.yo-rc.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "pob": {
3
+ "lib": {
4
+ "documentation": false,
5
+ "testing": {}
6
+ },
7
+ "project": {
8
+ "type": "lib"
9
+ }
10
+ }
11
+ }
package/LICENSE ADDED
@@ -0,0 +1,2 @@
1
+ Copyright (c) 2024 Christophe Hurpeau <302891+christophehurpeau@users.noreply.github.com> (https://christophe.hurpeau.com)
2
+ All rights reserved.
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ <h3 align="center">
2
+ alouette-icons
3
+ </h3>
4
+
5
+ <p align="center">
6
+ icons for alouette
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://npmjs.org/package/alouette-icons"><img src="https://img.shields.io/npm/v/alouette-icons.svg?style=flat-square"></a>
11
+ <a href="https://npmjs.org/package/alouette-icons"><img src="https://img.shields.io/npm/dw/alouette-icons.svg?style=flat-square"></a>
12
+ <a href="https://npmjs.org/package/alouette-icons"><img src="https://img.shields.io/node/v/alouette-icons.svg?style=flat-square"></a>
13
+ <a href="https://npmjs.org/package/alouette-icons"><img src="https://img.shields.io/npm/types/alouette-icons.svg?style=flat-square"></a>
14
+ </p>
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ npm install --save alouette alouette-icons
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```tsx
25
+ import { Icon } from "alouette";
26
+ import { ArrowLeftRegularIcon } from "alouette-icons/phosphor-icons";
27
+
28
+ function Component() {
29
+ return <Icon icon={<ArrowLeftRegularIcon />} />;
30
+ }
31
+ ```
@@ -0,0 +1,21 @@
1
+ {
2
+ "root": true,
3
+ "extends": ["@pob/eslint-config/node-module"],
4
+ "overrides": [
5
+ {
6
+ "files": [
7
+ "**/*.test.{cjs,js}",
8
+ "__tests__/**/*.{cjs,js}",
9
+ "**/__mocks__/**/*.{cjs,js}"
10
+ ],
11
+ "rules": {
12
+ "import/no-extraneous-dependencies": [
13
+ "error",
14
+ {
15
+ "devDependencies": true
16
+ }
17
+ ]
18
+ }
19
+ }
20
+ ]
21
+ }
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "alouette-icons",
3
+ "version": "1.0.0-beta.1",
4
+ "description": "icons for alouette",
5
+ "author": "Christophe Hurpeau <302891+christophehurpeau@users.noreply.github.com> (https://christophe.hurpeau.com)",
6
+ "license": "UNLICENSED",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/christophehurpeau/alouette.git",
10
+ "directory": "packages/alouette-icons"
11
+ },
12
+ "homepage": "https://github.com/christophehurpeau/alouette",
13
+ "type": "module",
14
+ "engines": {
15
+ "node": ">=18.12.0"
16
+ },
17
+ "sideEffects": false,
18
+ "react-native": {
19
+ "./phosphor-icons": "./src/phosphor-icons.cjs"
20
+ },
21
+ "exports": {
22
+ "./package.json": "./package.json",
23
+ "./phosphor-icons": {
24
+ "types": "./src/phosphor-icons.ts",
25
+ "react-native": "./src/phosphor-icons.cjs",
26
+ "node": {
27
+ "import": "./dist/phosphor-icons-node18.mjs"
28
+ },
29
+ "browser": "./dist/phosphor-icons-browser.es.js"
30
+ }
31
+ },
32
+ "pob": {
33
+ "entries": [
34
+ "phosphor-icons"
35
+ ]
36
+ },
37
+ "prettier": "@pob/root/prettier-config",
38
+ "peerDependencies": {
39
+ "react": "^18.2.0",
40
+ "react-native": "*",
41
+ "react-native-svg": "*"
42
+ },
43
+ "dependencies": {
44
+ "@phosphor-icons/core": "2.0.8"
45
+ },
46
+ "devDependencies": {
47
+ "react-native": "0.73.6",
48
+ "typescript": "5.4.5"
49
+ }
50
+ }
@@ -0,0 +1 @@
1
+ // for eslint-plugin-import :/
@@ -0,0 +1,64 @@
1
+ import { copyFileSync, mkdirSync, rmdirSync, writeFileSync } from "node:fs";
2
+ import { dirname } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { icons } from "@phosphor-icons/core";
5
+
6
+ const phosphorAssetsPath = dirname(
7
+ dirname(
8
+ fileURLToPath(
9
+ await import.meta.resolve("@phosphor-icons/core/assets/regular/dot.svg"),
10
+ ),
11
+ ),
12
+ );
13
+
14
+ const assetsPath = fileURLToPath(
15
+ new URL("../phosphor-icons-assets", import.meta.url),
16
+ );
17
+
18
+ try {
19
+ rmdirSync(assetsPath, { recursive: true });
20
+ } catch {
21
+ console.warn("Could not remove assets directory");
22
+ }
23
+ mkdirSync(`${assetsPath}/regular`, { recursive: true });
24
+ mkdirSync(`${assetsPath}/fill`);
25
+
26
+ const header =
27
+ "// This file is generated automatically by scripts/generate-phosphor-icons.mjs\n\n";
28
+ let fileContent = `/* eslint-disable max-lines */\n${header}`;
29
+ let fileDTSContent = `${header}import * as React from 'react';
30
+
31
+ const SVGComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement> & { title?: string }>;
32
+ `;
33
+
34
+ icons.forEach((icon) => {
35
+ if (icon.name === "file-search") {
36
+ // alias for "file-magnifying-glass"
37
+ return;
38
+ }
39
+ copyFileSync(
40
+ new URL(`${phosphorAssetsPath}/regular/${icon.name}.svg`, import.meta.url),
41
+ `${assetsPath}/regular/${icon.name}.svg`,
42
+ );
43
+ copyFileSync(
44
+ new URL(
45
+ `${phosphorAssetsPath}/fill/${icon.name}-fill.svg`,
46
+ import.meta.url,
47
+ ),
48
+ `${assetsPath}/fill/${icon.name}-fill.svg`,
49
+ );
50
+
51
+ fileContent += `export { ReactComponent as ${icon.pascal_name}RegularIcon } from '../phosphor-icons-assets/regular/${icon.name}.svg';\n`;
52
+ fileContent += `export { ReactComponent as ${icon.pascal_name}FillIcon } from '../phosphor-icons-assets/fill/${icon.name}-fill.svg';\n`;
53
+ fileDTSContent += `declare const ${icon.pascal_name}RegularIcon = SVGComponent;\n`;
54
+ fileDTSContent += `declare const ${icon.pascal_name}FillIcon = SVGComponent;\n`;
55
+ });
56
+
57
+ writeFileSync(
58
+ new URL("../src/phosphor-icons.ts", import.meta.url),
59
+ fileContent,
60
+ );
61
+ writeFileSync(
62
+ new URL("../src/phosphor-icons.d.ts", import.meta.url),
63
+ fileDTSContent,
64
+ );
@@ -0,0 +1,52 @@
1
+ import { copyFileSync, writeFileSync } from "node:fs";
2
+ import { dirname } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { icons } from "@phosphor-icons/core";
5
+
6
+ const phosphorAssetsPath = dirname(
7
+ dirname(
8
+ fileURLToPath(
9
+ await import.meta.resolve("@phosphor-icons/core/assets/regular/dot.svg"),
10
+ ),
11
+ ),
12
+ );
13
+
14
+ const header =
15
+ "// This file is generated automatically by scripts/generate-phosphor-icons.mjs\n\n";
16
+ let fileContent = `/* prettier-ignore */\n${header}`;
17
+ let fileDTSContent = `${header}import * as React from 'react';
18
+
19
+ const SVGComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement> & { title?: string }>;
20
+ `;
21
+ let fileCJSForReactNativeContent = `/* prettier-ignore */\n${header}
22
+ module.exports = {
23
+ `;
24
+
25
+ icons.forEach((icon) => {
26
+ if (icon.name === "file-search") {
27
+ // alias for "file-magnifying-glass"
28
+ return;
29
+ }
30
+
31
+ fileContent += `export { ReactComponent as ${icon.pascal_name}RegularIcon } from '@phosphor-icons/core/assets/regular/${icon.name}.svg';\n`;
32
+ fileContent += `export { ReactComponent as ${icon.pascal_name}FillIcon } from '@phosphor-icons/core/assets/fill/${icon.name}-fill.svg';\n`;
33
+ fileDTSContent += `declare const ${icon.pascal_name}RegularIcon = SVGComponent;\n`;
34
+ fileDTSContent += `declare const ${icon.pascal_name}FillIcon = SVGComponent;\n`;
35
+ fileCJSForReactNativeContent += ` get ${icon.pascal_name}RegularIcon() { return require('@phosphor-icons/core/assets/regular/${icon.name}.svg').ReactComponent },\n`;
36
+ fileCJSForReactNativeContent += ` get ${icon.pascal_name}FillIcon() { return require('@phosphor-icons/core/assets/fill/${icon.name}-fill.svg').ReactComponent },\n`;
37
+ });
38
+
39
+ fileCJSForReactNativeContent += "};\n";
40
+
41
+ writeFileSync(
42
+ new URL("../src/phosphor-icons.ts", import.meta.url),
43
+ fileContent,
44
+ );
45
+ writeFileSync(
46
+ new URL("../src/phosphor-icons.cjs", import.meta.url),
47
+ fileCJSForReactNativeContent,
48
+ );
49
+ writeFileSync(
50
+ new URL("../src/phosphor-icons.d.ts", import.meta.url),
51
+ fileDTSContent,
52
+ );