Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] fable-core.js generation from TypeScript #240

Merged
merged 13 commits into from
Jul 11, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ module Util =
info.Arguments <- args) TimeSpan.MaxValue
|> fun p -> p.Messages |> String.concat "\n"

let runWrapped workingDir fileName args =
let newFileName, newArgs =
if EnvironmentHelper.isUnix
then fileName, args
else "cmd", ("/C " + fileName + " " + args)
run workingDir newFileName newArgs

let downloadArtifact path =
let url = "https://ci.appveyor.com/api/projects/alfonsogarciacaro/fable/artifacts/build/fable.zip"
let tempFile = Path.ChangeExtension(Path.GetTempFileName(), ".zip")
Expand Down Expand Up @@ -247,7 +254,7 @@ Target "PublishFableCompiler" (fun _ ->
Target "FableCore" (fun _ ->
let targetDir = "src/fable/Fable.Core"
let babelPlugin = "../../../build/fable/node_modules/babel-plugin-transform-es2015-modules"
let run cmd = Util.run targetDir cmd
let runWrapped cmd = Util.runWrapped targetDir cmd

targetDir + "/package.json"
|> File.ReadAllLines
Expand All @@ -261,9 +268,14 @@ Target "FableCore" (fun _ ->
| true -> true) false
|> ignore

sprintf "es2015.js -o fable-core.js --plugins %s-umd" babelPlugin |> run "babel"
sprintf "es2015.js -o commonjs.js --plugins %s-commonjs" babelPlugin |> run "babel"
"fable-core.js -c -m -o fable-core.min.js" |> run "uglifyjs"
sprintf "es2015.js -o fable-core.js --plugins %s-umd --no-babelrc" babelPlugin |> runWrapped "babel"
sprintf "es2015.js -o commonjs.js --plugins %s-commonjs --no-babelrc" babelPlugin |> runWrapped "babel"
"fable-core.js -c -m -o fable-core.min.js" |> runWrapped "uglifyjs"

// TEMP: Builds fable-core.tsc.js from TypeScript sources.
// Requires 'npm install babel-preset-es2015' in src/fable/Fable.Core
"es2015-mini.ts --target ES2015 --outDir . --declaration" |> runWrapped "tsc"
"es2015-mini.js -o fable-core.tsc.js" |> runWrapped "babel"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh oh... lines 274-278 shouldn't be here 😭

Util.assemblyInfo (targetDir + "/src") fableCoreVersion []
!! (targetDir + "/src/Fable.Core.fsproj")
Expand Down