Skip to content

Commit

Permalink
add package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
kamijin-fanta committed Mar 6, 2019
1 parent d1c4df4 commit 74c63b4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
26 changes: 13 additions & 13 deletions packages/react-icons/.gitignore
@@ -1,16 +1,16 @@
# autogenerated
index.d.ts
index.mjs
all.mjs
all.d.ts
fa/
io/
md/
ti/
go/
fi/
gi/
wi/
di/
/index.d.ts
/index.mjs
/all.mjs
/all.d.ts
/fa/
/io/
/md/
/ti/
/go/
/fi/
/gi/
/wi/
/di/
README.md

2 changes: 1 addition & 1 deletion packages/react-icons/package.json
@@ -1,6 +1,6 @@
{
"name": "react-icons",
"version": "3.5.0",
"version": "3.6.0-beta1",
"description": "SVG React icons of popular icon packs using ES6 imports",
"author": "Goran Gajic",
"contributors": [
Expand Down
23 changes: 17 additions & 6 deletions packages/react-icons/scripts/build.js
Expand Up @@ -82,8 +82,7 @@ function generateIconRow(icon, formattedName, iconData, type = "module") {
`module.exports.${formattedName} = function (props) {\n` +
` return GenIcon(${JSON.stringify(iconData)})(props);\n` +
`};\n` +
`module.exports.${formattedName}.displayName = "${formattedName}"
;\n`
`module.exports.${formattedName}.displayName = "${formattedName}";\n`
);
case "dts":
return `export declare const ${formattedName}: IconType;\n`;
Expand Down Expand Up @@ -116,9 +115,11 @@ async function dirInit() {
const initFiles = ["index.d.ts", "index.mjs", "all.mjs", "all.d.ts"];

const gitignore =
["# autogenerated", ...initFiles, ...icons.map(icon => `${icon.id}/`)].join(
"\n"
) + "\nREADME.md\n\n";
[
"# autogenerated",
...initFiles.map(s => `/${s}`),
...icons.map(icon => `/${icon.id}/`)
].join("\n") + "\nREADME.md\n\n";
writeFile(path.resolve(DIST, ".gitignore"), gitignore);

for (const icon of icons) {
Expand All @@ -136,6 +137,17 @@ async function dirInit() {
[icon.id, "index.d.ts"],
"import { IconTree, IconType } from '../lib/iconBase'\n// THIS FILE IS AUTO GENERATED\n"
);
await write(
[icon.id, "package.json"],
JSON.stringify(
{
sideEffects: false,
module: "./index.mjs"
},
null,
2
) + "\n"
);
}

for (const file of initFiles) {
Expand Down Expand Up @@ -188,7 +200,6 @@ async function writeIconModule(icon) {
async function writeIconsManifest() {
const writeFile = promisify(fs.writeFile);
const copyFile = promisify(fs.copyFile);
const appendFile = promisify(fs.appendFile);

const writeObj = icons.map(icon => ({
id: icon.id,
Expand Down

0 comments on commit 74c63b4

Please sign in to comment.