How to use the hexo-fs.writeFileSync function in hexo-fs

To help you get started, we’ve selected a few hexo-fs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xbotao / hexo-admin-qiniu / api.js View on Github external
settings = getSettings()
    // create options section if it doesn't exist, ie. first time changing settings
    if (!settings.options) {
      settings.options = {}
    }

    settings.options[name] = value

    var addedOptions = addedOptsExist ? req.body.addedOptions : 'no additional options'
    if (addedOptsExist) {
      settings = deepAssign(settings, addedOptions)
    }
    hexo.log.d('set', name, '=', value, 'with', JSON.stringify(addedOptions))

    fs.writeFileSync(hexo.base_dir + '_admin-config.yml', yml.safeDump(settings))
    res.done({
      updated: 'Successfully updated ' + name + ' = ' + value,
      settings: settings
    })
  });
github Tencent / feflow / test / scripts / utils / yaml.js View on Github external
it('parseYaml() - path exists but no content', () => {
    if (fs.existsSync(testPath)) {
      fs.unlinkSync(testPath);
    }

    fs.writeFileSync(testPath, '', 'utf-8')

    expect(yaml.parseYaml(testPath)).to.be.equal(undefined);
  });
github hexojs / hexo / test / scripts / hexo / multi_config_path.js View on Github external
before(() => {
    fs.writeFileSync(base + 'test1.yml', testYaml1);
    fs.writeFileSync(base + 'test2.yml', testYaml2);
    fs.writeFileSync(base + 'test1.json', testJson1);
    fs.writeFileSync(base + 'test2.json', testJson2);
    fs.writeFileSync('/tmp/test3.json', testJson3);
  });
github hexojs / hexo / test / scripts / hexo / multi_config_path.js View on Github external
before(() => {
    fs.writeFileSync(base + 'test1.yml', testYaml1);
    fs.writeFileSync(base + 'test2.yml', testYaml2);
    fs.writeFileSync(base + 'test1.json', testJson1);
    fs.writeFileSync(base + 'test2.json', testJson2);
    fs.writeFileSync('/tmp/test3.json', testJson3);
  });
github tajpure / hexo-editor / models / editor.js View on Github external
save() {
    let path = this.post_dir + this.file;
    let source = this.getTitle() + this.getDate() + this.getTags() +
    this.getContent();
    fs.writeFileSync(path, source, ['utf8', '438', 'w']);
    console.log('This item ' + this.file + ' was saved!');
  }
github Tencent / feflow / lib / internal / deploy / deployer.js View on Github external
modifyDepsVersion(packagePath, arr) {
    const obj = require(packagePath);

    arr.map((item) => {
      obj.dependencies[item.plugin] = item.ltsVersion;
    });

    fs.writeFileSync(packagePath, JSON.stringify(obj, null, 4));
  }
github Tencent / feflow / lib / core / initClient.js View on Github external
return new Promise(function (resolve) {
      if (!fs.existsSync(pkgPath)) {
        fs.writeFileSync(pkgPath, JSON.stringify({
          "name": "feflow-home",
          "version": "0.0.0",
          "private": true
        }, null, 4));
      }

      log.debug('.feflow/package.json 文件已经创建');
      resolve(ctx);
    });
  }
github Tencent / feflow / lib / core / upgrade.js View on Github external
modifyDepsVersion(packagePath, arr) {
    const obj = require(packagePath);

    arr.map((item) => {
      obj.dependencies[item.plugin] = item.ltsVersion;
    });

    fs.writeFileSync(packagePath, JSON.stringify(obj, null, 4));
  }
github Tencent / feflow / lib / internal / generator / generator.js View on Github external
modifyDepsVersion(packagePath, arr) {
    const obj = require(packagePath);

    arr.map((item) => {
      obj.dependencies[item.plugin] = item.ltsVersion;
    });

    fs.writeFileSync(packagePath, JSON.stringify(obj, null, 4));
  }