Coder Social home page Coder Social logo

jsynowiec / node-typescript-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
2.6K 38.0 515.0 993 KB

Minimalistic project template to jump start a Node.js back-end application in TypeScript. ESLint, Jest and type definitions included.

License: Apache License 2.0

TypeScript 84.29% JavaScript 15.71%
typescript nodejs boilerplate project-template jest starter-template back-end serverless backend service

node-typescript-boilerplate's Introduction





Loading





node-typescript-boilerplate's People

Contributors

amitport avatar atefbb avatar dependabot[bot] avatar jbelelieu avatar jsynowiec avatar phra 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  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

node-typescript-boilerplate's Issues

Import file without .js extension

Thanks for creating this great template to help save tons of time configuring node typescript.

In the test code, the import statement contains the .js extension import { Delays, greeter } from '../src/main.js';, is there a way to get rid of the extension and make it simply import { Delays, greeter } from '../src/main';?

vscode configuration

Hi,
Can you add your vscode settings and launch to git? Do you have a debug and tests - debug configurations you can share ?
Great repo!

What is `tsutils` ?

I see that the package.json includes tsutils as a dev dependency, but even after reading the module's README, I have no idea what is does.

And since I don't see it being used / imported anywhere in the project, I've been wondering what it was used for ?

Live reloading

First I just want to thank you for providing this kind of work. I am pretty new in typescript and I am practising in the environment. I just wanted to make things work like in vanilla javascript that's why I used nodemon for live reloading. There are build commands which compile typescript to javascript in npm scripts but are there any option for vscode to run compiled program in development server. I used
npm run build:watch in the first terminal and in second one nodemon /build/src/main.js it is working but I just want to be sure is that the way you are working or are there any downside of this approach, thanks.

tsconfig lib option and node-fetch

What is the purpose of

"lib": ["ES2022"],

in the tsconfig file?


If it isn't needed can it be removed as it seems to cause the following build errors with node-fetch:

node_modules/fetch-blob/from.d.ts:20:64 - error TS2749: 'File' refers to a value, but is being used as a type here. Did you mean 'typeof File'?

20 export function fileFrom(path: string, type?: string): Promise<File>;
                                                                  ~~~~

node_modules/fetch-blob/from.d.ts:25:60 - error TS2749: 'File' refers to a value, but is being used as a type here. Did you mean 'typeof File'?

25 export function fileFromSync(path: string, type?: string): File;
                                                              ~~~~

node_modules/formdata-polyfill/esm.min.d.ts:2:11 - error TS2749: 'FormData' refers to a value, but is being used as a type here. Did you mean 'typeof FormData'?

2   new (): FormData;
            ~~~~~~~~

node_modules/formdata-polyfill/esm.min.d.ts:3:14 - error TS2749: 'FormData' refers to a value, but is being used as a type here. Did you mean 'typeof FormData'?

3   prototype: FormData;
               ~~~~~~~~

node_modules/formdata-polyfill/esm.min.d.ts:5:50 - error TS2749: 'FormData' refers to a value, but is being used as a type here. Did you mean 'typeof FormData'?

5 export declare function formDataToBlob(formData: FormData): Blob;
                                                   ~~~~~~~~

node_modules/node-fetch/@types/index.d.ts:124:4 - error TS2749: 'FormData' refers to a value, but is being used as a type here. Did you mean 'typeof FormData'?

124  | FormData
       ~~~~~~~~

node_modules/node-fetch/@types/index.d.ts:137:22 - error TS2749: 'FormData' refers to a value, but is being used as a type here. Did you mean 'typeof FormData'?

137  formData(): Promise<FormData>;
                         ~~~~~~~~


Found 7 errors in 3 files.

Errors  Files
     2  node_modules/fetch-blob/from.d.ts:20
     3  node_modules/formdata-polyfill/esm.min.d.ts:2
     2  node_modules/node-fetch/@types/index.d.ts:124
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `tsc -p tsconfig.json`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Misleading ESLint error suppression comment

Hi there,

In main.ts, starting on L26, there is the following comment:

// Below are examples of using ESLint errors suppression
// Here it is suppressing a missing return type definition for the greeter function.

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types

I was really confused because after removing the comment, VSCode didn't raise an error in the line containing the function signature. I looked into .eslintrc.json and found the corresponding ESLint plugin defined and also 2 extensions from that plugin, leading me to assume that the rule (explicit-module-boundary-types) was already activated, especially considering the fact that you use it as an example in your boilerplate code. After explicitly activating the rule via the rules field, it started working as intended.

I think it would more sense to use a different, i.e. activated-out-of-the-box, rule as an example for ESLint error suppression examples.

Jest issue

When I use the boilerplate and try and add and import statement it throws an error in jest

SyntaxError: Cannot use import statement outside a module

Screen Shot 2022-04-03 at 3 13 14 PM

npm run lint doesn't work on windows

When running on Windows I found two problems with tslint, with pretty easy fixes:

  1. single quotes can't be used

Easy fix in package.json:
BEFORE:

"lint": "tslint -t stylish --type-check --project 'tsconfig.json'",

AFTER:

"lint": "tslint -t stylish --type-check --project \"tsconfig.json\"",
  1. CRLF causing linting errors

Easy fix in tslint.json
ADD:

"linebreak-style": false

Sigh, windows...

Error when using your boilerplate

When I delete all example code I'm getting the following error:

Cannot read tslint configuration - 'Failed to load d:\Coding\management-pannel\tslint.json: Invalid "extends" configuration value - could not require "tslint-microsoft-contrib/recommended". Review the Node lookup algorithm (https://nodejs.org/api/modules.html#modules_all_together) for the approximate method TSLint uses to find the referenced configuration file.'tslint(1)

Is this only on my side or is there sth. broken?

//Edit: Even with the vanilla boilerplate I'm getting this error

wrong paths in the build

When I'm trying to work with path package and access some files in the main.ts file it doesn't build well. In the build paths are related to the build/main.js file. But files are in the src directory. I'm new in the node.js, I can't find solution on the Internet. Sorry for the stupif question

fix setTimeout call

hi,

i'm quite sure that you made a typo in setTimeout call in main.ts.
i'm sending a PR to fix that.

Documentation: index.d.ts

It could be good to have an index.d.ts file in the root to work in your project and you can use on the fly

Use Yarn

I love your project, but it would be great if we could use Yarn since it's faster for dependency management.

Remove tsutils

Hello there.

I noticed that your project contains tsutils; this library hasn't been maintained for a year now, creating problems to others libraries like typescript-eslint.

Check this discussion link here and evaluate to remove it and clean your NPM dependencies.

Best regards and thanks for your work.

Running npm run test hangs

It seems that jest is hanging for some reason on the current version of the repo.

I am using node v10.15.3 and npm 6.4.1

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.