Skip to content

Commit 0db1e65

Browse files
committed
Upgrade hint for existing ReScript projects
1 parent 5e70d3e commit 0db1e65

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed
File renamed without changes.
File renamed without changes.

src/ExistingRescriptProject.res

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module C = PicoColors
2+
module P = ClackPrompts
3+
4+
let showUpgradeHint = () =>
5+
P.note(
6+
~title="Already installed",
7+
~message=`ReScript is already installed in your project.
8+
9+
To upgrade to v11, check out the migration guide at
10+
${C.cyan("https://rescript-lang.org/docs/manual/latest/migrate-to-v11")}`,
11+
)

src/ExistingRescriptProject.resi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
let showUpgradeHint: unit => unit

src/Main.res

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ let run = async () => {
2828
P.note(
2929
~title="Welcome to ReScript!",
3030
~message=`${C.cyan("Fast, Simple, Fully Typed JavaScript from the Future")}
31-
https://www.rescript-lang.org`,
31+
https://rescript-lang.org`,
3232
)
3333

3434
let packageJsonPath = Path.join2(Process.cwd(), "package.json")
3535
let rescriptJsonPath = Path.join2(Process.cwd(), "rescript.json")
3636
let bsconfigJsonPath = Path.join2(Process.cwd(), "bsconfig.json")
3737

3838
if Fs.existsSync(rescriptJsonPath) || Fs.existsSync(bsconfigJsonPath) {
39-
P.outro("ReScript is already installed. No changes were made to your project.")
39+
ExistingRescriptProject.showUpgradeHint()
40+
P.outro("No changes were made to your project.")
4041
} else if Fs.existsSync(packageJsonPath) {
4142
let packageJson = await JsonUtils.readJsonFile(packageJsonPath)
4243
let projectName =
@@ -48,7 +49,7 @@ https://www.rescript-lang.org`,
4849

4950
if addToExistingProject {
5051
await handleError(~outro="Adding to project failed.", async () => {
51-
await ExistingProject.addToExistingProject(~projectName)
52+
await ExistingJsProject.addToExistingProject(~projectName)
5253
P.outro("Happy hacking!")
5354
})
5455
} else {

0 commit comments

Comments
 (0)