How to use the readJSONSync function from fs-extra
Find comprehensive JavaScript fs-extra.readJSONSync code examples handpicked from public code repositorys.
66 67 68 69 70 71 72 73 74 75 76 77
//#region ------ uibuilder module-level globals ------ // /** @type {uibConfig} */ const uib = { me: fs.readJSONSync(path.join( __dirname, '..', 'package.json' )), moduleName: 'uibuilder', nodeRoot: '', deployments: {}, instances: {},
+ 12 other calls in file
GitHub: alexa/ask-cli
603 604 605 606 607 608 609 610 611 612
} }); it("| skill.json file does not exist, expect throw error message", () => { // setup fs.readJSONSync.returns(formSkillJson("skillManifest", {})); // call try { helper.attemptUpgradeUndeployedProject(TEST_ROOT_PATH, TEST_HIDDEN_NHS_CONFIG, TEST_PROFILE); } catch (e) {
+ 2 other calls in file
GitHub: o1-labs/zkapp-cli
88 89 90 91 92 93 94 95 96 97
ora(green(`UI: Set up project`)).succeed(); if (ui && ui !== 'empty') { // Add SnarkyJS as a dependency in the UI project. let pkgJson = fs.readJSONSync(path.join('ui', 'package.json')); // Add dependencies object if none is found in the package.json because generated // SvelteKit projects do not have dependencies included. if (!pkgJson.dependencies) pkgJson['dependencies'] = {}; pkgJson.dependencies.snarkyjs = '0.*';
+ 64 other calls in file
GitHub: zhangfisher/voerka-i18n
681 682 683 684 685 686 687 688 689 690
* @param {*} packageName */ function getInstalledPackageInfo(packageName,fields=[]){ try{ const packagePath = getProjectRootFolder(path.dirname(require.resolve(packageName))) const pkgInfo = fs.readJSONSync(path.join(packagePath,"package.json")) let results = { version: pkgInfo.version, path: packagePath, }
+ 3 other calls in file
GitHub: athombv/node-homey
687 688 689 690 691 692 693 694 695 696
`${path.join(this._homeyBuildPath, 'node_modules')}:/app/node_modules/:rw`, ...(linkModules.split(',') .filter(linkModule => !!linkModule) .map(linkModule => { const linkedModulePath = linkModule.trim(); const { name } = fse.readJSONSync(path.join(linkedModulePath, 'package.json')); return `${linkedModulePath}:/app/node_modules/${name}`; })), ], },
+ 5 other calls in file
GitHub: xl-vision/xl-vision
11 12 13 14 15 16 17 18 19 20
.map((it) => { const pkgPath = path.join(it, 'package.json'); const srcPath = path.join(it, 'src'); if (fs.pathExistsSync(pkgPath)) { return { name: fs.readJSONSync(pkgPath).name, path: srcPath, }; } return undefined;
+ 30 other calls in file
148 149 150 151 152 153 154 155 156 157 158
project_branch = shell.exec('git rev-parse --abbrev-ref HEAD').trim(); } const appPackagePath = '../../package.json'; if (fs.pathExistsSync(appPackagePath)) { const package = fs.readJSONSync('../../package.json'); project_version = package.version; } }
+ 25 other calls in file
GitHub: alexavil/DoppelBot
58 59 60 61 62 63 64 65 66 67 68 69 70
]; let activities = undefined; if (fs.existsSync("./activities.json")) { activities = fs.readJSONSync("./activities.json"); } const Sentry = require("@sentry/node");
+ 4 other calls in file
GitHub: impress-dev/HelloWorld
236 237 238 239 240 241 242 243 244 245
if (config.oauth[name]) { return await this.setOAuthProvider(name, config.oauth[name]); } if (fs.existsSync(`app/modules/oauth/${name}.json`)) { let action = fs.readJSONSync(`app/modules/oauth/${name}.json`); return await this.setOAuthProvider(name, action.options); } throw new Error(`Couldn't find oauth provider "${name}".`);
+ 11 other calls in file
1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270
async function main() { console.log("Downloading alternative add-ons data..."); gAlternativeData = await loadAlternativeData(); console.log('Generating reports...'); let extsJson = fs.readJSONSync(extsAllJsonFileName); let index = []; for (let group of groups) { index.push(`<h1><a name="group${group.id}"></a>${group.header}</h1>`); for (let [name, report] of Object.entries(reports)) {
+ 8 other calls in file
GitHub: lbuchman/M1Combined
49 50 51 52 53 54 55 56 57 58
await azureOp.downloadFile(blobSvc, firmwareContainer, 'manifestFile.json', path.join(dir, 'tmp', 'manifestFile.json')); const newManifestFile = fs.readJSONSync(path.join(dir, 'tmp', 'manifestFile.json')); let localManifestFile; try { if (options.force) throw Error('force'); localManifestFile = fs.readJSONSync(path.join(dir, 'tmp', 'manifestFileLocal.json')); } catch (err) { localManifestFile = []; }
+ 47 other calls in file
GitHub: ReturnTypeVoid/dae
17 18 19 20 21 22 23 24 25 26 27
function getConfig() { const configPath = path.resolve(process.cwd(), 'foundryconfig.json'); let config; if (fs.existsSync(configPath)) { config = fs.readJSONSync(configPath); return config; } else { return; }
+ 4 other calls in file
120 121 122 123 124 125 126 127 128 129 130
(async () => { // 准备数据 for (const langShort in langList) { const dataURL = data[langShort]; for (const key in dataURL) { dataURL[key] = process.env.UPDATE_SOURCE === 'local' ? Fse.readJSONSync(dataURL[key]) : await get(dataURL[key]); } } // 写入数据
+ 4 other calls in file
GitHub: Shenfq/gas-reader
20 21 22 23 24 25 26 27 28 29
} return } let result = {} if (fs.existsSync(dataFile)) { result = fs.readJSONSync(dataFile) } // const { city, brand, company } = current const brands = Object.keys(result)
+ 9 other calls in file
GitHub: nstra9x/herond-core
792 793 794 795 796 797 798 799 800 801
readJSON: (file, default_value = undefined) => { if (!fs.existsSync(file)) { return default_value } return fs.readJSONSync(file) }, writeJSON: (file, value) => { return fs.writeJSONSync(file, value, {spaces: 2})
+ 5 other calls in file
GitHub: astrocean/taro-cli-2.0.6
370 371 372 373 374 375 376 377 378 379
function getInstalledNpmPkgVersion(pkgName, basedir) { const pkgPath = getInstalledNpmPkgPath(pkgName, basedir); if (!pkgPath) { return null; } return fs.readJSONSync(pkgPath).version; } exports.getInstalledNpmPkgVersion = getInstalledNpmPkgVersion; function isQuickappPkg(name, quickappPkgs = []) { const isQuickappPkg = /^@(system|service)\.[a-zA-Z]{1,}/.test(name);
+ 13 other calls in file
fs-extra.readFileSync is the most popular function in fs-extra (9724 examples)