當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。