You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
375 B

4 years ago
  1. 'use strict'
  2. const fs = require('graceful-fs')
  3. const path = require('path')
  4. const mkdir = require('../mkdirs')
  5. const jsonFile = require('./jsonfile')
  6. function outputJsonSync (file, data, options) {
  7. const dir = path.dirname(file)
  8. if (!fs.existsSync(dir)) {
  9. mkdir.mkdirsSync(dir)
  10. }
  11. jsonFile.writeJsonSync(file, data, options)
  12. }
  13. module.exports = outputJsonSync