Giter Club home page Giter Club logo

gev's Introduction

PRs Welcome TypeScript npm npm

gev

A slightly opinionated tool to fastly create new projects with a single command. My projects are generated by this.

Creating new Typescript projects' environments is a real pain. Takes lots of minutes, sufferings and procrastinations to leave it functional and in the way we feel confortable. We know how boring it is!

๐Ÿ“– Usage:

npx gev <flavor> # To use the current directory as destination and package name. Directory emptiness will be checked.

npx gev <flavor> <newPackageName> # To create a new directory and use it as the package name. Directory existence will be checked.

npx gev -h # For help and all commands and options available.

Current available flavors are:

ts: Typescript

ts-esm: Typescript ESM

expo: Expo

expo-pkg: Expo/React-Native package

rn: React Native

next: NextJS

chrome-react: Google Chrome extension with React

All the flavors uses Typescript. There may be other flavors that I didn't add here yet, run npx gev -h for all the latest flavors.

To supress the npm@7 possible npx confirmation message, you can use npx -y gev.

๐Ÿ”ฎ Future

  • vsce, cli flavors

  • Interactive menu to add other badges and the paypal button to the README.

  • jest integration

  • Allow custom setups. It could be something like npx gev -u githubUsername. This could really be a good way for people to have their own environment setup without too much work.

  • npx gev would open an interactive menu to choose the desired initializer or change user options.

๐Ÿ“ฐ Changelog

gev's People

Contributors

srbrahma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gev's Issues

NPM publish doesn't include empty dirs

https://stackoverflow.com/questions/47456617/why-did-npm-deleted-empty-folder-when-published-package-to-npm-registry

The only solution I can think of is:

Have a prebuild script that will find empty dirs in the semitemplates and write them in a .json, like

emptyDirs.json

{
  "expo": [
    "src/components/common",
    "src/components/contexts",
  ] 
}

etc. Store it maybe on data/. On applySemitemplates(), those would be created for the current flavor.

This apply isn't require on dev env, as the empty dirs exists on local semitemplate dir.

Add dirs structure and files to expo flavor

  • screens/.
  • main/ for consts.ts, index.tsx... in the root it gets quickly polluted.
  • components/
  • stores/ | classes/ for mobx? Edit ~6 months later, I no longer use mobx as it makes code less predictable and readable. Using React Context now.

Recall with @latest, Interactive menu, user chosen dependencies

Quick soon todo/free thinking:

  1. Check gev version and recall with @latest if not latest already (as npx will unfortunatelly use old versions if available in cache) done in 2.2.0

  2. Interactive menu to choose the flavor, project name, dest path (maybe)

    • Called with just npx gev? This would require removing ts as default flavor.
    • Would npx gev ts also have a interactive menu? Or only npx gev ts -i would do it?
  3. Multiple common dependencies to be additionally installed. They could all be in the root, but could also be categorized. As my common deps wouldn't be the same as everyone else's and having all the deps showing there would be a huge pollution, there could be the common ones (like most popular ones), but also the user saved ones. This could also be set in the future user personal flavor. The user could also write the deps' names to add / find them (this is similar to the idea I sent to the vscode/typescript team on a seasonal form, and then to an extension idea I already had*). The main flavor (template) could still be the ts, but with the spices (those additional and specific configs). There could be an option in the interactive menu like Use personal spice and the user saved spices would show there. But maybe both concepts wouldn't be clear to separate one from the other. Anyway, the user flavors/spices would be accessible via local storage or github repo / gist. Just the username could be entered, and it would look for public repos (or private ones if logged) and the desired spice could then be selected, if multiple ones are present.

There could be a user@ts template, but also a user@ts#expo. Maybe, just using user@ts would ask for the spice. user@ts# would use the default one the user has. Maybe it's getting more complex than it should.

* -> 4) I could do a gev extension for the VsCode. Instead of calling it by the terminal, it would also be possible to use it via GUI in vscode. Not really hard to do but as it certainly would translate to a cli call, I need the cli structure to be in its final form. It's all coming together!

Command to update scripts in existing project

Quite a pain to fix/improve a script in multiple projects and to ensure they are using the latest one.

It would replace existing scripts and add new ones to the end (maybe after a new line). It can have an interactive menu to update it, but perhaps just printing the latest scripts will do it.

Something that worked for tsconfig would also do it.

There could be a unified way to set the common scripts with a function in the program instead of defining each one individually.

Add .editorconfig

E.g.

# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

# change these settings to your own preference
indent_style = space
indent_size = 2

# we recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

(https://github.com/callstack/react-native-paper/blob/main/.editorconfig).

Read other projects' .editorconfig to make the best one.

Add cli flavor

cli flavor = ts flavor + additional packages: commander, chalk, ora.

Will have an index.ts with basic commander code.

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.