Specify various templates for different directories and create them with one click. 🤩

Overview

English | 简体中文

Gold Right

Specify various templates for different directories and create them with one click.

Reason

Usually there is something in the project directory in a particular format, code snippet, configuration, directory structure, etc... Copying or right-clicking a new file frequently doesn't make us any more productive, so maybe we can make right-clicking easier.

Demo

demonstrate.mov

installation

After Gold-Right is installed and reload VS Code, Gold-Right is automatically enabled

Usage

  1. Specifies the template directory location, which can be specified under workspace configuration or user configuration
# Specify the templates folder in the root directory
{
    # Relative to the current workspace path
    "goldRight.templateDirectoryPath": "./templates"
    "goldRight.templateDirectoryPath": "templates"
    # An absolute path
    "goldRight.templateDirectoryPath": "/Users/user-name/Gold-Right-example/templates"
}
  1. Create the configuration (config.json) file in the template directory
{
  "paths": [
    { 
      "directory": "src/pages",
      # Use the components/hooks templates for ”src/pages“
      "templates": ["components", "hooks"]
    },
    {
      "directory": "src/hooks",
      # Use the hooks template for ”src/hooks“
      "templates": ["hooks"]
    }
  ],
  "templatesConfig": [
    {
      # Define the configuration for the Components template
      "templateName": "components",
      "inputsVariables": [
        {
          # Define the "[COMPONENT_NAME]" variable, and open the prompt box to enter the variable content
          "key": "[COMPONENT_NAME]",
          # The title of prompt box.
          "title": "Please input component name.",
          # If the this field is empty, creation will stop.
          "required": true
        }
      ]
    },
    {
      # Define the configuration for the hooks template
      "templateName": "hooks",
      "inputsVariables": [
        {
          # Define the "[HOOKS_NAME]" variable, and open the prompt box to enter the variable content
          "key": "[HOOKS_NAME]",
          # The title of prompt box.
          "title": "Please input hooks name."
        }
      ]
    }
  ]
}
  1. Create templates

The directory structure

./templates
├── components
|   |   # The directory name "[COMPONENT_NAME]" will be replaced with the input.
│   └── [COMPONENT_NAME]
│       ├── index.tsx
│       └── styles.css
├── config.json
└── hooks
|___|   # The directory name "[HOOKS_NAME]" will be replaced with the input.
    └── [HOOKS_NAME]
        └── index.ts

./templates/components/[COMPONENT_NAME]/index.tsx

import React from 'react';
import './styles.css';

export interface [COMPONENT_NAME]Props {

}

export const [COMPONENT_NAME]: React.FC<[COMPONENT_NAME]Props> = props => {
    return <div></div>
}

./templates/hooks/[HOOKS_NAME]/index.ts

import React from 'react'

export const [HOOKS_NAME] = () => {
  return React.useState()
}

Sponsors

License

MIT

You might also like...

This is a dependency-free easy-to-use vanilla JavaScript addon allowing you to create HTML currency inputs with various different currencies and formattings.

intl-currency-input This is a dependency-free easy-to-use vanilla JavaScript addon allowing you to create HTML currency inputs with various different

Jan 4, 2023

A VSCode extension to execute terminal command in multiple directories.

A VSCode extension to execute terminal command in multiple directories.

SiteFlex 😼 Introduction The emergence of microservices and microfrontends posed a real threat on lazy programmers. Consider this scenario, you have m

Sep 6, 2022

A webpage where the user can search for different TV shows, comment them and like them.

A webpage where the user can search for different TV shows, comment them and like them.

TV Shows In this project we built a webpage where the user can search for different TV shows, comment them and like them. Video Built With Major langu

Jul 9, 2022

⚡Chrome extension allows you to create lists of Google and Github dork to open multiple tabs with one click, import "scope/out of scope" from #HackerOne #Bugcrowd #Intigriti ...

⚡Chrome extension allows you to create lists of Google and Github dork to open multiple tabs with one click, import

FastDork v0.1 This chrome extension allows you to create lists of Google and Github dork to open multiple tabs with one click, import "scope/out of sc

Dec 31, 2022

This project will be using various AI and Rule Engine algorithm to detect various attack against a company!

This project will be using various AI and Rule Engine algorithm to detect various attack against a company!

📌 Introduction This project will be using various AI and Rule Engine algorithm to detect various attack against a website! 📌 Mission After starting

Apr 29, 2022

This is a Webpack based to-do-list project. With this app, users can add thier daily routine tasks to the list, mark them as complet, edit them or delete them.

To Do List This is a Webpack based to-do-list project. With this app, users can add thier daily routine tasks to the list, mark them as complet, edit

Oct 30, 2022

Service Installer for VMware Tanzu is a one-click automation solution that enables VMware field engineers to easily and rapidly install, configure, and operate VMware Tanzu services across a variety of cloud infrastructures.

Service Installer for VMware Tanzu Service Installer for VMware Tanzu seeks to provide a one-click automation solution to enable our VMware engineers

Dec 1, 2022

For NUS PhD Students and Staffs, just one click to open the research papers on Google Scholar/IEEE/ACM, etc. with this script.

For NUS PhD Students and Staffs, just one click to open the research papers on Google Scholar/IEEE/ACM, etc. with this script.

NUS Literature Quick Access For National University of Singapore's students and staffs, just with one single click you can open any paper without the

Nov 30, 2022

Chrome extension to simulate cryptoblades fights, giving you the win rate % against all enemies with just one click

Chrome extension to simulate cryptoblades fights, giving you the win rate % against all enemies with just one click

CryptoBlades fight simulator This is a Chrome extension that will help you to know the exact win rate percentage you have on each cryptoblades fight.

Aug 7, 2022
Comments
  • Cannot create from templates

    Cannot create from templates

    Hello there, I just installed the extension and configured it like so:

    ./.vscode/settings.json

    {
        "goldRight.templateDirectoryPath": "./.templates"
    }
    

    ./.templates/config.json

    {
      "paths": [
        {
          "directory": "src/components",
          "templates": ["components"]
        }
      ],
      "templatesConfig": {
        "templateName": "components",
        "inputsVariables": [
          {
            "key": "[FEATURE_NAME]",
            "title": "Please input feature name.",
            "required": true
          },
          {
            "key": "[COMPONENT_NAME]",
            "title": "Please input component name.",
            "required": true
          },
          {
            "key": "[COMPONENT_CAMEL]",
            "title": "Please input component camel case name.",
            "required": true
          },
          {
            "key": "[COMPONENT_STORY_TITLE]",
            "title": "Please input component story title.",
            "required": true
          }
        ]
      }
    }
    

    My folder structure looks like this:

    .templates
    ├── components
    │   └── [FEATURE_NAME]
    │       └── [COMPONENT_NAME]
    │           ├── [COMPONENT_NAME].props.ts
    │           ├── [COMPONENT_NAME].stories.ts
    │           ├── [COMPONENT_NAME].vue
    │           ├── _[COMPONENT_NAME].scss
    │           └── _[COMPONENT_NAME].vars.scss
    └── config.json
    

    I see nowhere a command which I could trigger to create the files. The demo video you provided in the readme is also not available.

    Can you help out?

    opened by khusseini 1
Owner
赵東澔
Developers who develop anything.
赵東澔
Create folder of snippets to activate them in one click !

-> FR Obsidian Group Snippet This plugin allow you to set group of CSS snippets to class them and enable them in one click (or command). Also, this pl

Lisandra Simonetti 8 Dec 31, 2022
A simple to do list webpage where you can log the daily tasks you have to do, mark them as checked, modify them, reorder them and remove them. Made using HTML, CSS and JavaScript.

To-Do-List This Webpage is for an app called To-Do-List which helps you add, remove or check tasks you have to do. It is a simple web page which conta

Zeeshan Haider 9 Mar 12, 2022
Zemi is data-driven and reverse-routing library for Express. It provides out-of-the-box OpenAPI support, allowing you to specify and autogenerate an OpenAPI spec.

zemi zemi is a data-driven routing library for Express, built with Typescript. Features: optional, out-of-the-box support for OpenAPI reverse-routing

Yoaquim Cintrón 5 Jul 23, 2022
An application where a user can search a location by name and specify a genre of music. Based on the parameters entered, a list of radio stations generate based on genre selected in that area.

Signs of the Times Description An application that allows for the user to enter a date and see the horoscope for that day, and famous people born on t

null 3 Nov 3, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A generative engine that takes various png layers on a sprite sheet format, combines them and then converts them into a .gif file

Welcome to the Generative GIF Engine v2.0.4 ?? [8 minute read] This python and node app generates layered-based gifs to create NFT gif art! It is fast

Jalagar 112 Jan 2, 2023
A generative engine that takes various png layers on a sprite sheet format, combines them and then converts them into a .gif file

Welcome to the Generative Animated Engine v3.0.1 ?? [8 minute read] This repo used to be called jalagar/Generative_Gif_Engine but because it now suppo

Jalagar 47 May 24, 2022
⛺️ Tipi is a homeserver for everyone! One command setup, one click installs for your favorites self-hosted apps. ✨

⛺️ Tipi — A personal homeserver for everyone ⚠️ Tipi is still at an early stage of development and issues are to be expected. Feel free to open an iss

Nicolas Meienberger 4.9k Jan 4, 2023