GithubHelp home page GithubHelp logo

vitorsalgado / create-nodejs-ts Goto Github PK

View Code? Open in Web Editor NEW
132.0 3.0 27.0 13.79 MB

Starter Project for Node.js With TypeScript.

Home Page: https://www.npmjs.com/package/create-nodejs-ts

License: MIT License

JavaScript 67.85% Makefile 11.60% Shell 2.73% TypeScript 12.41% Dockerfile 5.41%
nodejs nodejs-boilerplate typescript typescript-boilerplate scaffold project-scaffolding esm javascript

create-nodejs-ts's Introduction

Node.js Starter ToolKit

Starter Project for a Node.js application using TypeScript with all boring stuff already configured.

GitHub Action Status npm Prettier Conventional Commits

Overview

Starter project for Node.js applications using TypeScript with test, lint, code formatter already configured. Check the tooling section for more details.
The preferable way to use this boilerplate is using npx command. You can use npm init too.
Use the following commands to bootstrap a new project:

NPX

npx create-nodejs-ts --no --app=your-app

NPM Init

npm init nodejs-ts -- --app=your-app

Without parameters, the project will be created on a folder my-app in the same directory where you executed the command.
All parameters available:

--destination=<FOLDER_DESTINATION> Defaults to the current directory
--app=<APP_NAME> Defaults to my-app

The final folder will the parameter destination, if provided, concatenated with the parameter app.

ESM

The project template now uses ESM by default.

Docker

Minimalist docker image generation.
Check this Dockerfile.

Local Dev Environment

Run make up to spin up a local environment with Docker Compose.
Check this docker-compose.yml for more details.

Tooling

  • ESM
  • TypeScript
  • Jest
  • EsLint
  • Husky
  • Commit Lint
  • Lint Staged
  • Prettier
  • Nodemon
  • Docker | Docker Compose

License

FOSSA Status

This project is MIT Licensed.

create-nodejs-ts's People

Contributors

dependabot[bot] avatar ghwass93 avatar vitorsalgado avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

create-nodejs-ts's Issues

How it works with docker for development

Hi, thank you for your project, i have question how it's supposed to work in development?
I try this command:
docker-compose -f deployments/dev/docker-compose.yml up
But there is no npm install in Dockerfile.dev so there is no nodemon and npm start fail.
Did i missing something ?

启动时提示,node不是内容命令

错误如下:
node is not recognized as an internal or external command

启动时提示,node不是内容命令,有人提示是环境变量错误,经过我检查node的环境变量是正确的。

解决办法:填写具体的node路径,
改制前
"start:dev": "nodemon --ext js,ts,json,env --exec "node --experimental-specifier-resolution=node --loader ts-node/esm" src/main.ts",
改之后
"start:dev": "nodemon --ext js,ts,json,env --exec "C://PROGRA~1//nodejs//node --experimental-specifier-resolution=node --loader ts-node/esm" src/main.ts",

jest test failed to run

Describe the bug
Test suit fails. I suspect it is related to ES modules.
In this case the test was launched by a VSCode add-in for Jest. I will research and add more details.
Repro setup just like #385, but I ran git and npm install.

** messages **

[my-app]: Scheduled test run "watch-tests-1" for "orta.vscode-jest:my-app"
 FAIL  src/main.spec.ts
  ● Test suite failed to run

    src/main.spec.ts:25:39 - error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

    25     const dir = dirname(fileURLToPath(import.meta.url))
                                             ~~~~~~~~~~~

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        3.21 s

* Screenshot *

![image](https://user-images.githubusercontent.com/2715647/179315420-bd6038da-b13e-41d3-a660-b35ec153fd0a.png)

Install app name is wrong

Describe the bug
By the readme Install app name is wrong

To Reproduce
Steps to reproduce the behavior:
npx create-nodejs-ts --no --app=bot

it will create a folder named my-app

Expected behavior
a folder created named bot
Screenshots

Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
i checked the source, it should use --name instead of --app arg

vscode warnings when editing freshly generated project

Describe the bug
After generating a project with create-nodejs-ts, when I open the project using Microsoft Visual Studio Code (vscode) several error messages are popping up saying that some of the add-ins are terminating.

To Reproduce
Steps to reproduce the behavior:

  1. From c:\try I execute npm create nodejs-ts, creating a \try\my-app directory
  2. code my-app opens the vscode editor

** Observed **
VSCode has outputs errors related to jest. It is complaining that an external process running jest has terminated. The text says:

'"jest.cmd"' is not recognized as an internal or external command,
operable program or batch file.
Jest process "watch-tests" ended unexpectedly
 see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting

Expected behavior
Normal VsCode startup

Diagnosed Issue
The template seemed to have left out two steps VsCode assumes have been done.

  • git init
  • npm install (or equivalant)

It obviously wasn't a big deal to figure that out, but for less experienced devs, executing those steps would be great.

Screenshots
If applicable, add screenshots to help explain your problem.

image

Environment (please complete the following information):

  • OS: Windows 11 Pro. version 22H2, (OS Build 22621.232)
PS C:\Try\my-app> npm -v
8.13.2
\\PS C:\Try\my-app> node -v
v18.5.0
PS C:\Try\my-app> code -v
1.69.1
b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a
x64

Additional context

Thanks, for your efforts so far. This is obviously only a minor glitch.

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.