Skip to content

Commit

Permalink
set remix version
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <[email protected]>
  • Loading branch information
mcansh committed Jan 28, 2023
1 parent 068b61d commit b50347d
Showing 1 changed file with 40 additions and 13 deletions.
53 changes: 40 additions & 13 deletions __scripts/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ if (process.env.CI) {

examples = [...new Set(dirs)].filter((d) => !TO_IGNORE.includes(d));
} else {
examples = await fse.readdir(process.cwd());
examples = examples.filter((d) => !TO_IGNORE.includes(d));
const entries = await fse.readdir(process.cwd(), { withFileTypes: true });
examples = entries
.filter((entry) => entry.isDirectory())
.filter((d) => !TO_IGNORE.includes(d));
}

const list = new Intl.ListFormat("en", { style: "long", type: "conjunction" });
Expand All @@ -41,6 +43,29 @@ const settled = await Promise.allSettled(
examples.map(async (example) => {
const pkgJson = await PackageJson.load(example);

const remixDeps = Object.keys(pkgJson.content.dependencies).filter((d) => {
return d.startsWith("@remix-run/");
});

const remixDevDeps = Object.keys(pkgJson.content.devDependencies).filter(
(d) => {
return d.startsWith("@remix-run/");
}
);

pkgJson.update({
dependencies: {
...pkgJson.content.dependencies,
...Object.fromEntries(remixDeps.map((d) => [d, `latest`])),
},
devDependencies: {
...pkgJson.content.devDependencies,
...Object.fromEntries(remixDevDeps.map((d) => [d, `latest`])),
},
});

await pkgJson.save();

/** @type {import('execa').Options} */
const options = { cwd: example };

Expand Down Expand Up @@ -89,17 +114,6 @@ const settled = await Promise.allSettled(
return;
}

if (!("typecheck" in pkgJson.content.scripts)) {
pkgJson.update({
scripts: {
...pkgJson.content.scripts,
typecheck: "tsc --skipLibCheck",
},
});

await pkgJson.save();
}

const typecheck = await getCommand(detected, "run", ["typecheck"]);
const typecheckArgs = typecheck.split(" ").slice(1);
console.log(
Expand All @@ -112,6 +126,19 @@ const settled = await Promise.allSettled(
console.error(typecheckResult.stderr);
return;
}

pkgJson.update({
dependencies: {
...pkgJson.content.dependencies,
...Object.fromEntries(remixDeps.map((d) => [d, `*`])),
},
devDependencies: {
...pkgJson.content.devDependencies,
...Object.fromEntries(remixDevDeps.map((d) => [d, `*`])),
},
});

await pkgJson.save();
})
);

Expand Down

0 comments on commit b50347d

Please sign in to comment.