This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// from https://github.com/jameswomack/replace-require-with-import/blob/master/index.js | |
// changes: support importing files with a `@` in their names, support require with multiple keys `{ funcA, funcB }` | |
// usage: `node ./require-to-import.js ./src/**/*.ts` | |
const FS = require('fs') | |
const globby = require('globby') | |
const r1 = /^(let|var|const) +([a-zA-Z_$][a-zA-Z0-9_$]*) +\= +(require)\((('|")[@a-zA-Z0-9-_.\/]+('|"))\)/gm // const createStore = require('redux') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instructions: | |
// npm install --save d3 jsdom | |
const fs = require('fs'); | |
const d3 = require('d3'); | |
const jsdom = require('jsdom'); | |
const { JSDOM } = jsdom; | |
const fakeDom = new JSDOM('<!DOCTYPE html><html><body></body></html>'); |