Skip to content

Commit 3f91613

Browse files
committed
fix: install purescript with npm
1 parent 9f225d0 commit 3f91613

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/lib.rs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ pub fn setup(version: String) -> FnResult<String> {
2020

2121
let stdout = dag()
2222
.pkgx()?
23+
.with_exec(vec!["bun", "install", "-g", "spago"])?
24+
.with_exec(vec!["type npm || pkgx install npmjs.com"])?
2325
.with_exec(vec![
24-
"bun",
26+
"npm",
2527
"install",
2628
"-g",
27-
"spago",
2829
&format!("purescript@{}", version),
2930
])?
3031
.stdout()?;
@@ -39,8 +40,12 @@ pub fn build(args: String) -> FnResult<String> {
3940
"setup",
4041
vec!["latest"],
4142
)?;
43+
4244
let stdout = dag()
4345
.pkgx()?
46+
.with_exec(vec![
47+
"type purs > /dev/null 2>&1 || pkgx npm install -g purescript",
48+
])?
4449
.with_exec(vec!["bunx", "spago", "build", &args])?
4550
.stdout()?;
4651
Ok(stdout)
@@ -55,6 +60,9 @@ pub fn test(args: String) -> FnResult<String> {
5560
)?;
5661
let stdout = dag()
5762
.pkgx()?
63+
.with_exec(vec![
64+
"type purs > /dev/null 2>&1 || pkgx npm install -g purescript",
65+
])?
5866
.with_exec(vec!["bunx", "spago", "test", &args])?
5967
.stdout()?;
6068
Ok(stdout)
@@ -69,6 +77,9 @@ pub fn bundle_app(args: String) -> FnResult<String> {
6977
)?;
7078
let stdout = dag()
7179
.pkgx()?
80+
.with_exec(vec![
81+
"type purs > /dev/null 2>&1 || pkgx npm install -g purescript",
82+
])?
7283
.with_exec(vec!["bunx", "spago", "bundle-app", &args])?
7384
.stdout()?;
7485
Ok(stdout)
@@ -83,6 +94,9 @@ pub fn bundle_module(args: String) -> FnResult<String> {
8394
)?;
8495
let stdout = dag()
8596
.pkgx()?
97+
.with_exec(vec![
98+
"type purs > /dev/null 2>&1 || pkgx npm install -g purescript",
99+
])?
86100
.with_exec(vec!["bunx", "spago", "bundle-module", &args])?
87101
.stdout()?;
88102
Ok(stdout)
@@ -97,6 +111,9 @@ pub fn docs(args: String) -> FnResult<String> {
97111
)?;
98112
let stdout = dag()
99113
.pkgx()?
114+
.with_exec(vec![
115+
"type purs > /dev/null 2>&1 || pkgx npm install -g purescript",
116+
])?
100117
.with_exec(vec!["bunx", "spago", "docs", &args])?
101118
.stdout()?;
102119
Ok(stdout)
@@ -111,6 +128,9 @@ pub fn install(args: String) -> FnResult<String> {
111128
)?;
112129
let stdout = dag()
113130
.pkgx()?
131+
.with_exec(vec![
132+
"type purs > /dev/null 2>&1 || pkgx npm install -g purescript",
133+
])?
114134
.with_exec(vec!["bunx", "spago", "install", &args])?
115135
.stdout()?;
116136
Ok(stdout)
@@ -125,6 +145,9 @@ pub fn verify(args: String) -> FnResult<String> {
125145
)?;
126146
let stdout = dag()
127147
.pkgx()?
148+
.with_exec(vec![
149+
"type purs > /dev/null 2>&1 || pkgx npm install -g purescript",
150+
])?
128151
.with_exec(vec!["bunx", "spago", "verify", &args])?
129152
.stdout()?;
130153
Ok(stdout)
@@ -139,6 +162,9 @@ pub fn verify_set(args: String) -> FnResult<String> {
139162
)?;
140163
let stdout = dag()
141164
.pkgx()?
165+
.with_exec(vec![
166+
"type purs > /dev/null 2>&1 || pkgx npm install -g purescript",
167+
])?
142168
.with_exec(vec!["bunx", "spago", "verify-set", &args])?
143169
.stdout()?;
144170
Ok(stdout)
@@ -153,6 +179,9 @@ pub fn bump_version(args: String) -> FnResult<String> {
153179
)?;
154180
let stdout = dag()
155181
.pkgx()?
182+
.with_exec(vec![
183+
"type purs > /dev/null 2>&1 || pkgx npm install -g purescript",
184+
])?
156185
.with_exec(vec!["bunx", "spago", "bump-version", &args])?
157186
.stdout()?;
158187
Ok(stdout)

0 commit comments

Comments
 (0)