Skip to content

Commit

Permalink
refactor(react-property): update build-injection to output .js
Browse files Browse the repository at this point in the history
The `.json` format leads to a larger file size due to the quotes
around the property keys.
  • Loading branch information
remarkablemark committed Jul 9, 2019
1 parent 7f2ae6c commit 0228d76
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/react-property/scripts/build-injection.js
@@ -1,7 +1,8 @@
const fs = require('fs');
const path = require('path');
const prettier = require('prettier');
const DOMProperty = require('react-dom/lib/DOMProperty');
const { LIB_DIR } = require('./constants');
const { LIB_DIR, PRETTIER_OPTIONS } = require('./constants');

/**
* Create output directory (if it doesn't exist).
Expand All @@ -13,6 +14,9 @@ try {
}

fs.writeFileSync(
path.resolve(LIB_DIR, 'injection.json'),
JSON.stringify(DOMProperty.injection)
path.resolve(LIB_DIR, 'injection.js'),
prettier.format(
'module.exports=' + JSON.stringify(DOMProperty.injection),
PRETTIER_OPTIONS
)
);

0 comments on commit 0228d76

Please sign in to comment.