Skip to content

Commit

Permalink
fix(build): sync-ts-config script needs import assertion of type json
Browse files Browse the repository at this point in the history
Fixes #2163

Signed-off-by: aldousalvarez <aldousss.alvarez@gmail.com>
  • Loading branch information
aldousalvarez authored and petermetz committed Nov 19, 2022
1 parent b2742e8 commit aa936ec
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit aa936ec

Please sign in to comment.