Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ On 'package.json' set:
}
```

## npm update
```
npm install [package-name]@[version] --save-dev
npm uninstall <package_name>

npm audit --audit-level=high
npm audit fix

npm outdated
```

For CHANGELOG refer [here][changelog].


Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
],
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-runtime',
['css-modules-transform', cssModulesConfig],
Expand Down
16 changes: 7 additions & 9 deletions bin/build/icons/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ const optimizeOne = ({ data: source, ...meta }, options) => {
const svgo =
typeof options.optimize == 'function' ? options : new SVGO(options)

return new Promise((resolve, reject) => {
svgo.optimize(source).then((result) => {
resolve({
...meta,
...result.info,
data: result.data,
})
}, reject)
return new Promise((resolve) => {
const result = svgo.optimize(source)
return resolve({
...meta,
...result.info,
data: result.data,
})
})
}

Expand Down Expand Up @@ -85,7 +84,6 @@ const run = async () => {
plugins: {
...config.svgo.plugins,
removeUselessDefs: false,
cleanupIDs: false,
},
})

Expand Down
23 changes: 14 additions & 9 deletions bin/build/icons/svgo.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
const SVGO = require('svgo')
// eslint-disable-next-line import/no-unresolved
const { optimize } = require('svgo')

const processOptions = (options = {}) => {
const plugins = Object.entries(options.plugins).map(([name, flag]) => ({
[name]: flag,
const plugins = Object.entries(options.plugins || {}).map(([name, flag]) => ({
name,
active: flag,
}))
return { ...options, plugins }
}

const MySVGO = function MySVGO(options) {
SVGO.call(this, processOptions(options))
function MySVGO(options = {}) {
this.options = processOptions(options)
}

MySVGO.prototype = Object.create(SVGO.prototype)
MySVGO.prototype.constructor = MySVGO

MySVGO.Config = (options) => SVGO.Config(processOptions(options))
// eslint-disable-next-line func-names
MySVGO.prototype.optimize = function (svgString, info = {}) {
return optimize(svgString, {
...this.options,
path: info.path,
})
}

module.exports = MySVGO
24 changes: 24 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { defineConfig } from "eslint/config";
import eslintConfigReact from "@oacore/eslint-config-react"
import reactPlugin from 'eslint-plugin-react'

export default defineConfig([
{
files: ['**/*.js', '**/*.jsx', '.js','.jsx'],
ignores: [
'.idea/**',
'node_modules/**',
'public/**',
'lib/**',
'**/dist/**',
'**/build/**',
'**/*.min.js'
],
plugins: {
react: reactPlugin,
},
rules: {
... eslintConfigReact.rules,
}
},
]);
Loading
Loading