From e98c3ba5ab444514dfc07bea614af89332725b61 Mon Sep 17 00:00:00 2001 From: Federico Zambelli Date: Thu, 24 Oct 2024 15:23:28 +0200 Subject: [PATCH 1/7] feat: add copier-answers file - enables `copier update` --- copier.yaml | 2 +- includes/.copier-answers.yml | 1 + .../{{_copier_conf.answers_file}}.jinja | 2 ++ .../{{_copier_conf.answers_file}}.jinja | 2 ++ .../{{_copier_conf.answers_file}}.jinja | 2 ++ .../{{_copier_conf.answers_file}}.jinja | 2 ++ 6 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 includes/.copier-answers.yml create mode 100644 template/{% if language == 'Go' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja create mode 100644 template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja create mode 100644 template/{% if language == 'Python' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja create mode 100644 template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja diff --git a/copier.yaml b/copier.yaml index ee5be44..273b67e 100644 --- a/copier.yaml +++ b/copier.yaml @@ -64,7 +64,7 @@ _tasks: working_directory: "{{ project_name }}" _message_before_copy: | - Welcome to Incption šŸŽ‰, the gateway to your next big project! + 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! diff --git a/includes/.copier-answers.yml b/includes/.copier-answers.yml new file mode 100644 index 0000000..d0f5d97 --- /dev/null +++ b/includes/.copier-answers.yml @@ -0,0 +1 @@ +{{ _copier_answers|to_nice_yaml -}} diff --git a/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja b/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 0000000..d6c44d6 --- /dev/null +++ b/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/{{_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") %} diff --git a/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja b/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 0000000..d6c44d6 --- /dev/null +++ b/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/{{_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") %} diff --git a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja b/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 0000000..d6c44d6 --- /dev/null +++ b/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/{{_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") %} diff --git a/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja b/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 0000000..d6c44d6 --- /dev/null +++ b/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/{{_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") %} From 34f5067a80b53e6aa8e6553ad34d5a5372e6ad16 Mon Sep 17 00:00:00 2001 From: Federico Zambelli Date: Thu, 24 Oct 2024 15:49:41 +0200 Subject: [PATCH 2/7] feat: enable copier updates for inception --- .editorconfig | 20 +++++++++++++++++++ copier.yaml | 20 +++++++++---------- devenv.nix | 1 + includes/.copier-answers.yml | 2 +- includes/base.nix.jinja | 4 +++- .../.envrc | 0 .../.github/workflows/test.yml | 0 .../.gitignore.jinja | 0 .../README.md.jinja | 0 .../devenv.nix.jinja | 0 .../devenv.yaml.jinja | 0 .../{{_copier_conf.answers_file}}.jinja | 2 +- .../.devcontainer.json | 0 .../.editorconfig.jinja} | 0 .../.envrc | 0 .../.github/workflows/test.yml | 0 .../.gitignore.jinja | 0 .../README.md.jinja | 0 .../devenv.nix.jinja | 0 .../devenv.yaml.jinja | 0 .../{{_copier_conf.answers_file}}.jinja | 2 +- .../.devcontainer.json | 0 .../.editorconfig.jinja} | 0 .../.envrc | 0 .../.github/workflows/release.yml | 0 .../.github/workflows/test.yml | 0 .../.gitignore.jinja | 0 .../.test.sh | 0 .../README.md.jinja | 0 .../devenv.nix.jinja | 0 .../devenv.yaml.jinja | 0 .../pyproject.toml.jinja | 0 .../src/{{ project_name }}/__init__.py.jinja | 0 .../tests/__init__.py | 0 .../{{_copier_conf.answers_file}}.jinja | 2 +- .../.editorconfig.jinja} | 0 .../.envrc | 0 .../.github/workflows/test.yml | 0 .../.gitignore.jinja | 0 .../README.md.jinja | 0 .../devenv.nix.jinja | 0 .../devenv.yaml.jinja | 0 .../{{_copier_conf.answers_file}}.jinja | 2 +- 43 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 .editorconfig rename template/{{% if language == 'Go' %}{{ project_name }}{% endif %} => Go}/.envrc (100%) rename template/{{% if language == 'Go' %}{{ project_name }}{% endif %} => Go}/.github/workflows/test.yml (100%) rename template/{{% if language == 'Go' %}{{ project_name }}{% endif %} => Go}/.gitignore.jinja (100%) rename template/{{% if language == 'Go' %}{{ project_name }}{% endif %} => Go}/README.md.jinja (100%) rename template/{{% if language == 'Go' %}{{ project_name }}{% endif %} => Go}/devenv.nix.jinja (100%) rename template/{{% if language == 'Go' %}{{ project_name }}{% endif %} => Go}/devenv.yaml.jinja (100%) rename template/{{% if language == 'Go' %}{{ project_name }}{% endif %} => Go}/{{_copier_conf.answers_file}}.jinja (53%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Node.js}/.devcontainer.json (100%) rename template/{{% if language == 'Rust' %}{{ project_name }}{% endif %}/.editorconfig => Node.js/.editorconfig.jinja} (100%) rename template/{{% if language == 'Node.js' %}{{ project_name }}{% endif %} => Node.js}/.envrc (100%) rename template/{{% if language == 'Node.js' %}{{ project_name }}{% endif %} => Node.js}/.github/workflows/test.yml (100%) rename template/{{% if language == 'Rust' %}{{ project_name }}{% endif %} => Node.js}/.gitignore.jinja (100%) rename template/{{% if language == 'Node.js' %}{{ project_name }}{% endif %} => Node.js}/README.md.jinja (100%) rename template/{{% if language == 'Rust' %}{{ project_name }}{% endif %} => Node.js}/devenv.nix.jinja (100%) rename template/{{% if language == 'Rust' %}{{ project_name }}{% endif %} => Node.js}/devenv.yaml.jinja (100%) rename template/{{% if language == 'Node.js' %}{{ project_name }}{% endif %} => Node.js}/{{_copier_conf.answers_file}}.jinja (53%) rename template/{{% if language == 'Rust' %}{{ project_name }}{% endif %} => Python}/.devcontainer.json (100%) rename template/{{% if language == 'Node.js' %}{{ project_name }}{% endif %}/.editorconfig => Python/.editorconfig.jinja} (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/.envrc (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/.github/workflows/release.yml (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/.github/workflows/test.yml (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/.gitignore.jinja (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/.test.sh (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/README.md.jinja (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/devenv.nix.jinja (100%) rename template/{{% if language == 'Node.js' %}{{ project_name }}{% endif %} => Python}/devenv.yaml.jinja (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/pyproject.toml.jinja (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/src/{{ project_name }}/__init__.py.jinja (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/tests/__init__.py (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Python}/{{_copier_conf.answers_file}}.jinja (53%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %}/.editorconfig => Rust/.editorconfig.jinja} (100%) rename template/{{% if language == 'Rust' %}{{ project_name }}{% endif %} => Rust}/.envrc (100%) rename template/{{% if language == 'Rust' %}{{ project_name }}{% endif %} => Rust}/.github/workflows/test.yml (100%) rename template/{{% if language == 'Node.js' %}{{ project_name }}{% endif %} => Rust}/.gitignore.jinja (100%) rename template/{{% if language == 'Rust' %}{{ project_name }}{% endif %} => Rust}/README.md.jinja (100%) rename template/{{% if language == 'Node.js' %}{{ project_name }}{% endif %} => Rust}/devenv.nix.jinja (100%) rename template/{{% if language == 'Python' %}{{ project_name }}{% endif %} => Rust}/devenv.yaml.jinja (100%) rename template/{{% if language == 'Rust' %}{{ project_name }}{% endif %} => Rust}/{{_copier_conf.answers_file}}.jinja (53%) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7d1993e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# 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 diff --git a/copier.yaml b/copier.yaml index 273b67e..ca29c5a 100644 --- a/copier.yaml +++ b/copier.yaml @@ -52,19 +52,17 @@ 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 Inception šŸŽ‰, the gateway to your next big project! + \nWelcome 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! @@ -72,13 +70,13 @@ _message_before_copy: | Let's create something amazing! šŸš€āœØ _message_after_copy: | - šŸŽ‰ {{project_name}} Created Successfully! šŸŽ‰ + \nšŸŽ‰ {{project_name}} Created Successfully! šŸŽ‰ 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 šŸ§‘šŸ»ā€šŸ’» 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 index d0f5d97..e33c705 100644 --- a/includes/.copier-answers.yml +++ b/includes/.copier-answers.yml @@ -1 +1 @@ -{{ _copier_answers|to_nice_yaml -}} +{{ _copier_answers|to_nice_yaml -}} \ No newline at end of file diff --git a/includes/base.nix.jinja b/includes/base.nix.jinja index 9bc1e60..fbdd011 100644 --- a/includes/base.nix.jinja +++ b/includes/base.nix.jinja @@ -51,7 +51,9 @@ nixfmt-rfc-style bat jq + yq-go tealdeer + pipx # to use copier in projects {%- block packages %}{% endblock -%} ]; @@ -88,4 +90,4 @@ # https://devenv.sh/integrations/codespaces-devcontainer/ devcontainer.enable = true; -} \ No newline at end of file +} 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 100% rename from template/{% if language == 'Go' %}{{ project_name }}{% endif %}/devenv.nix.jinja rename to template/Go/devenv.nix.jinja 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/{% if language == 'Go' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja b/template/Go/{{_copier_conf.answers_file}}.jinja similarity index 53% rename from template/{% if language == 'Go' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja rename to template/Go/{{_copier_conf.answers_file}}.jinja index d6c44d6..cb786a7 100644 --- a/template/{% if language == 'Go' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja +++ b/template/Go/{{_copier_conf.answers_file}}.jinja @@ -1,2 +1,2 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -{% include pathjoin("includes", ".copier-answers.yml") %} +{% 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/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja b/template/Node.js/{{_copier_conf.answers_file}}.jinja similarity index 53% rename from template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja rename to template/Node.js/{{_copier_conf.answers_file}}.jinja index d6c44d6..cb786a7 100644 --- a/template/{% if language == 'Node.js' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja +++ b/template/Node.js/{{_copier_conf.answers_file}}.jinja @@ -1,2 +1,2 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -{% include pathjoin("includes", ".copier-answers.yml") %} +{% 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/{% if language == 'Python' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja b/template/Python/{{_copier_conf.answers_file}}.jinja similarity index 53% rename from template/{% if language == 'Python' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja rename to template/Python/{{_copier_conf.answers_file}}.jinja index d6c44d6..cb786a7 100644 --- a/template/{% if language == 'Python' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja +++ b/template/Python/{{_copier_conf.answers_file}}.jinja @@ -1,2 +1,2 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -{% include pathjoin("includes", ".copier-answers.yml") %} +{% 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/{% if language == 'Rust' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja b/template/Rust/{{_copier_conf.answers_file}}.jinja similarity index 53% rename from template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja rename to template/Rust/{{_copier_conf.answers_file}}.jinja index d6c44d6..cb786a7 100644 --- a/template/{% if language == 'Rust' %}{{ project_name }}{% endif %}/{{_copier_conf.answers_file}}.jinja +++ b/template/Rust/{{_copier_conf.answers_file}}.jinja @@ -1,2 +1,2 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -{% include pathjoin("includes", ".copier-answers.yml") %} +{% include pathjoin("includes", ".copier-answers.yml") %} \ No newline at end of file From 2c84e7a1f86829d5b239d3e56f2ed59f77c1ba27 Mon Sep 17 00:00:00 2001 From: Federico Zambelli Date: Thu, 24 Oct 2024 21:49:14 +0200 Subject: [PATCH 3/7] feat: add scripts for updating projects --- copier.yaml | 20 ++++++++++++++------ includes/base.nix.jinja | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/copier.yaml b/copier.yaml index ca29c5a..04b70d4 100644 --- a/copier.yaml +++ b/copier.yaml @@ -62,22 +62,30 @@ _tasks: - git commit -am 'This is the Inception šŸŽ‰' _message_before_copy: | - \nWelcome 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! + 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: | - \nšŸŽ‰ {{project_name}} Created Successfully! šŸŽ‰ - Your tailored project is ready and waiting for you. Next steps: + šŸŽ‰ {{project_name}} Created Successfully! šŸŽ‰ + + Your tailored project is ready and waiting for you. Next steps - 1. Allow direnv to load your project environment: + 1. Allow direnv to load your project environment $ direnv allow 2. Let's hack šŸ§‘šŸ»ā€šŸ’» Good Luck, DataChef šŸ§‘ā€šŸ³ + +_message_before_update: | + This is a test + +_message_after_update: | + This is also a test, but after diff --git a/includes/base.nix.jinja b/includes/base.nix.jinja index fbdd011..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 @@ -64,6 +94,8 @@ enterShell = '' hello show + check-inception-updates + {%- block enter_shell %}{% endblock -%} ''; @@ -79,6 +111,7 @@ enable = true; settings.preset = "relaxed"; }; + check-merge-conflicts.enable = true; {%- block hooks %}{% endblock -%} }; From aa36ff5cc3571ccd353750f1a5aa8e23321910a9 Mon Sep 17 00:00:00 2001 From: Federico Zambelli Date: Thu, 24 Oct 2024 22:10:59 +0200 Subject: [PATCH 4/7] chore: fix update message --- copier.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/copier.yaml b/copier.yaml index 04b70d4..44c7024 100644 --- a/copier.yaml +++ b/copier.yaml @@ -84,8 +84,6 @@ _message_after_copy: | Good Luck, DataChef šŸ§‘ā€šŸ³ -_message_before_update: | - This is a test - _message_after_update: | - This is also a test, but after + + šŸŽ‰ Project updated to latest Inception version! šŸŽ‰ From 08a6e8a6bb021f8275262978a70d72429aed3216 Mon Sep 17 00:00:00 2001 From: Federico Zambelli Date: Fri, 25 Oct 2024 09:37:28 +0200 Subject: [PATCH 5/7] docs: update readme to reflect changes --- README.md | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) 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: From 168d953c05db940d404d76a42a779de3d9ca4ebd Mon Sep 17 00:00:00 2001 From: Federico Zambelli Date: Fri, 25 Oct 2024 09:43:34 +0200 Subject: [PATCH 6/7] chore: fix line ending errors --- .editorconfig | 3 +++ .gitignore | 2 +- includes/README.release.md.jinja | 2 +- includes/go.gitignore | 2 +- includes/node.gitignore | 2 +- includes/python.gitignore | 2 +- includes/rust.gitignore | 2 +- template/Go/devenv.nix.jinja | 2 +- 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.editorconfig b/.editorconfig index 7d1993e..6c43334 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,3 +18,6 @@ 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/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/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/Go/devenv.nix.jinja b/template/Go/devenv.nix.jinja index 6e44925..8d7b75f 100644 --- a/template/Go/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 %} From 1bf861ba504d9274c1dc75de5b4beec377fbac73 Mon Sep 17 00:00:00 2001 From: Federico Zambelli Date: Fri, 25 Oct 2024 09:59:03 +0200 Subject: [PATCH 7/7] chore: fix typo --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 6c43334..5657f69 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,5 +19,5 @@ indent_size = 2 [{{_copier_conf.answers_file}}.jinja] insert_final_newline = false -[.copier-answers.yml]] +[.copier-answers.yml] insert_final_newline = false