@@ -111,18 +111,27 @@ let buildLibraryTs() =
111111 runInDir buildDirTs ( " npx tsc --outDir ../../" + buildDirJs)
112112
113113let quicktest () =
114- runFableWithArgs " src/quicktest" [ " --exclude Fable.Core" ]
114+ runFableWithArgs " src/quicktest" [
115+ " --force-pkgs"
116+ " --exclude Fable.Core"
117+ ]
115118 run " npx tsc src/quicktest/QuickTest.fs.js --allowJs -m commonJs --outDir build/quicktest"
116119 run " node build/quicktest/src/quicktest/QuickTest.fs.js"
117120
118- let buildCompilerJs () =
119- let projectDir = " src/fable-compiler-js"
120- cleanDirs [ projectDir </> " dist" ]
121- runFableWithArgs ( projectDir </> " src" ) [
122- " --exclude Fable.Core"
121+ let compileFcs () =
122+ runFableWithArgs " src/fable-standalone/src" [
123+ " --force-pkgs"
124+ " --typed-arrays"
125+ " --define FX_NO_CORHOST_SIGNER"
126+ " --define FX_NO_LINKEDRESOURCES"
127+ " --define FX_NO_PDB_READER"
128+ " --define FX_NO_PDB_WRITER"
129+ " --define FX_NO_WEAKTABLE"
130+ " --define FX_REDUCED_EXCEPTIONS"
131+ " --define NO_COMPILER_BACKEND"
132+ " --define NO_EXTENSIONTYPING"
133+ " --define NO_INLINE_IL_PARSER"
123134 ]
124- run ( sprintf " npx rollup %s /src/app.fs.js --file %s /dist/app.js --format umd --name Fable" projectDir projectDir)
125- run ( sprintf " npx terser %s /dist/app.js -o %s /dist/app.min.js --mangle --compress" projectDir projectDir)
126135
127136let buildStandalone () =
128137 let buildDir = " build/fable-standalone"
@@ -137,19 +146,10 @@ let buildStandalone() =
137146 makeDirRecursive distDir
138147
139148 // build
140- runFableWithArgs projectDir [
141- " --typed-arrays"
142- " --define FX_NO_CORHOST_SIGNER"
143- " --define FX_NO_LINKEDRESOURCES"
144- " --define FX_NO_PDB_READER"
145- " --define FX_NO_PDB_WRITER"
146- " --define FX_NO_WEAKTABLE"
147- " --define FX_REDUCED_EXCEPTIONS"
148- " --define NO_COMPILER_BACKEND"
149- " --define NO_EXTENSIONTYPING"
150- " --define NO_INLINE_IL_PARSER"
149+ compileFcs()
150+ runFableWithArgs ( projectDir + " /Worker" ) [
151+ " --force-pkgs"
151152 ]
152- runFable ( projectDir + " /Worker" )
153153
154154 // bundle
155155 run ( sprintf " npx rollup %s /Main.fs.js --file %s /bundle.js --format umd --name __FABLE_STANDALONE__" projectDir buildDir)
@@ -187,41 +187,74 @@ let buildStandalone() =
187187 // (if comMajor > staMajor || comMinor > staMinor then compilerVersion
188188 // else sprintf "%i.%i.%i%s" staMajor staMinor (staPatch + 1) comPrerelease)
189189
190- let testJs () =
191- let projectDir = " src/fable-compiler-js"
192- let buildDir = " build/tests-js"
193- if not ( pathExists " build/fable-standalone" ) then
194- buildStandalone()
195- if not ( pathExists " build/fable-compiler-js" ) then
196- buildCompilerJs()
197-
198- cleanDirs [ buildDir]
190+ let buildCompilerJs () =
191+ compileFcs()
199192
200- // Link fable-compiler-js to local packages
201- runInDir projectDir " npm link ../fable-metadata"
202- runInDir projectDir " npm link ../fable-standalone"
193+ let projectDir = " src/fable-compiler-js"
194+ runFableWithArgs ( projectDir </> " src" ) [
195+ " --force-pkgs"
196+ " --exclude Fable.Core"
197+ ]
203198
204- // Test fable-compiler-js locally
205- run ( " node " + projectDir + " tests/Main/Fable.Tests.fsproj " + buildDir + " --commonjs" )
206- run ( " npx mocha " + buildDir + " --reporter dot -t 10000" )
207- // and another test
208- runInDir " src/fable-compiler-js/test" " node .. test_script.fsx --commonjs"
209- runInDir " src/fable-compiler-js/test" " node bin/test_script.js"
199+ cleanDirs [ projectDir </> " dist" ]
200+ // run (sprintf "npx rollup %s/src/app.fs.js --file %s/dist/app.js --format umd --name Fable" projectDir projectDir)
201+ // run (sprintf "npx terser %s/dist/app.js -o %s/dist/app.min.js --mangle --compress" projectDir projectDir)
202+
203+ // Compile to commonjs modules
204+ runTypescript " src/fable-compiler-js"
205+ // Copy fable-library
206+ copyDirRecursive ( " build/fable-library" ) ( projectDir </> " dist/fable-library" )
207+ // Copy fable-metadata
208+ copyDirRecursive ( " src/fable-metadata/lib" ) ( projectDir </> " dist/fable-metadata" )
209+
210+ let compileAndRunTests ( compileTests ) =
211+ // TODO: "rm tests/**/*.fs.js"
212+ compileTests()
213+ cleanDirs [ " build/tests" ]
214+ runTypescript " tests"
215+ run " npx mocha build/tests/tests/Main --reporter dot -t 10000"
210216
211- // Unlink local packages after test
212- runInDir projectDir " npm unlink ../fable-metadata && cd ../fable-metadata && npm unlink"
213- runInDir projectDir " npm unlink ../fable-standalone && cd ../fable-standalone && npm unlink"
217+ let testJs () =
218+ buildCompilerJs()
219+ compileAndRunTests( fun () ->
220+ run " node src/fable-compiler-js tests/Main/Fable.Tests.fsproj" )
221+
222+ // let projectDir = "src/fable-compiler-js"
223+ // let buildDir = "build/tests-js"
224+ // if not (pathExists "build/fable-standalone") then
225+ // buildStandalone()
226+ // if not (pathExists "build/fable-compiler-js") then
227+ // buildCompilerJs()
228+
229+ // cleanDirs [buildDir]
230+
231+ // // Link fable-compiler-js to local packages
232+ // runInDir projectDir "npm link ../fable-metadata"
233+ // runInDir projectDir "npm link ../fable-standalone"
234+
235+ // // Test fable-compiler-js locally
236+ // run ("node " + projectDir + " tests/Main/Fable.Tests.fsproj " + buildDir + " --commonjs")
237+ // run ("npx mocha " + buildDir + " --reporter dot -t 10000")
238+ // // and another test
239+ // runInDir "src/fable-compiler-js/test" "node .. test_script.fsx --commonjs"
240+ // runInDir "src/fable-compiler-js/test" "node bin/test_script.js"
241+
242+ // // Unlink local packages after test
243+ // runInDir projectDir "npm unlink ../fable-metadata && cd ../fable-metadata && npm unlink"
244+ // runInDir projectDir "npm unlink ../fable-standalone && cd ../fable-standalone && npm unlink"
214245
215246let test () =
216- if pathExists " build/fable-library" |> not then
217- buildLibrary()
247+ compileAndRunTests( fun () ->
248+ if pathExists " build/fable-library" |> not then
249+ buildLibrary()
218250
219- runFableWithArgs " tests/Main" [ " --exclude Fable.Core" ; " --force-pkgs" ]
220- runTypescript " tests"
221- run " npx mocha build/tests/tests/Main --reporter dot -t 10000"
222- runInDir " tests/Main" " dotnet run"
251+ runFableWithArgs " tests/Main" [
252+ " --force-pkgs"
253+ " --exclude Fable.Core"
254+ ]
255+ )
223256
224- // TODO: Temporarily deactivated to get green builds
257+ runInDir " tests/Main " " dotnet run "
225258 if envVarOrNone " APPVEYOR" |> Option.isSome then
226259 testJs()
227260
@@ -342,6 +375,7 @@ match argsLower with
342375| ( " fable-library-ts" | " library-ts" )::_ -> buildLibraryTs()
343376| ( " fable-compiler-js" | " compiler-js" )::_ -> buildCompilerJs()
344377| ( " fable-standalone" | " standalone" )::_ -> buildStandalone()
378+ | " fcs" ::_ -> compileFcs()
345379| " download-standalone" ::_ -> downloadStandalone()
346380| " publish" :: restArgs -> publishPackages restArgs
347381| " github-release" ::_ ->
0 commit comments