Skip to content

Commit 8c7aa75

Browse files
committed
Patch sources a bit when using Core
1 parent d92182b commit 8c7aa75

File tree

3 files changed

+151
-2
lines changed

3 files changed

+151
-2
lines changed

index.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import fs from "fs";
66
import { fileURLToPath } from "url";
77
import { exec } from "child_process";
88
import { promisify } from "util";
9+
import { glob } from "glob";
910
import c from "picocolors";
1011

1112
const rescriptVersion = "10.1";
@@ -85,6 +86,15 @@ async function updateBsconfigJson(projectName, withCore) {
8586
});
8687
}
8788

89+
async function coreify() {
90+
const resFiles = await glob("src/**/*.res");
91+
for (const resFile of resFiles) {
92+
await updateFile(resFile, contents =>
93+
contents.replace("Js.log", "Console.log").replace("string_of_int", "Int.toString")
94+
);
95+
}
96+
}
97+
8898
function getVersion() {
8999
const packageJsonPath = path.join(__dirname, "package.json");
90100
const contents = fs.readFileSync(packageJsonPath, "utf8");
@@ -131,6 +141,7 @@ async function main() {
131141

132142
await updatePackageJson(projectName);
133143
await updateBsconfigJson(projectName, withCore);
144+
await coreify();
134145

135146
const packages = [`rescript@${rescriptVersion}`];
136147
if (withCore) {

package-lock.json

Lines changed: 138 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"templates"
1818
],
1919
"dependencies": {
20-
"@clack/prompts": "^0.6.0"
20+
"@clack/prompts": "^0.6.0",
21+
"glob": "^9.2.1"
2122
},
2223
"repository": {
2324
"type": "git",

0 commit comments

Comments
 (0)