It appears you have a well-structured Git repository with various files, including SVG icons and HTML documents. Here's a brief overview:
This commit is contained in:
26
backend/node_modules/read-pkg/index.js
generated
vendored
Normal file
26
backend/node_modules/read-pkg/index.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import fs, {promises as fsAsync} from 'fs';
|
||||
import path from 'path';
|
||||
import parseJson from 'parse-json';
|
||||
import normalizePackageData from 'normalize-package-data';
|
||||
|
||||
export async function readPackageAsync({cwd = process.cwd(), normalize = true} = {}) {
|
||||
const filePath = path.resolve(cwd, 'package.json');
|
||||
const json = parseJson(await fsAsync.readFile(filePath, 'utf8'));
|
||||
|
||||
if (normalize) {
|
||||
normalizePackageData(json);
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
export function readPackageSync({cwd = process.cwd(), normalize = true} = {}) {
|
||||
const filePath = path.resolve(cwd, 'package.json');
|
||||
const json = parseJson(fs.readFileSync(filePath, 'utf8'));
|
||||
|
||||
if (normalize) {
|
||||
normalizePackageData(json);
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
Reference in New Issue
Block a user