Replace how he retreive the package.json
MODIFY
bin-src/main.ts
bin-src/main.ts
@@ -2,6 +2,7 @@ import jsonfile from 'jsonfile';
import Listr from 'listr';
import pkgUp from 'pkg-up';
import { v4 as uuid } from 'uuid';
+import readPkgUp from 'read-pkg-up';
import GraphQLClient from './io/GraphQLClient';
import HTTPClient from './io/HTTPClient';
@@ -34,13 +35,13 @@ export async function main(argv: string[]) {
const env = getEnv();
const log = createLogger(sessionId, env);
- const packagePath = await pkgUp(); // the user's own package.json
- if (!packagePath) {
+ const pkgInfo = readPkgUp.sync({ cwd: process.cwd() });
+ if (!pkgInfo) {
log.error(noPackageJson());
process.exit(253);
}
- const packageJson: { [key: string]: any } = await readFile(packagePath);
+ const { path: packagePath, packageJson } = pkgInfo;
if (typeof packageJson !== 'object' || typeof packageJson.scripts !== 'object') {
log.error(invalidPackageJson(packagePath));
process.exit(252);

MODIFY
package.json
package.json
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
+ "read-pkg-up": "^7.0.1",
"semver": "^7.3.5",
"slash": "^3.0.0",
"sort-package-json": "1.50.0",

Replace how he retreive the package.json