diff --git a/.changeset/tall-kiwis-crash.md b/.changeset/tall-kiwis-crash.md new file mode 100644 index 0000000..b88d731 --- /dev/null +++ b/.changeset/tall-kiwis-crash.md @@ -0,0 +1,5 @@ +--- +"create-effect-app": patch +--- + +improve logging during project initialization diff --git a/packages/create-effect-app/src/Cli.ts b/packages/create-effect-app/src/Cli.ts index f4d04d4..d178b6a 100644 --- a/packages/create-effect-app/src/Cli.ts +++ b/packages/create-effect-app/src/Cli.ts @@ -8,6 +8,7 @@ import * as Ansi from "@effect/printer-ansi/Ansi" import * as AnsiDoc from "@effect/printer-ansi/AnsiDoc" import * as Array from "effect/Array" import * as Effect from "effect/Effect" +import { pipe } from "effect/Function" import * as Match from "effect/Match" import * as Option from "effect/Option" import * as Yaml from "yaml" @@ -152,8 +153,8 @@ function createExample(config: ExampleConfig) { const fs = yield* FileSystem.FileSystem yield* Effect.logInfo(AnsiDoc.hsep([ - AnsiDoc.text("Creating a new Effect application in"), - AnsiDoc.text(config.projectName).pipe(AnsiDoc.annotate(Ansi.green)) + AnsiDoc.text("Creating a new Effect application in: "), + AnsiDoc.text(config.projectName).pipe(AnsiDoc.annotate(Ansi.magenta)) ])) // Create the project path @@ -169,7 +170,8 @@ function createExample(config: ExampleConfig) { yield* Effect.logInfo(AnsiDoc.hsep([ AnsiDoc.text("Success!").pipe(AnsiDoc.annotate(Ansi.green)), - AnsiDoc.text(`Effect example application was initialized in ${config.projectName}`) + AnsiDoc.text("Effect example application was initialized in: "), + AnsiDoc.text(config.projectName).pipe(AnsiDoc.annotate(Ansi.cyan)) ])) }) } @@ -299,21 +301,34 @@ function createTemplate(config: TemplateConfig) { yield* Effect.logInfo(AnsiDoc.hsep([ AnsiDoc.text("Success!").pipe(AnsiDoc.annotate(Ansi.green)), AnsiDoc.text(`Effect template project was initialized in:`), - AnsiDoc.hardLine, - AnsiDoc.indent(AnsiDoc.text(config.projectName).pipe(AnsiDoc.annotate(Ansi.magenta)), 2) + AnsiDoc.text(config.projectName).pipe(AnsiDoc.annotate(Ansi.cyan)) + ])) + + yield* Effect.logInfo(AnsiDoc.hsep([ + AnsiDoc.text("Take a look at the template's"), + AnsiDoc.text("README.md").pipe(AnsiDoc.annotate(Ansi.cyan)), + AnsiDoc.text("for more information") ])) + const filesToCheck = [] + filesToCheck.push(path.join(config.projectName, "LICENSE")) if (config.projectType.withChangesets) { - yield* Effect.logInfo(AnsiDoc.hsep([ - AnsiDoc.text("Make sure to update the Changesets configuration file"), - AnsiDoc.text("with your target GitHub repository for changelog links:"), - AnsiDoc.hardLine, - AnsiDoc.text(path.join(config.projectName, ".changeset", "config.json")).pipe( - AnsiDoc.annotate(Ansi.magenta), - AnsiDoc.indent(2) - ) - ])) + filesToCheck.push(path.join(config.projectName, ".changeset", "config.json")) } + + yield* Effect.logInfo(AnsiDoc.cats([ + AnsiDoc.hsep([ + AnsiDoc.text("Make sure to replace any"), + AnsiDoc.text("").pipe(AnsiDoc.annotate(Ansi.cyan)), + AnsiDoc.text("entries in the following files:") + ]), + pipe( + filesToCheck, + Array.map((file) => AnsiDoc.catWithSpace(AnsiDoc.char("-"), AnsiDoc.text(file))), + AnsiDoc.vsep, + AnsiDoc.indent(2) + ) + ])) }) } diff --git a/templates/basic/.changeset/config.json b/templates/basic/.changeset/config.json index b530958..9e6eaf6 100644 --- a/templates/basic/.changeset/config.json +++ b/templates/basic/.changeset/config.json @@ -3,7 +3,7 @@ "changelog": [ "@changesets/changelog-github", { - "repo": "REPLACE_ME" + "repo": "" } ], "commit": false, diff --git a/templates/basic/LICENSE b/templates/basic/LICENSE new file mode 100644 index 0000000..6d3ea95 --- /dev/null +++ b/templates/basic/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024-present + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/templates/basic/README.md b/templates/basic/README.md index 460e66b..ad86654 100644 --- a/templates/basic/README.md +++ b/templates/basic/README.md @@ -1 +1,31 @@ -# Effect Basic Package Template \ No newline at end of file +# Effect Package Template + +This template provides a solid foundation for building scalable and maintainable TypeScript package with Effect. + +## Running Code + +This template leverages [tsx](https://tsx.is) to allow execution of TypeScript files via NodeJS as if they were written in plain JavaScript. + +To execute a file with `tsx`: + +```sh +pnpm tsx ./path/to/the/file.ts +``` + +## Operations + +**Building** + +To build the package: + +```sh +pnpm build +``` + +**Testing** + +To test the package: + +```sh +pnpm test +``` diff --git a/templates/cli/.changeset/config.json b/templates/cli/.changeset/config.json index b530958..9e6eaf6 100644 --- a/templates/cli/.changeset/config.json +++ b/templates/cli/.changeset/config.json @@ -3,7 +3,7 @@ "changelog": [ "@changesets/changelog-github", { - "repo": "REPLACE_ME" + "repo": "" } ], "commit": false, diff --git a/templates/cli/LICENSE b/templates/cli/LICENSE new file mode 100644 index 0000000..6d3ea95 --- /dev/null +++ b/templates/cli/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024-present + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/templates/cli/README.md b/templates/cli/README.md index 57f97ed..c30de61 100644 --- a/templates/cli/README.md +++ b/templates/cli/README.md @@ -1 +1,32 @@ -# Effect CLI Application Template \ No newline at end of file +# Effect CLI Application Template + +This template provides a solid foundation for building scalable and maintainable command-line applications with Effect. + +## Running Code + +This template leverages [tsx](https://tsx.is) to allow execution of TypeScript files via NodeJS as if they were written in plain JavaScript. + +To execute a file with `tsx`: + +```sh +pnpm tsx ./path/to/the/file.ts +``` + +## Operations + +**Building** + +To build the package: + +```sh +pnpm build +``` + +**Testing** + +To test the package: + +```sh +pnpm test +``` + diff --git a/templates/monorepo/.changeset/config.json b/templates/monorepo/.changeset/config.json index b530958..9e6eaf6 100644 --- a/templates/monorepo/.changeset/config.json +++ b/templates/monorepo/.changeset/config.json @@ -3,7 +3,7 @@ "changelog": [ "@changesets/changelog-github", { - "repo": "REPLACE_ME" + "repo": "" } ], "commit": false, diff --git a/templates/monorepo/LICENSE b/templates/monorepo/LICENSE new file mode 100644 index 0000000..6d3ea95 --- /dev/null +++ b/templates/monorepo/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024-present + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/templates/monorepo/README.md b/templates/monorepo/README.md index 889ad6c..f681b20 100644 --- a/templates/monorepo/README.md +++ b/templates/monorepo/README.md @@ -1 +1,32 @@ -# Effect Monorepo Template \ No newline at end of file +# Effect Monorepo Template + +This template provides a solid foundation for building scalable and maintainable TypeScript applications with Effect. + +## Running Code + +This template leverages [tsx](https://tsx.is) to allow execution of TypeScript files via NodeJS as if they were written in plain JavaScript. + +To execute a file with `tsx`: + +```sh +pnpm tsx ./path/to/the/file.ts +``` + +## Operations + +**Building** + +To build all packages in the monorepo: + +```sh +pnpm build +``` + +**Testing** + +To test all packages in the monorepo: + +```sh +pnpm test +``` +