npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dyna-ts-app-boilerplate

v1.1.11

Published

About

Downloads

4

Readme

About

Webpack configuration for ES5/ES6 for Typescript Node.js application.

Debug with devTools and test with Jest.

This boilerplate consist of minimum configuration and dependencies to create a Module written in Typescript.

Have fun!

Install

  • Clone this repo, call git clone https://github.com/aneldev/dyna-ts-app-boilerplate.git my-ts-app
  • Change directory to my-ts-app
  • Call npm run create-app or
  • Call npm run create-app-with-react to support also React components and JSX syntax
  • Update the package.json with version and repository.url
  • You are ready!

Develop

General

The source code of your project is under the src/ folder.

Debug

There are several options how to debug your application. You can debug it on nodeJs or in any web browser.

So you can test your module on how much compatible is in different environments.

Debug on any web browser with browser's debugger

Call npm run debug-browser to start the builder and open a dev server (via webpack).

Open http://localhost:8027/ address in any browser.

In this case there is no need to start additionally a builder as the other options, webpack takes care of it.

You can use any web browser to test it.

Debug on nodeJs with devTools (via node --inspector)

Call npm run debug-build to start the builder. This builder watches your changes made in debug/ & src/ folders.

Call npm run debug-devtools to start and debug with the devTools debugger of your Chrome browser.

Alternatively, you can call npm run debug-devtools-brk (with -brk at the end) to place a breakpoint on startup of the app to catch early points.

Open chrome://inspect/#devices to list the debuggable instances in your localhost, you should see your app there to debug it.

Alternatively, copy paste the link generated from debug-devtools; it is something like this: chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/659747f3-20d7-45d9-8f8d-48c707d6f5eb

The debugger is the debugger of your Chrome's browser, you should have Chrome to use.

Debug on nodeJs with node-debug

Dependency, you have to npm install -g node-inspector.

Call npm run debug-build to start the builder. This builder watches your changes made in debug/ & src/ folders.

Call npm run debug-inspector to start and node-debug your app.

You can close the devTools and this script will be called again to instantiate new devTools (changes in your code will be loaded at this point).

Alternatively, can call npm run debug-inspector-brk (with -brk at the end) to place a breakpoint on startup of the app to catch early points.

The debugger will start automatically (as web page) in your default browser. The debugger works only in Chrome.

Run debug code

Call npm run debug-build to start the builder. This builder watches your changes made in debug/ & src/ folders.

Call npm run run-debug-build and will run you debug application on node.js.

The built code, ready to run is under the debug-ground/debug-app-on-nodejs path.

Test

Write tests

For tests the Jest is used, check the documentation.

Test files can be everywhere but they should have name *.(test|spec).(ts|tsx|js|jsx). There is tests/ folder if you want to use it but this is not a limitation.

Run tests

Call npm run test to run your tests and coverage. This test also builds your application, ts errors can be shown here.

Call npm run test-only to run your tests only including coverage, no build no ts errors.

Call npm run test-watch to run your tests on any changes, no build, no ts errors, no coverage.

Debug tests (experimental)

There is a small mock library where works like Jest but supports only some of the Jest functions. This is the test/mock-jest.js file where behave like Jest and can run on any browser and of course under node.js.

It doesn't support all the comparisons and features of the Jest but it helps to debug the test files. Feel free to fork it or suggest another way how to debug Jest test files.

The debug test commands are similar to the debug app commands.

Debug test in any browser

  • Run debug-test-browser
  • The browser will be opened at http://localhost:8023

Debug test with devtools

  • Run debug-test-build where builds your test code
  • Run debug-test-devtools or debug-test-devtools-brk

Debug test with node-inspector

  • Run debug-test-build where builds your test code
  • Run debug-test-inspector or debug-test-inspector-brk

Dist / Release

Call npm run dist or npm run release to create a distributable version of your project under the dist/ folder.

The package configuration exports the dist/ folder so you have to call the npm run dist every time you want to publish this package. The typescript declarations are there out of the box.

When you deploy your application on server side there is no need to run npm install. The dist folder has everything and it is ready to run. The typescript declaration are useless there (are only for debugging), your whole application is ins the dist/index.js.

Server or Container holders are executing the npm start, where in the package.json is configured to run the dist/index.js.

Start

start starts the compiled application under the dist/ folder.

You should dist before call this.

Others

dyna-ts-module-boilerplate

Create ts modules (not apps) with dyna-ts-module-boilerplate

dyna-ts-react-module-boilerplate

This boilerplate includes React components, only to support the jsx syntax. This boilerplate is not intended for React components. You can work with React and export it, JSX syntax is also supported but there is no friendly environment to develop. For React check dyna-ts-react-module-boilerplate. You can safely remove the react from this boilerplate.

References

Webpack configuration