Skip to content

Commit

Permalink
fix: generate properties.js file
Browse files Browse the repository at this point in the history
  • Loading branch information
apasov committed Apr 7, 2020
1 parent ae0c1b1 commit 3728a08
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dist/animatable.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/animatable.js.map

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

17 changes: 17 additions & 0 deletions generate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const fs = require('fs')
const mdnProperties = JSON.parse(fs.readFileSync('node_modules/mdn-data/css/properties.json', 'utf8'))
const properties = ['export default [']
Object.keys(mdnProperties).forEach((key) => {
if (key.charAt(0) !== '-' && mdnProperties[key].animationType !== 'discrete') {
properties.push(`'${key}',`)
}
})
properties.push(']')

const stream = fs.createWriteStream('src/properties.js')
stream.once('open', () => {
properties.forEach((key) => {
stream.write(`${key}\n`)
})
stream.end()
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
"scripts": {
"build": "rollup -c",
"watch": "rollup -cw",
"gen": "node generate.js",
"test": "yarn fix && jest",
"fix": "yarn fix:eslint && yarn fix:prettier && yarn build",
"fix": "yarn gen && yarn fix:eslint && yarn fix:prettier && yarn build",
"fix:eslint": "eslint --fix \"**/*.*\"",
"fix:prettier": "prettier --write \"**/*.*\"",
"lint": "yarn lint:eslint && yarn lint:prettier",
Expand Down
Loading

0 comments on commit 3728a08

Please sign in to comment.