Skip to content

Commit

Permalink
Merge pull request #19 from MKAbuMattar/dev-ts
Browse files Browse the repository at this point in the history
Dev ts
  • Loading branch information
MKAbuMattar authored Mar 30, 2022
2 parents cb8c976 + 476cc21 commit 25a932d
Show file tree
Hide file tree
Showing 2,869 changed files with 56,626 additions and 78,854 deletions.
10 changes: 3 additions & 7 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": "defaults"
}
],
"@babel/preset-react"
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
]
}
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ yarn-error.log*
**/public/fallback-*.js


generate/tmp-data.json
generate/tmp.data.json

lib

Expand All @@ -54,4 +54,8 @@ lib

generate/build.config.json

*.tgz
*.tgz

dist

bundle.analysis.html
12 changes: 3 additions & 9 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials"
]
}
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
}
4 changes: 2 additions & 2 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<img src="https://raw.githubusercontent.com/MKAbuMattar/devicons-react/main/docs/assets/img/logo.png" alt="Devicon Logo" height="140" />
</a>
<p align="center">
devicons-react aims to gather all logos representing development languages and tools, build into <a href="https://github.com/devicons/devicon">devicon</a>
Devicons React is a collection of icons that symbolize programming languages, design tools, and development software, build into <a href="https://github.com/devicons/devicon">devicon</a>
</p>
<p align="center">
<a target="__blank" href="https://devicons-react.vercel.app/">Demo</a>
Expand Down
18 changes: 9 additions & 9 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": "next lint"
},
"dependencies": {
"devicons-react": "^1.1.4",
"devicons-react": "^1.1.9",
"highlight.js": "^11.5.0",
"next": "12.1.1",
"next-pwa": "^5.4.6",
Expand Down
22 changes: 0 additions & 22 deletions generate/generate-data.js

This file was deleted.

22 changes: 22 additions & 0 deletions generate/generate.data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const testFolder = './src/icons'
const fs = require('fs')
const path = require('path')

let name
let componentName
let fileName
let obj = {}
const data = []

fs.readdirSync(testFolder).forEach((file) => {
name = file
.replace(/([A-Z])/g, ' $1')
.trim()
.replace('.tsx', '')
componentName = file.replace('.tsx', '')
fileName = `devicons-react/icons/${file.replace('.tsx', '')}`
obj = { name: name, componentName: componentName, fileName: fileName }
data.push(obj)
})

fs.writeFileSync(path.resolve(__dirname, 'tmp.data.json'), JSON.stringify(data))
26 changes: 26 additions & 0 deletions generate/utils/build.util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable import/prefer-default-export */
const fs = require('fs')

export const getFiles = (entry, extensions = [], excludeExtensions = []) => {
let fileNames = []
const dirs = fs.readdirSync(entry)

dirs.forEach((dir) => {
const path = `${entry}/${dir}`

if (fs.lstatSync(path).isDirectory()) {
fileNames = [...fileNames, ...getFiles(path, extensions, excludeExtensions)]

return
}

if (
!excludeExtensions.some((exclude) => dir.endsWith(exclude)) &&
extensions.some((ext) => dir.endsWith(ext))
) {
fileNames.push(path)
}
})

return fileNames
}
2 changes: 1 addition & 1 deletion index-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function defaultIndexTemplate(filePaths) {
const exportName = /^\d/.test(basename) ? `Svg${basename}` : basename
return `export { default as ${exportName} } from './icons/${basename}'`
})
fs.writeFileSync(path.resolve(__dirname, 'src/index.js'), exportEntries.join('\n'))
fs.writeFileSync(path.resolve(__dirname, 'src/index.ts'), exportEntries.join('\n'))
return exportEntries.join('\n')
}

Expand Down
Loading

1 comment on commit 25a932d

@vercel
Copy link

@vercel vercel bot commented on 25a932d Mar 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.