Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI Create Command: --template URL Option #768

Closed
dOrgJelli opened this issue Mar 22, 2022 · 1 comment · Fixed by #1529
Closed

CLI Create Command: --template URL Option #768

dOrgJelli opened this issue Mar 22, 2022 · 1 comment · Fixed by #1529
Assignees
Milestone

Comments

@dOrgJelli
Copy link
Contributor

dOrgJelli commented Mar 22, 2022

Support the creation of new projects from externally hosted template project repositories like so:
polywrap create --template ${url}

Initially, the first supported ${url} types can be git. In the future we can support other folder-based-repository protocols (like IPFS for ex).

@dOrgJelli
Copy link
Contributor Author

dOrgJelli commented Mar 28, 2022

Implementation Details

Sanitize Template URLs

We should require the URL to be properly formatted, so that we may infer the protocol the user wants to use (Git, IPFS, Zip, etc). For Git URLs, we should require it to be the form of http(s)://<domain(/path)>.git. If a URL is provided without .git at the end, we should throw an error.

The reason for not defaulting to git, even in the cases where .git is not appended, is so that we do not introduce a breaking change in the future when other protocols are supported. For example, if a user was able to use polywrap create --template https://domain.com/package with the first version of this feature, in the future they would be broken when we introduce another template URL type.

Downloading Git Repositories

Use the git root-level process available via issuing a new shell command in a child-process (git clone ${url}). The Polywrap CLI's codebase currently has a similar dependency on docker for the build command.

We should first clone the template repository into the CLI's cache folder (${project_root}/.w3/), under a sub-path (/templates/${uuid}). Once downloaded, all files (excluding the .git folder) should be copied into the user's ${project_root} folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants