Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): sync-ts-config script needs import assertion of type json #2164

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tools/sync-npm-deps-to-tsc-projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import JSON5 from "json5";
import fs from "fs-extra";
import { globby, Options as GlobbyOptions } from "globby";
import { RuntimeError } from "run-time-error";
import lernaJson from "../lerna.json";
import { readFile } from "fs/promises";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand All @@ -18,17 +18,21 @@ const main = async (argv: string[], env: NodeJS.ProcessEnv) => {
throw new RuntimeError(`Process env cannot be falsy.`);
}
const TS_CONFIG = "tsconfig.json";
const LERNA_JSON = "lerna.json";
const PACKAGE_JSON = "package.json";
const SCRIPT_DIR = __dirname;
const PROJECT_DIR = path.join(SCRIPT_DIR, "../");
console.log(`SCRIPT_DIR=${SCRIPT_DIR}`);
console.log(`PROJECT_DIR=${PROJECT_DIR}`);

const pkgJsonGlobPatterns = lernaJson.packages.map((it) =>
const lernaJsonStr = await readFile(PROJECT_DIR + LERNA_JSON, "utf-8");
const lernaJson = JSON.parse(lernaJsonStr);

const pkgJsonGlobPatterns = lernaJson.packages.map((it: string) =>
"./".concat(it).concat(`/${PACKAGE_JSON}`),
);

const tsConfigJsonGlobPatterns = lernaJson.packages.map((it) =>
const tsConfigJsonGlobPatterns = lernaJson.packages.map((it: string) =>
"./".concat(it).concat(`/${TS_CONFIG}`),
);
console.log("Globbing lerna package patterns: ", pkgJsonGlobPatterns);
Expand Down