diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5657f69 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,23 @@ +# Top-most EditorConfig +root = true + +[*] +# Unix-style newlines with a newline ending every file +end_of_line = lf +insert_final_newline = true +# Be gentle! +charset = utf-8 +trim_trailing_whitespace = true + +[Makefile] +indent_style = tab + +[*.{js,json}] +indent_style = space +indent_size = 2 + +[{{_copier_conf.answers_file}}.jinja] +insert_final_newline = false + +[.copier-answers.yml] +insert_final_newline = false diff --git a/.gitignore b/.gitignore index 9472107..093629f 100644 --- a/.gitignore +++ b/.gitignore @@ -189,4 +189,4 @@ pyrightconfig.json # End of https://www.toptal.com/developers/gitignore/api/python,direnv .devenv.flake.nix -.pre-commit-config.yaml \ No newline at end of file +.pre-commit-config.yaml diff --git a/README.md b/README.md index a89af2f..f07c2cf 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,12 @@ decision and help us to improve them. **Table of Contents** -- [Inception](#inception) - [In Action](#in-action) - [Features](#features) - - [Detailed Features](#detailed-features) + - [Detailed Features](#detailed-features) - [How to Use](#how-to-use) - - [Prerequisites](#prerequisites) - - [Initialize a New Project](#initialize-a-new-project) + - [Prerequisites](#prerequisites) + - [Initialize a New Project](#initialize-a-new-project) - [Resources](#resources) - [Contributing](#contributing) - [License](#license) @@ -29,12 +28,11 @@ decision and help us to improve them. - -# In Action +## In Action [![asciicast](https://asciinema.org/a/Mp4w76BgrVcu4hvUR9nbb8EIL.svg)](https://asciinema.org/a/Mp4w76BgrVcu4hvUR9nbb8EIL) -# Features +## Features 1. **Opinionated Configuration**: Reduces decision fatigue by providing fewer, well-chosen options. @@ -51,7 +49,7 @@ decision and help us to improve them. 6. **Comprehensive .gitignore**: Includes a well-crafted `.gitignore` file. -## Detailed Features +### Detailed Features | Feature | Python | Node.js | Go | Rust | | ------------------------- | ------ | ------- | --- | ---- | @@ -71,9 +69,9 @@ decision and help us to improve them. | difftastic | ✅ | ✅ | ✅ | ✅ | | dotenv | ✅ | ✅ | ✅ | ✅ | -# How to Use +## How to Use -## Prerequisites +### Prerequisites To start working with Inception, you need: @@ -86,8 +84,8 @@ To start working with Inception, you need: > > 1. Use your own shell configuration in `devenv` session. > 2. Automatically integrated with your IDE (VSCode and Intellij support -> it out of the box, and for Emacs and Vim you can use suggested -> plugins below). +> it out of the box, and for Emacs and Vim you can use suggested +> plugins below). > > For more information on how to enable it you can refer to [this wiki > entry](https://github.com/DataChefHQ/inception/wiki/How-to-enable-direnv%3F). @@ -105,7 +103,13 @@ To start working with Inception, you need: > - [Add user to the trusted user list](https://github.com/DataChefHQ/inception/wiki/MacOS:-add-user-to-the-trusted-user-list) > - [Trusting git directory](https://github.com/DataChefHQ/inception/wiki/Trusting-git-directory) -## Initialize a New Project +### Initialize a New Project + +First, create a project folder and cd into it. + +```bash +mkdir awesome-project && cd awesome-project +``` Using pipx: @@ -119,22 +123,22 @@ If you have copier installed locally, use: copier copy --trust gh:DataChefHQ/Inception . ``` -# Resources +## Resources - [Devenv Docs](https://devenv.sh/getting-started/) - [Nix in 100 Seconds](https://www.youtube.com/watch?v=FJVFXsNzYZQ) -# Contributing +## Contributing We welcome contributions! Please check out our [contributing guidelines](CONTRIBUTING.md) to get started. -# License +## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -# Acknowledgments +## Acknowledgments - Thanks to the open-source community for their invaluable contributions to projects which we are building on: diff --git a/copier.yaml b/copier.yaml index ee5be44..44c7024 100644 --- a/copier.yaml +++ b/copier.yaml @@ -52,34 +52,38 @@ author_email: type: str help: "Author Email" -_subdirectory: template +_subdirectory: template/{{ language }} # Execute these commands on destination after copy _tasks: - - command: | - devenv shell nixfmt . - git init - git add . - git commit -am 'This is the Inception 🎉' - working_directory: "{{ project_name }}" + - devenv shell nixfmt . + - git init + - git add . + - git commit -am 'This is the Inception 🎉' _message_before_copy: | - Welcome to Incption 🎉, the gateway to your next big project! - Your next adventure starts here. Answer a few quick questions, and - I'll create a project tailored just for you! + Welcome to Inception 🎉, the gateway to your next big project! + + Your next adventure starts here. Answer a few quick questions, + and I'll create a project tailored just for you! Let's create something amazing! 🚀✨ _message_after_copy: | + 🎉 {{project_name}} Created Successfully! 🎉 - Your tailored project is ready and waiting for you. Next steps: + Your tailored project is ready and waiting for you. Next steps - 1. Change directory to the project root: + 1. Allow direnv to load your project environment - $ cd {{ _copier_conf.dst_path }}/{{ project_name }} + $ direnv allow 2. Let's hack 🧑🏻‍💻 Good Luck, DataChef 🧑‍🍳 + +_message_after_update: | + + 🎉 Project updated to latest Inception version! 🎉 diff --git a/devenv.nix b/devenv.nix index a9aa779..b2b1e45 100644 --- a/devenv.nix +++ b/devenv.nix @@ -74,6 +74,7 @@ in yamllint = { enable = true; settings.preset = "relaxed"; + excludes = [ ".copier-answers.yml" ]; }; pyright.enable = true; editorconfig-checker.enable = true; diff --git a/includes/.copier-answers.yml b/includes/.copier-answers.yml new file mode 100644 index 0000000..e33c705 --- /dev/null +++ b/includes/.copier-answers.yml @@ -0,0 +1 @@ +{{ _copier_answers|to_nice_yaml -}} \ No newline at end of file diff --git a/includes/README.release.md.jinja b/includes/README.release.md.jinja index 9c36e63..b92f300 100644 --- a/includes/README.release.md.jinja +++ b/includes/README.release.md.jinja @@ -16,4 +16,4 @@ After the script finished successfully, you need to: If you want to have a release on your source control system, Github or Gitlab, you can do it dependent to the system, using the published -tags. \ No newline at end of file +tags. diff --git a/includes/base.nix.jinja b/includes/base.nix.jinja index 9bc1e60..4b5b317 100644 --- a/includes/base.nix.jinja +++ b/includes/base.nix.jinja @@ -20,6 +20,36 @@ scripts = { hello.exec = "echo $GREET"; cat.exec = "bat $@"; + check-inception-updates.exec = '' + GREEN="\033[0;32m"; + NC="\033[0m"; + + latest_tag=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/DataChefHQ/inception/releases/latest | jq --raw-output '.tag_name') + current_commit=$(yq '.["_commit"]' .copier-answers.yml) + + if [[ "$(printf '%s\n' "$current_commit" "$latest_tag" | sort -V | head -n 1)" != "$latest_tag" ]]; then + echo + echo "🎉 There's an update available for Inception!" + echo + echo -e " Your version: $current_commit" + echo -e " Latest version: $latest_tag" + echo + echo -e To update, run "$GREEN"inception-update"$NC" in your shell. + echo + echo "⚠️ WARNING" + echo + echo " Sometimes it's impossible to know what to do with a diff code hunk." + echo " In that case, the conflicting file is updated with conflict markers," + echo " and you'll have to choose which version to keep." + echo + echo " More info at: https://copier.readthedocs.io/en/stable/updating/" + fi + ''; + + inception-update = { + description = "Sync this project with the latest version of Inception."; + exec = "pipx run copier update --defaults -T --trust"; + }; show = { # Prints scripts that have a description @@ -51,7 +81,9 @@ nixfmt-rfc-style bat jq + yq-go tealdeer + pipx # to use copier in projects {%- block packages %}{% endblock -%} ]; @@ -62,6 +94,8 @@ enterShell = '' hello show + check-inception-updates + {%- block enter_shell %}{% endblock -%} ''; @@ -77,6 +111,7 @@ enable = true; settings.preset = "relaxed"; }; + check-merge-conflicts.enable = true; {%- block hooks %}{% endblock -%} }; @@ -88,4 +123,4 @@ # https://devenv.sh/integrations/codespaces-devcontainer/ devcontainer.enable = true; -} \ No newline at end of file +} diff --git a/includes/go.gitignore b/includes/go.gitignore index 45bf6ae..4388fae 100644 --- a/includes/go.gitignore +++ b/includes/go.gitignore @@ -19,4 +19,4 @@ # vendor/ # Go workspace file -go.work \ No newline at end of file +go.work diff --git a/includes/node.gitignore b/includes/node.gitignore index 9af0034..8d7839d 100644 --- a/includes/node.gitignore +++ b/includes/node.gitignore @@ -136,4 +136,4 @@ dist # Optional stylelint cache # SvelteKit build / generate output -.svelte-kit \ No newline at end of file +.svelte-kit diff --git a/includes/python.gitignore b/includes/python.gitignore index c514c5d..2ae665f 100644 --- a/includes/python.gitignore +++ b/includes/python.gitignore @@ -168,4 +168,4 @@ poetry.toml .ruff_cache/ # LSP config files -pyrightconfig.json \ No newline at end of file +pyrightconfig.json diff --git a/includes/rust.gitignore b/includes/rust.gitignore index aa901d5..319cdf7 100644 --- a/includes/rust.gitignore +++ b/includes/rust.gitignore @@ -12,4 +12,4 @@ Cargo.lock **/*.rs.bk # MSVC Windows builds of rustc generate these, which store debugging information -*.pdb \ No newline at end of file +*.pdb diff --git a/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/.envrc b/template/Go/.envrc similarity index 100% rename from template/{% if language == 'Go' %}{{ project_name }}{% endif %}/.envrc rename to template/Go/.envrc diff --git a/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/.github/workflows/test.yml b/template/Go/.github/workflows/test.yml similarity index 100% rename from template/{% if language == 'Go' %}{{ project_name }}{% endif %}/.github/workflows/test.yml rename to template/Go/.github/workflows/test.yml diff --git a/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/.gitignore.jinja b/template/Go/.gitignore.jinja similarity index 100% rename from template/{% if language == 'Go' %}{{ project_name }}{% endif %}/.gitignore.jinja rename to template/Go/.gitignore.jinja diff --git a/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/README.md.jinja b/template/Go/README.md.jinja similarity index 100% rename from template/{% if language == 'Go' %}{{ project_name }}{% endif %}/README.md.jinja rename to template/Go/README.md.jinja diff --git a/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/devenv.nix.jinja b/template/Go/devenv.nix.jinja similarity index 90% rename from template/{% if language == 'Go' %}{{ project_name }}{% endif %}/devenv.nix.jinja rename to template/Go/devenv.nix.jinja index 6e44925..8d7b75f 100644 --- a/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/devenv.nix.jinja +++ b/template/Go/devenv.nix.jinja @@ -7,4 +7,4 @@ {% block languages %} go.enable = true; -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/devenv.yaml.jinja b/template/Go/devenv.yaml.jinja similarity index 100% rename from template/{% if language == 'Go' %}{{ project_name }}{% endif %}/devenv.yaml.jinja rename to template/Go/devenv.yaml.jinja diff --git a/template/Go/{{_copier_conf.answers_file}}.jinja b/template/Go/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 0000000..cb786a7 --- /dev/null +++ b/template/Go/{{_copier_conf.answers_file}}.jinja @@ -0,0 +1,2 @@ +# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY +{% include pathjoin("includes", ".copier-answers.yml") %} \ No newline at end of file diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.devcontainer.json b/template/Node.js/.devcontainer.json similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.devcontainer.json rename to template/Node.js/.devcontainer.json diff --git a/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/.editorconfig b/template/Node.js/.editorconfig.jinja similarity index 100% rename from template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/.editorconfig rename to template/Node.js/.editorconfig.jinja diff --git a/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/.envrc b/template/Node.js/.envrc similarity index 100% rename from template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/.envrc rename to template/Node.js/.envrc diff --git a/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/.github/workflows/test.yml b/template/Node.js/.github/workflows/test.yml similarity index 100% rename from template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/.github/workflows/test.yml rename to template/Node.js/.github/workflows/test.yml diff --git a/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/.gitignore.jinja b/template/Node.js/.gitignore.jinja similarity index 100% rename from template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/.gitignore.jinja rename to template/Node.js/.gitignore.jinja diff --git a/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/README.md.jinja b/template/Node.js/README.md.jinja similarity index 100% rename from template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/README.md.jinja rename to template/Node.js/README.md.jinja diff --git a/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/devenv.nix.jinja b/template/Node.js/devenv.nix.jinja similarity index 100% rename from template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/devenv.nix.jinja rename to template/Node.js/devenv.nix.jinja diff --git a/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/devenv.yaml.jinja b/template/Node.js/devenv.yaml.jinja similarity index 100% rename from template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/devenv.yaml.jinja rename to template/Node.js/devenv.yaml.jinja diff --git a/template/Node.js/{{_copier_conf.answers_file}}.jinja b/template/Node.js/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 0000000..cb786a7 --- /dev/null +++ b/template/Node.js/{{_copier_conf.answers_file}}.jinja @@ -0,0 +1,2 @@ +# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY +{% include pathjoin("includes", ".copier-answers.yml") %} \ No newline at end of file diff --git a/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/.devcontainer.json b/template/Python/.devcontainer.json similarity index 100% rename from template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/.devcontainer.json rename to template/Python/.devcontainer.json diff --git a/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/.editorconfig b/template/Python/.editorconfig.jinja similarity index 100% rename from template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/.editorconfig rename to template/Python/.editorconfig.jinja diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.envrc b/template/Python/.envrc similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.envrc rename to template/Python/.envrc diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.github/workflows/release.yml b/template/Python/.github/workflows/release.yml similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.github/workflows/release.yml rename to template/Python/.github/workflows/release.yml diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.github/workflows/test.yml b/template/Python/.github/workflows/test.yml similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.github/workflows/test.yml rename to template/Python/.github/workflows/test.yml diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.gitignore.jinja b/template/Python/.gitignore.jinja similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.gitignore.jinja rename to template/Python/.gitignore.jinja diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.test.sh b/template/Python/.test.sh similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.test.sh rename to template/Python/.test.sh diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/README.md.jinja b/template/Python/README.md.jinja similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/README.md.jinja rename to template/Python/README.md.jinja diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/devenv.nix.jinja b/template/Python/devenv.nix.jinja similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/devenv.nix.jinja rename to template/Python/devenv.nix.jinja diff --git a/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/devenv.yaml.jinja b/template/Python/devenv.yaml.jinja similarity index 100% rename from template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/devenv.yaml.jinja rename to template/Python/devenv.yaml.jinja diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/pyproject.toml.jinja b/template/Python/pyproject.toml.jinja similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/pyproject.toml.jinja rename to template/Python/pyproject.toml.jinja diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/src/{{ project_name }}/__init__.py.jinja b/template/Python/src/{{ project_name }}/__init__.py.jinja similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/src/{{ project_name }}/__init__.py.jinja rename to template/Python/src/{{ project_name }}/__init__.py.jinja diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/tests/__init__.py b/template/Python/tests/__init__.py similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/tests/__init__.py rename to template/Python/tests/__init__.py diff --git a/template/Python/{{_copier_conf.answers_file}}.jinja b/template/Python/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 0000000..cb786a7 --- /dev/null +++ b/template/Python/{{_copier_conf.answers_file}}.jinja @@ -0,0 +1,2 @@ +# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY +{% include pathjoin("includes", ".copier-answers.yml") %} \ No newline at end of file diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.editorconfig b/template/Rust/.editorconfig.jinja similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/.editorconfig rename to template/Rust/.editorconfig.jinja diff --git a/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/.envrc b/template/Rust/.envrc similarity index 100% rename from template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/.envrc rename to template/Rust/.envrc diff --git a/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/.github/workflows/test.yml b/template/Rust/.github/workflows/test.yml similarity index 100% rename from template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/.github/workflows/test.yml rename to template/Rust/.github/workflows/test.yml diff --git a/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/.gitignore.jinja b/template/Rust/.gitignore.jinja similarity index 100% rename from template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/.gitignore.jinja rename to template/Rust/.gitignore.jinja diff --git a/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/README.md.jinja b/template/Rust/README.md.jinja similarity index 100% rename from template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/README.md.jinja rename to template/Rust/README.md.jinja diff --git a/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/devenv.nix.jinja b/template/Rust/devenv.nix.jinja similarity index 100% rename from template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/devenv.nix.jinja rename to template/Rust/devenv.nix.jinja diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/devenv.yaml.jinja b/template/Rust/devenv.yaml.jinja similarity index 100% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/devenv.yaml.jinja rename to template/Rust/devenv.yaml.jinja diff --git a/template/Rust/{{_copier_conf.answers_file}}.jinja b/template/Rust/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 0000000..cb786a7 --- /dev/null +++ b/template/Rust/{{_copier_conf.answers_file}}.jinja @@ -0,0 +1,2 @@ +# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY +{% include pathjoin("includes", ".copier-answers.yml") %} \ No newline at end of file