Coder Social home page Coder Social logo

prjkt's Introduction

prjkt

Project scaffolding made easy!

Demo

Table of contents

Motivation

Heavily Inspired by degit. I liked the concept of it and what it had for plan. But by looking at repo it seems there's no development going on with it so i decided to make this while learning go.

Features

  • Clones the repo and removes git
  • Magically detects type of project and suggests automatic actions to easily setup new projects
  • Repos can have a config file to customize actions done after cloning of repo

For more progress check the Plan #1

Installation

With npm (Preferred)
npm i -g prjkt
prjkt help
With npx

You can directly run it

npx prjkt help
By cloning the repo
  1. Clone the repo
    git clone https://github.com/patheticGeek/prjkt.git
    
  2. Install
    go install .
    
  3. Test if it's working with
    prjkt help
    

Usage:

CLI usage:

Create

This will clone in the my-project folder and remove git from the project and run any actions if specified in repo or will detect the type of project and suggest some default actions.

prjkt create patheticGeek/pg-nextjs-boilerplate my-project
# or
prjkt c patheticGeek/pg-nextjs-boilerplate my-project
# or
prjkt c patheticGeek/pg-nextjs-boilerplate

The last one will create a folder called my-prjkt.

The repo can have a prjkt.yaml file that defines what actions should be done after cloning.

Create Flags

Create commands has some flags you can specify

  • preserve-git: Doesn't remove git from the project
    prjkt create --preserve-git patheticGeek/pg-nextjs-boilerplate
    
  • no-actions: Don't run any actions specified in prjkt.yaml
    prjkt create --no-actions patheticGeek/pg-nextjs-boilerplate
    
  • action: Specify a default action, this overrides the prjkt.yaml if preset
    prjkt create --action=node patheticGeek/pg-nextjs-boilerplate
    
    To check available default action see List default actions

NOTE: These flags come before the arguments (the url and destination)

List default actions

Lists all the available default actions

prjkt list-actions

More

For more details run:

prjkt help

For more details on create run:

prjkt help create

prjkt.yaml file

It's a simple file you can store in the root folder and does stuff after repo has been cloned.

Example file

Here's what a basic config would look like for a js project

welcome_message: "Getting things ready for ya mate"

actions:
  - 
    name: Delete readme, prjkt.yaml, lock file(s)
    type: delete
    files: README.md, prjkt.yaml, *lock*
  -
    name: Install dependencies
    type: exec-option
    prompt: Pick your poison
    options: pnpm, yarn, npm, none
    option-pnpm: pnpm i
    option-yarn: yarn
    option-npm: npm i
  -
    name: Set project name
    type: replace
    prompt: So what are we makin today?
    to_replace: <<project_name>>
    files: package.json, **/*.ts

no_actions_message: "Such a smart A$$"

error_message: "LOL this shit broke already!"

success_message: "This went smoother than it did while showing off to my friends! ✨ Enjoy"

For more templates/examples look here

Messages

You can have 3 types of messages:

  1. welcome_message: This shows up when the repo is cloned and before the actions have run
  2. error_message: This shows if there was an error in one of the actions
  3. success_message: This shows up if the actions run successfully
  4. no_actions_message: If user sets the no-actions flag this will be shown instead of success/error messages

Actions

There can be an actions array to define what to do after repo has been cloned The following actions are present currently:

  • replace: Replace a string in files with user input
    actions:
      -
        name: Set the project name
        type: replace
        # What user sees as the question
        prompt: Name of the project
        # The string to replace
        to_replace: <<project_name>>
        # The files to set the name in
        # Can be a glob pattern or file path
        files: package.json, **/*.ts
  • delete: Delete some files
    actions:
      - 
        name: Deleting readme, prjkt.yaml, lock file(s)
        type: delete
        # Files or globe patterns to delete
        files: README.md, prjkt.yaml, *lock*
  • exec: Execute a command
    actions:
      -
        name: Run a command
        type: exec
        # Command to run, will run in the project dir
        run: echo Hello world!
        # keep going even if this command fails (default: false)
        continue: true
  • exec-option: Execute command based on user's selection
    actions:
      -
        name: Install dependencies
        type: exec-option
        # The message user sees
        prompt: Pick your poison
        # options the user can choose from
        options: pnpm, yarn, npm, none
        # option-[user choice] will be ran
        # if key is not found just continue
        option-pnpm: pnpm i
        option-yarn: yarn
        option-npm: npm i

prjkt's People

Contributors

patheticgeek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

forkses

prjkt's Issues

Read config from prjkt.yml file in repo

  • Messages: Show a welcome, error, and success message based on how above things went

Actions to support for v0.1.0:

  • delete: Delete certain files (e.g. license.md)
  • run: Run some commands (e.g. npm install)
  • exec-option: Run some command based on user's selection (option list)
  • replace: Get user input and use that to replace a string in files (like for project name)

Have some default actions which can be passed with a flag

There can be some default prjkt.yamls which can be passed with a flag like --actions=python and that will run the corresponding actions file.

In the actions file we can store actions for multiple languages/frameworks like:

  • In case of python, pip install the requirements.txt
  • In case of node, have user choose the package manager and install requirements
    etc.

Plan

  • Support for multiple things in url
    • Short forms (username/repo)
    • Branch or tag name (username/repo#tag or username/repo@branch)
    • Sub dir (username/repo/dir)
  • #3
  • #5
  • #6
  • #8
  • #10
  • Cache the tarballs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.