Skip to content

Update rename feature in the init script to accept a prompt #157

@beeman

Description

@beeman

The init script supports renaming files and directories to a variable. In the example, it'll rename any instance of counter with the specified name of the project (eg directory it got created in).

It would be nice to support a prompt, probably with the syntax [[name]] and use the value of the name variable as the default.

This will allow the user to specify a different name for their program than the project name.

Once this is implement we need a follow-up issue to add a --yes flag to make sure that templates with a prompt can be installed automatically (for example on ci).

Flow

pnpm create solana-dapp@latest youtube-journal
# - pick the template
# init script runs and prompts:
> Rename instances of "counter" to: [name]
# Hitting enter will accept the default
# Entering a new value like `journal` it will use that.

Init script

{
  "name": "your-template",
  "create-solana-dapp": {
    // Rename is a map of terms to rename
    "rename": {
      // Rename every instance of counter
      "counter": {
        // Prompt for the value, defaulting to the name of the project
        "to": "[[name]]",
        // In the following paths
        "paths": ["anchor", "src"],
      },
    },
  },
}

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions