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

Port back fixes for missing .gitignore #3711

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Fable.Cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fixed function composition types (by @ncave)
* [GH-3668](https://github.com/fable-compiler/Fable/pull/3668) Normalize fable-library argument (by @nojaf)
* [GH-3682](https://github.com/fable-compiler/Fable/pull/3682) Support some custom unary math operors (Acos, Asin, Atan, Atan2, Cos, Cosh, Exp, Log, Log2, Log10, Sin, Sinh, Sqrt, Tan, Tanh) (by @PierreYvesR)
* [GH-3603](https://github.com/fable-compiler/Fable/issues/3603) Port back fixes for missing `.gitignore` file in the generated `fable_modules/` folder (by @MangelMaxime)

#### Javascript

Expand Down
28 changes: 19 additions & 9 deletions src/Fable.Compiler/ProjectCracker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
}

static member GetPath(fableModulesDir: string, isDebug: bool) =
IO.Path.Combine(
fableModulesDir,
$"""project_cracked{if isDebug then
"_debug"
else
""}.json"""
)
let suffix =
if isDebug then
"_debug"
else
""

IO.Path.Combine(fableModulesDir, $"project_cracked{suffix}.json")
Fixed Show fixed Hide fixed

member this.GetTimestamp() =
CacheInfo.GetPath(this.FableModulesDir, this.FableOptions.DebugMode)
Expand Down Expand Up @@ -173,6 +173,17 @@

fableModulesDir

member _.ResetFableModulesDir() =
if IO.Directory.Exists(fableModulesDir) then
IO.Directory.Delete(fableModulesDir, recursive = true)

IO.Directory.CreateDirectory(fableModulesDir) |> ignore

IO.File.WriteAllText(
IO.Path.Combine(fableModulesDir, ".gitignore"),
"**/*"
)

type CrackerResponse =
{
FableLibDir: string
Expand Down Expand Up @@ -1196,8 +1207,7 @@

// The cache was considered outdated / invalid so it is better to make
// make sure we have are in a clean state
if IO.Directory.Exists(opts.FableModulesDir) then
IO.Directory.Delete(opts.FableModulesDir, true)
opts.ResetFableModulesDir()

let fableLibDir, pkgRefs =
match opts.FableOptions.Language with
Expand Down
Loading