Skip to content

`ligo init` templates & libraries from LIGO registry

Melwyn Saldanha requested to merge melwyn95/ligo_init_registry_templates into dev

Motivation and Context

It would be good for users to initialize boilerplate code from LIGO packages from the registry

Description

This MR adds a new feature that enables users to ligo init libraries/contracts from LIGO registry.

Also this MR makes the template check (from list) case insensitive.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement (non-breaking change that improves performance)
  • None (change with no changelog)

Changelog

New Feature

$ ligo init library --template @ligo/bigarray
Folder created: @ligo_bigarray

$ tree .
.
└── @ligo_bigarray
    ├── LICENSE
    ├── Makefile
    ├── README.md
    ├── examples
    │   ├── main.mligo
    │   └── package.json
    ├── lib
    │   └── bigarray.mligo
    ├── package.json
    └── test
        └── bigarray.test.mligo

4 directories, 8 files

Before

$ ligo.59 init contract --template nft-factory-cameligo
Error: Unrecognized template
Hint: Use the option --template "TEMPLATE_NAME" 

Please select a template from the following list: 
- NFT-factory-cameligo
- NFT-factory-jsligo
- advisor-cameligo
...

After

$ ligo init contract --template nft-factory-cameligo
Cloning into 'nft-factory-cameligo'...
remote: Enumerating objects: 166, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 166 (delta 2), reused 7 (delta 2), pack-reused 149
Receiving objects: 100% (166/166), 216.51 KiB | 6.98 MiB/s, done.
Resolving deltas: 100% (63/63), done.
Folder created: nft-factory-cameligo

Checklist:

  • Changes follow the existing coding style (use dune @fmt to check).
  • Tests for the changes have been added (for bug fixes / feature).
  • Documentation has been updated.
  • Changelog description has been added (if appropriate).
  • Start titles under ## Changelog section with #### (if appropriate).
  • There is no image or uploaded file in changelog
  • Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by Melwyn Saldanha

Merge request reports