-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd92a38
commit 94e5831
Showing
13 changed files
with
221 additions
and
99 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,5 @@ dist | |
|
||
# TernJS port file | ||
.tern-port | ||
|
||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Make sure to check the documentation at https://goreleaser.com | ||
before: | ||
hooks: | ||
- go mod tidy | ||
- go generate ./... | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
binary: mono | ||
archives: | ||
- replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
386: i386 | ||
amd64: x86_64 | ||
checksum: | ||
name_template: "checksums.txt" | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
brews: | ||
- name: mono-cli | ||
tap: | ||
owner: technikhil314 | ||
name: homebrew-mono-cli | ||
branch: main | ||
download_strategy: CurlDownloadStrategy | ||
commit_author: | ||
name: goreleaser | ||
email: goreleaser@technikhil314.com | ||
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" | ||
folder: Formula | ||
homepage: "https://technikhil314.netlify.app/docs/mono-cli/introduction" | ||
description: "Opinionated command line tool for managing all your project tasks." | ||
license: "MIT" | ||
install: | | ||
bin.install "mono" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,50 @@ | ||
# 1command | ||
# mono-cli | ||
|
||
Project based aliases for streamline your build and development flow. | ||
|
||
# Problem | ||
|
||
Right now when you are about run/build a new project you have to do the following | ||
Right now to run new project you have to do the following | ||
|
||
1. Look for what command starts the dev env | ||
2. Look for what command build the project | ||
3. and so for install dependancies, clean project and many other tasks | ||
1. read the docs just to find what should you run to get your development environment up | ||
2. But over the years dues tools like npm,yarn,maven,gradle the commands have some de-facto standard viz | ||
1. with `npm` you will run `npm start` or `npm run dev` | ||
2. with `maven` you will run `maven start` | ||
3. and so on | ||
3. yet every time you have to read throgh docs to find what command to run which is not good DX | ||
|
||
# Solution | ||
|
||
1. This cli tries to abstract away the actual commands as these commands are very tightly coupled with the framework or tech stack you are choosing. | ||
|
||
# How does it work | ||
|
||
1. It tries to detect multiple deciding factors like runtime, package manager, framework, bundler, linter, test runner, test framework | ||
2. Then it runs the default commands for each of mentioned factor like `npm install` or `webpack serve` etc | ||
|
||
# Advantages of using mono-cli | ||
|
||
1. imagine you have to jump between multiple projects like nextjs, create-react-app, remix.run etc. | ||
2. When you jump from nextjs to create-react-app the command change from `npm run dev` to `npm start` | ||
3. And you have to either recall that or check in the docs | ||
4. With mono-cli you have to remember just the verbs like install, buils, clean, start etc and prefix them with `mono-cli` and you have one command doing same job across projects. | ||
5. mono-cli internally detects things like what runtime, package manager, dev start commands to run and runs those commands on your behalf. | ||
6. See the [usage](#usage) section below to see the commands and their defaults | ||
|
||
# installation | ||
|
||
# Usage | ||
|
||
1. Add this code to your favourite shell init script | ||
2. install 1command using `npm install 1command` | ||
3. and then run following commands for each described task | ||
|
||
| command | Purpose | Supports | | ||
| ------- | ---------------------------------- | ---------------------------- | | ||
| install | install dependancies | npm, yarn, pnpn, lerna | | ||
| build | build your project | webpack, vite and frameworks | | ||
| clean | cleans your build directory | webpack, vite and frameworks | | ||
| start | start your development environment | webpack, vite and frameworks | | ||
2. and then run following commands for each described task | ||
|
||
| command | Purpose | Supports | Depends on | Default | | ||
| ------------ | ---------------------------------- | ---------------------------- | ------------------------------------------------------ | ------------------------------------------- | | ||
| mono install | install dependancies | npm, yarn, pnpn, lerna | lock files or monorepo config files | if no lock file found then defaults to pnpm | | ||
| mono build | build your project | webpack, vite and frameworks | framework or bundler <br/> config file in project root | defaults to `npm run build` | | ||
| mono clean | cleans your build directory | webpack, vite and frameworks | framework or bundler <br/> config file in project root | defaults to `npm run clean` | | ||
| mono start | start your development environment | webpack, vite and frameworks | framework or bundler <br/> config file in project root | defaults to `npm run start` | | ||
|
||
# License | ||
|
||
MIT |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
Copyright © 2022 NAME HERE <EMAIL ADDRESS> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// installCmd represents the install command | ||
var installCmd = &cobra.Command{ | ||
Use: "install", | ||
Short: "A brief description of your command", | ||
Long: `A longer description that spans multiple lines and likely contains examples | ||
and usage of using your command. For example: | ||
Cobra is a CLI library for Go that empowers applications. | ||
This application is a tool to generate the needed files | ||
to quickly create a Cobra application.`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println("install called") | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(installCmd) | ||
|
||
// Here you will define your flags and configuration settings. | ||
|
||
// Cobra supports Persistent Flags which will work for this command | ||
// and all subcommands, e.g.: | ||
// installCmd.PersistentFlags().String("foo", "", "A help for foo") | ||
|
||
// Cobra supports local flags which will only run when this command | ||
// is called directly, e.g.: | ||
// installCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
Copyright © 2022 NAME HERE <EMAIL ADDRESS> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// rootCmd represents the base command when called without any subcommands | ||
var rootCmd = &cobra.Command{ | ||
Use: "mono", | ||
Short: "A brief description of your application", | ||
Long: `A longer description that spans multiple lines and likely contains | ||
examples and usage of using your application. For example: | ||
Cobra is a CLI library for Go that empowers applications. | ||
This application is a tool to generate the needed files | ||
to quickly create a Cobra application.`, | ||
// Uncomment the following line if your bare application | ||
// has an action associated with it: | ||
// Run: func(cmd *cobra.Command, args []string) { }, | ||
} | ||
|
||
// Execute adds all child commands to the root command and sets flags appropriately. | ||
// This is called by main.main(). It only needs to happen once to the rootCmd. | ||
func Execute() { | ||
err := rootCmd.Execute() | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func init() { | ||
// Here you will define your flags and configuration settings. | ||
// Cobra supports persistent flags, which, if defined here, | ||
// will be global for your application. | ||
|
||
// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.mono-cli.yaml)") | ||
|
||
// Cobra also supports local flags, which will only run | ||
// when this action is called directly. | ||
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module github.com/technikhil314/mono-cli | ||
|
||
go 1.18 | ||
|
||
require ( | ||
github.com/inconshreveable/mousetrap v1.0.0 // indirect | ||
github.com/spf13/cobra v1.4.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= | ||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= | ||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= | ||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= | ||
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= | ||
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= | ||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= | ||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
Copyright © 2022 NAME HERE <EMAIL ADDRESS> | ||
*/ | ||
package main | ||
|
||
import "github.com/technikhil314/mono-cli/cmd" | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |
This file was deleted.
Oops, something went wrong.