From d6f15a54683eab06b28de62edc0e99861a46532e Mon Sep 17 00:00:00 2001 From: Maxime Mangel Date: Wed, 16 Aug 2023 20:35:40 +0200 Subject: [PATCH] Remove `--typescript` support `--typescript` was introduced in Fable 3 for the beta typescript support. However, with Fable 4 `--lang ` is now the official way of selecting the target language --- src/Fable.Cli/Entry.fs | 2 -- src/Fable.Cli/RELEASE_NOTES.md | 1 + src/fable-compiler-js/RELEASE_NOTES.md | 4 ++++ src/fable-compiler-js/src/app.fs | 2 -- src/fable-standalone/RELEASE_NOTES.md | 4 ++++ src/fable-standalone/src/Worker/Worker.fs | 1 - src/fable-standalone/test/bench-compiler/app.fs | 2 -- src/fable-standalone/test/bench-compiler/package.json | 8 ++++---- src/fable-standalone/test/bench-compiler/transform.js | 1 - 9 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Fable.Cli/Entry.fs b/src/Fable.Cli/Entry.fs index 4669f12c83..1142abaffc 100644 --- a/src/Fable.Cli/Entry.fs +++ b/src/Fable.Cli/Entry.fs @@ -92,7 +92,6 @@ let knownCliArgs() = [ ["--printAst"], [] ["--noReflection"], [] ["--noParallelTypeCheck"], [] - ["--typescript"], [] ["--trimRootModule"], [] ["--fableLib"], [] ["--replace"], [] @@ -147,7 +146,6 @@ Arguments: let argLanguage (args: CliArgs) = args.Value("--lang", "--language") - |> Option.orElseWith (fun () -> if args.FlagEnabled("--typescript") then Some "ts" else None) // Compatibility with "--typescript" |> Option.map (fun lang -> let lang = lang.ToLower() diff --git a/src/Fable.Cli/RELEASE_NOTES.md b/src/Fable.Cli/RELEASE_NOTES.md index 1abb7814b2..03347b1427 100644 --- a/src/Fable.Cli/RELEASE_NOTES.md +++ b/src/Fable.Cli/RELEASE_NOTES.md @@ -7,6 +7,7 @@ * Improve --help message for the --lang section * Fix #3464: Invalidate cache when the target language changes * Always delete the `fable_modules` folder when the cache is invalidated +* Remove `--typescript` options support, use `--lang ` instead ### 4.1.4 diff --git a/src/fable-compiler-js/RELEASE_NOTES.md b/src/fable-compiler-js/RELEASE_NOTES.md index 3d038010ef..3021186a09 100644 --- a/src/fable-compiler-js/RELEASE_NOTES.md +++ b/src/fable-compiler-js/RELEASE_NOTES.md @@ -1,3 +1,7 @@ +### Unreleased + +* Remove `--typescript` options support, use `--lang ` instead + ### 3.0.1 * Reduced package dependencies diff --git a/src/fable-compiler-js/src/app.fs b/src/fable-compiler-js/src/app.fs index 83e7501deb..a755fe109d 100644 --- a/src/fable-compiler-js/src/app.fs +++ b/src/fable-compiler-js/src/app.fs @@ -276,7 +276,6 @@ let run opts projectFileName outDir = sourceMaps = (opts |> hasFlag "--sourceMaps") || (opts |> hasFlag "-s") typedArrays = opts |> tryFlag "--typedArrays" language = opts |> argValue ["--language"; "--lang"] - |> Option.orElse (tryFlag "--typescript" opts |> Option.map (fun _ -> "TypeScript")) |> Option.defaultValue "JavaScript" printAst = opts |> hasFlag "--printAst" @@ -297,7 +296,6 @@ Options: --typedArrays Compile numeric arrays as JS typed arrays (default is true for JS, false for TS) --run Execute the script after compilation - --typescript Compile to TypeScript (experimental) --optimize Compile with optimized F# AST (experimental) """ diff --git a/src/fable-standalone/RELEASE_NOTES.md b/src/fable-standalone/RELEASE_NOTES.md index 451388d393..0df428fba5 100644 --- a/src/fable-standalone/RELEASE_NOTES.md +++ b/src/fable-standalone/RELEASE_NOTES.md @@ -1,3 +1,7 @@ +### Unreleased + +* Remove `--typescript` options support, use `--lang ` instead + ### 3.2.11 * Enable Fable.Repl.Lib diff --git a/src/fable-standalone/src/Worker/Worker.fs b/src/fable-standalone/src/Worker/Worker.fs index 5dd9d69c05..98140c00a7 100644 --- a/src/fable-standalone/src/Worker/Worker.fs +++ b/src/fable-standalone/src/Worker/Worker.fs @@ -92,7 +92,6 @@ let private compileCode fable fileName fsharpNames fsharpCodes language otherFSh let nonFSharpOptions = set [ "--typedArrays" "--clampByteArrays" - "--typescript" "--sourceMaps" ] let fableOptions, otherFSharpOptions = diff --git a/src/fable-standalone/test/bench-compiler/app.fs b/src/fable-standalone/test/bench-compiler/app.fs index 6edaf4e073..87a70491f1 100644 --- a/src/fable-standalone/test/bench-compiler/app.fs +++ b/src/fable-standalone/test/bench-compiler/app.fs @@ -260,7 +260,6 @@ let run opts projectFileName outDir = sourceMaps = (opts |> hasFlag "--sourceMaps") || (opts |> hasFlag "-s") typedArrays = opts |> tryFlag "--typedArrays" language = opts |> argValue ["--language"; "--lang"] - |> Option.orElse (tryFlag "--typescript" opts |> Option.map (fun _ -> "TypeScript")) |> Option.defaultValue "JavaScript" printAst = opts |> hasFlag "--printAst" @@ -281,7 +280,6 @@ Options: --typedArrays Compile numeric arrays as JS typed arrays (default is true for JS, false for TS) --run Execute the script after compilation - --typescript Compile to TypeScript (experimental) --optimize Compile with optimized F# AST (experimental) """ diff --git a/src/fable-standalone/test/bench-compiler/package.json b/src/fable-standalone/test/bench-compiler/package.json index 0970a80711..8b315ba7a9 100644 --- a/src/fable-standalone/test/bench-compiler/package.json +++ b/src/fable-standalone/test/bench-compiler/package.json @@ -45,7 +45,7 @@ "prebuild-lib": "npm run tsc -- -p ../../../fable-library --outDir ./out-lib", "prebuild-lib-ts": "mkdir -p out-lib-ts && cp -r ../../../fable-library/*.ts out-lib-ts && cp -r ../../../fable-library/lib out-lib-ts", "build-lib": "dotnet run -c Release ../../../fable-library/Fable.Library.fsproj out-lib --fableLib out-lib --sourceMaps", - "build-lib-ts": "dotnet run -c Release ../../../fable-library/Fable.Library.fsproj out-lib-ts --fableLib out-lib-ts --typescript", + "build-lib-ts": "dotnet run -c Release ../../../fable-library/Fable.Library.fsproj out-lib-ts --fableLib out-lib-ts --lang typescript", "tsc-lib-init": "npm run tsc -- --init --target es2020 --module es2020 --allowJs", "tsc-lib": "npm run tsc -- -p ./out-lib-ts --outDir ./out-lib-js", @@ -53,17 +53,17 @@ "prebuild-test-ts": "npm run clean && npm run build-lib-ts", "build-test": "dotnet run -c Release ../../../../../fable-test/fable-test.fsproj out-test --fableLib out-lib --sourceMaps", "build-test-ast": "dotnet run -c Release ../../../../../fable-test/fable-test.fsproj out-test --fableLib out-lib --printAst", - "build-test-ts": "dotnet run -c Release ../../../../../fable-test/fable-test.fsproj out-test-ts --fableLib out-lib-ts --typescript", + "build-test-ts": "dotnet run -c Release ../../../../../fable-test/fable-test.fsproj out-test-ts --fableLib out-lib-ts --lang typescript", "build-test-opt": "npm run build-test -- --optimize", "build-test-node": "node out-node/app.js ../../../../../fable-test/fable-test.fsproj out-test --fableLib out-lib --sourceMaps", - "build-test-node-ts": "npm run build-test-node --typescript", + "build-test-node-ts": "npm run build-test-node --lang typescript", "postbuild-test-ts": "cp tsconfig.json out-test-ts && npm run tsc -- -p out-test-ts --outDir out-test-js", "test": "node ./out-test/src/test.js", "prebuild-tests": "npm run clean && npm run build-lib", "prebuild-tests-ts": "npm run clean && npm run build-lib-ts", "build-tests": "dotnet run -c Release ../../../../tests/Js/Main/Fable.Tests.fsproj out-tests --fableLib out-lib --sourceMaps", - "build-tests-ts": "npm run build-tests -- --fableLib out-lib-ts --typescript", + "build-tests-ts": "npm run build-tests -- --fableLib out-lib-ts --lang typescript", "build-tests-opt": "npm run build-tests -- --optimize", "build-tests-node": "node out-node/app.js ../../../../tests/Js/Main/Fable.Tests.fsproj out-tests --fableLib out-lib --sourceMaps", "tests": "npm run mocha -- out-tests --colors --reporter dot", diff --git a/src/fable-standalone/test/bench-compiler/transform.js b/src/fable-standalone/test/bench-compiler/transform.js index d860c62770..ecd48b6429 100644 --- a/src/fable-standalone/test/bench-compiler/transform.js +++ b/src/fable-standalone/test/bench-compiler/transform.js @@ -113,7 +113,6 @@ function main() { commonjs: process.argv.find(v => v === "--commonjs") != null, sourceMaps: process.argv.find(v => v === "--sourceMaps") != null, classTypes: process.argv.find(v => v === "--classTypes") != null, - typescript: process.argv.find(v => v === "--typescript") != null, }; const babelOptions = options.commonjs ?