Skip to content

Commit

Permalink
remove potential leftover data (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
tatchi authored Sep 25, 2024
1 parent b54c24b commit 5f92083
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-pianos-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-effect-app": patch
---

Removes potential leftover files
16 changes: 9 additions & 7 deletions packages/create-effect-app/src/Cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,14 @@ function createTemplate(config: TemplateConfig) {
// Remove the .changesets directory
yield* fs.remove(path.join(config.projectName, ".changeset"), {
recursive: true
})
}).pipe(Effect.ignore)
// Remove patches for changesets
const patches = yield* fs.readDirectory(path.join(config.projectName, "patches")).pipe(
Effect.map(Array.filter((file) => file.includes("changeset")))
)
yield* Effect.forEach(patches, (patch) => fs.remove(path.join(config.projectName, "patches", patch)))
yield* Effect.forEach(patches, (patch) => fs.remove(path.join(config.projectName, "patches", patch))).pipe(
Effect.ignore
)
// Remove patched dependencies for changesets
const depsToRemove = Array.filter(
Object.keys(packageJson["pnpm"]["patchedDependencies"]),
Expand All @@ -242,22 +244,22 @@ function createTemplate(config: TemplateConfig) {
}
// If git workflows are enabled, remove changesets related workflows
if (config.projectType.withWorkflows) {
yield* fs.remove(path.join(config.projectName, ".github", "workflows", "release.yml"))
yield* fs.remove(path.join(config.projectName, ".github", "workflows", "release.yml")).pipe(Effect.ignore)
}
}

// Handle user preferences for Nix flakes
if (!config.projectType.withNixFlake) {
yield* Effect.forEach(
[".envrc", "flake.lock", "flake.nix"],
[".envrc", "flake.nix"],
(file) => fs.remove(path.join(config.projectName, file))
)
).pipe(Effect.ignore)
}

// Handle user preferences for ESLint
if (!config.projectType.withESLint) {
// Remove eslint.config.mjs
yield* fs.remove(path.join(config.projectName, "eslint.config.mjs"))
yield* fs.remove(path.join(config.projectName, "eslint.config.mjs")).pipe(Effect.ignore)
// Remove eslint dependencies
const eslintDeps = Array.filter(
Object.keys(packageJson["devDependencies"]),
Expand Down Expand Up @@ -289,7 +291,7 @@ function createTemplate(config: TemplateConfig) {
// Remove the .github directory
yield* fs.remove(path.join(config.projectName, ".github"), {
recursive: true
})
}).pipe(Effect.ignore)
}

// Write out the updated package.json
Expand Down

0 comments on commit 5f92083

Please sign in to comment.