Skip to content

Commit 8007232

Browse files
committed
Add sample to test repo
1 parent 8779e66 commit 8007232

File tree

7 files changed

+65
-4
lines changed

7 files changed

+65
-4
lines changed

rewatch/testrepo/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"packages/file-casing-no-namespace",
1717
"packages/pure-dev",
1818
"packages/with-ppx",
19-
"packages/nohoist"
19+
"packages/nohoist",
20+
"packages/standalone"
2021
],
2122
"nohoist": [
2223
"rescript-bun"
@@ -26,11 +27,11 @@
2627
"rescript": "12.0.0-beta.1"
2728
},
2829
"scripts": {
29-
"build": "../target/release/rewatch build .",
30+
"build": "../target/release/rescript build .",
3031
"build:rescript": "rescript legacy build",
31-
"watch": "../target/release/rewatch watch .",
32+
"watch": "../target/release/rescript watch .",
3233
"watch:rescript": "rescript legacy watch",
33-
"clean": "../target/release/rewatch clean .",
34+
"clean": "../target/release/rescript clean .",
3435
"clean:rescript": "rescript clean"
3536
}
3637
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "@testrepo/standalone",
3+
"version": "1.0.0",
4+
"dependencies": {
5+
"@testrepo/dep01": "*"
6+
}
7+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "standalone",
3+
"sources": {
4+
"dir": "src",
5+
"subdirs": true
6+
},
7+
"package-specs": {
8+
"module": "es6",
9+
"in-source": true
10+
},
11+
"suffix": ".mjs",
12+
"dependencies": ["@testrepo/dep01"]
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
import * as Dep01 from "@testrepo/dep01/src/Dep01.mjs";
4+
5+
function standalone() {
6+
Dep01.log();
7+
console.log("standalone");
8+
}
9+
10+
export {
11+
standalone,
12+
}
13+
/* Dep01 Not a pure module */
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let standalone = () => {
2+
Dep01.log()
3+
Js.log("standalone")
4+
}

rewatch/testrepo/yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ __metadata:
164164
languageName: unknown
165165
linkType: soft
166166

167+
"@testrepo/standalone@workspace:packages/standalone":
168+
version: 0.0.0-use.local
169+
resolution: "@testrepo/standalone@workspace:packages/standalone"
170+
dependencies:
171+
"@testrepo/dep01": "npm:*"
172+
languageName: unknown
173+
linkType: soft
174+
167175
"@testrepo/with-dev-deps@workspace:packages/with-dev-deps":
168176
version: 0.0.0-use.local
169177
resolution: "@testrepo/with-dev-deps@workspace:packages/with-dev-deps"

rewatch/tests/compile.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ else
3434
exit 1
3535
fi
3636

37+
# Build from standalone package folder using `rescript build`
38+
bold "Test: Standalone package can build via rescript from package folder"
39+
pushd ./packages/standalone > /dev/null
40+
error_output=$(rescript build 2>&1)
41+
if [ $? -eq 0 ];
42+
then
43+
success "Standalone package built"
44+
else
45+
error "Error building standalone package"
46+
printf "%s\n" "$error_output" >&2
47+
popd > /dev/null
48+
exit 1
49+
fi
50+
popd > /dev/null
51+
3752
node ./packages/main/src/Main.mjs > ./packages/main/src/output.txt
3853

3954
mv ./packages/main/src/Main.res ./packages/main/src/Main2.res

0 commit comments

Comments
 (0)