Files
cypress/scripts/add_newlines_to_snapshots.js
T
renovate[bot] eab801ae3f chore(deps): Update dependency eslint to version 6.8.0 🌟 (#6509)
* chore(deps): Update eslint to 6.8.0 🌟

* fix missing dangling commas for linter

* fix missing dangling commas for linter

* more lint fixes

* yarn lock

Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2020-02-25 00:09:47 +06:30

27 lines
607 B
JavaScript

const fs = require('fs-extra')
const glob = require('glob')
const Promise = require('bluebird')
const globAsync = Promise.promisify(glob)
const endingNewLines = /\s+$/g
const contentBetweenBackticksRe = /\`([\s\S]+?)\`/g
globAsync('packages/server/__snapshots__/*')
.map((file) => {
return fs.readFile(file, 'utf8')
.then((str) => {
return str
.replace(
contentBetweenBackticksRe,
'`\n$1\n`',
)
.split('`\n\n\n').join('`\n\n')
.split('\n\n\n\n`').join('\n\n\n`')
.split(endingNewLines).join('\n')
})
.then((str) => {
return fs.writeFile(file, str)
})
})