Giter Club home page Giter Club logo

ts-cmd-tools's Introduction

What's that?

A starter kit for creating scripts to run in the terminal

Install

git clone https://github.com/R00T80Y/ts-cmd-tools my-script && cd my-script

pnpm install

pnpm run dev

Project Structure

  • /src
    • /utils
      • execute.ts - Wrapper for running terminal commands
    • index.ts - Program entry point usually nothing needs to be changed here
    • opts.ts - Here are the settings for commander.js
    • main.ts - The main file of your script

How to use it?

To create a js file and place it in the system

# Create the final script file
pnpm run build

# Change the script version in package.json
npm pkg set version=0.0.2

# Runs ./scripts/deploy.sh which will do:
# 1. Copies the final copy of the script to $HOME/Documents/scripts/
# 2. Will create a link to it in $HOME/bin/$NAME-script
pnpm run deploy

# Running the script (If you need to change the name of the script,
# you can do it in the "name" field of the package.json file)
ts-cmd-tools-script --version

To create an executable file you need to do the following

# Pkg is used to create executable files
pnpm install -g pkg

# Create an executable file. The file will need to be in ./dist/bin
pnpm run buildexec

Problems

deploy.sh

Error: cp: cannot create regular file '$HOME/Documents/scripts/$FILENAME.js': Permission denied

The error occurs when you try to overwrite a previously created script file with the same version. Possible solutions to the problem:

  1. Modifying the version in package.json

    • Open package.json
    • Find the line with "version"
    • Update version
  2. Deleting a file that was previously created

    • Go to $HOME/Documents/scripts cd $HOME/Documents/scripts
    • Delete the file called name_in_package_json + "-v-" + version_in_package_json + ".js"
  3. Modification of "deploy.sh"

    • Open ./scripts/deploy.sh
    • Go to line 28. Change the permissions on the file "644" chmod -R 644 $HOME/Documents/scripts/$FILENAME
    • Proceed to step 2

ts-cmd-tools's People

Contributors

nnu17ip1y avatar

Watchers

 avatar

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.