当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fs-extra.writeJSONSync函数代码示例

本文整理汇总了TypeScript中fs-extra.writeJSONSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript writeJSONSync函数的具体用法?TypeScript writeJSONSync怎么用?TypeScript writeJSONSync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了writeJSONSync函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: printLog

 creator.fs.commit(() => {
   const pkgObj = JSON.parse(fs.readFileSync(pkgPath).toString())
   pkgObj.dependencies['@tarojs/with-weapp'] = `^${version}`
   fs.writeJSONSync(pkgPath, pkgObj, {
     spaces: 2,
     EOL: '\n'
   })
   printLog(processTypeEnum.GENERATE, '文件', this.generateShowPath(path.join(configDir, 'index.js')))
   printLog(processTypeEnum.GENERATE, '文件', this.generateShowPath(path.join(configDir, 'dev.js')))
   printLog(processTypeEnum.GENERATE, '文件', this.generateShowPath(path.join(configDir, 'prod.js')))
   printLog(processTypeEnum.GENERATE, '文件', this.generateShowPath(pkgPath))
   printLog(processTypeEnum.GENERATE, '文件', this.generateShowPath(path.join(this.convertRoot, 'project.config.json')))
   printLog(processTypeEnum.GENERATE, '文件', this.generateShowPath(path.join(this.convertRoot, '.gitignore')))
   printLog(processTypeEnum.GENERATE, '文件', this.generateShowPath(path.join(this.convertRoot, '.editorconfig')))
   printLog(processTypeEnum.GENERATE, '文件', this.generateShowPath(path.join(this.convertRoot, '.eslintrc')))
   printLog(processTypeEnum.GENERATE, '文件', this.generateShowPath(path.join(this.convertDir, 'index.html')))
 })
开发者ID:YangShaoQun,项目名称:taro,代码行数:17,代码来源:index.ts

示例2: it

    it("updates tokens", function (done) {

        const user = {
            id: "api_testuser",
            token: "original-token",
            url: "https://api.sbgenomics.com",
            user: {username: "testuser"}
        };

        const initialData = {
            credentials: [user],
            activeCredentials: user
        };

        const repository       = new DataRepository(dir.name);
        const localProfilePath = repository.getProfileFilePath("local");
        fs.writeJSONSync(localProfilePath, initialData);

        repository.load(() => {

            const patch = {
                credentials: [
                    {...user, token: "updated-token"}
                ]
            };

            repository.updateLocal(patch, (err) => {
                if (err) {
                    return done(err);
                }

                setTimeout(() => {
                    const profile = fs.readJSONSync(localProfilePath);

                    assert.deepEqual(profile.credentials, patch.credentials);

                    done();
                }, 100);

            });
        });
    });
开发者ID:hmenager,项目名称:composer,代码行数:42,代码来源:data-repository.spec.ts

示例3:

});
fs.writeJSON(file, object).then(() => {
	// stub
});
fs.writeJson(file, object, errorCallback);
fs.writeJson(file, object, writeOptions, errorCallback);
fs.writeJSON(file, object, errorCallback);
fs.writeJSON(file, object, writeOptions, errorCallback);
fs.writeJson(file, object, writeOptions).then(() => {
	// stub
});
fs.writeJSON(file, object, writeOptions).then(() => {
	// stub
});
fs.writeJsonSync(file, object, writeOptions);
fs.writeJSONSync(file, object, writeOptions);

fs.ensureDir(path).then(() => {
	// stub
});
fs.ensureDir(path, errorCallback);
fs.ensureDirSync(path);

fs.ensureFile(path).then(() => {
	// stub
});
fs.ensureFile(path, errorCallback);
fs.ensureFileSync(path);
fs.ensureLink(path).then(() => {
	// stub
});
开发者ID:gilamran,项目名称:DefinitelyTyped,代码行数:31,代码来源:fs-extra-tests.ts

示例4: compilePluginJson

function compilePluginJson (pluginJson, pluginPath) {
  if (typeof pluginJson.main === 'string') {
    pluginJson.main = pluginJson.main.replace(/.tsx$/, '.js')
  }
  fs.writeJSONSync(pluginPath, pluginJson)
}
开发者ID:YangShaoQun,项目名称:taro,代码行数:6,代码来源:plugin.ts


注:本文中的fs-extra.writeJSONSync函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。