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-showcase

v3.0.1

Published

Create showcase of your React component(s)

Downloads

34

Readme

About

Webpack configuration for ES5/ES6 React components written in Typescript to be used as a module in other apps.

Develop, debug, test and distribute react component(s) easy.

Installation

git clone http://github.com/aneldev/dyna-ts-react-module-boilerplate my-awesome-react-component
cd my-awesome-react-component
npm run create

That's it.

What is the difference with the create-react-app?

create-react-app creates react applications, includes whatever an application needs.

dyna-ts-react-module-boilerplate creates modules, it creates react components that will be used in react applications.

Instead of create-react-app use the create-react-app-typescript where is forking the create-react-app and supports Typescript.

Develop

Implement

The source code of your project is under the src/ folder only. What will be distributed is what it is exported from the src/index.tsc.

There are loaders for various files, like: .less, .scss, .svg, .jpg, etc.. Loaders are loaded in webpack.loaders.js, where you can add your own loaders that will be used from all tasks (npm scripts).

Under the dev/scripts/ folder there is a small web application that uses this component with one or more ways. By this way you can develop, debug and make a showcase of how your component(s) can be used.

Under the dev/public/ folder is the http folder of the application, you should not do anything there because this is not distributed.

Develop / Debug

Implement your component(s) under src/.

Implement the usage of your components(s) under dev/script/;

Call npm start.

Open in any browser http://localhost:3220 to preview, dev or debug.

Preview

Call npm start.

Test

Write tests

For tests is used the Jest also check the documentation.

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

Run tests

Call npm run test to run your tests and coverage. This test also build 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.

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 call npm run dist every time you want to publish this package. The typescript declarations are there out of the box.

The output is not compressed, while it is intended to be used in other apps where there will be bundled and compressed there.

The output of your package is what it is extracted only from your src/index.jsx.

Tip 1: During development, there is no need to call the dist on any code change, you can import the src/ folder of this module like this: import MyReactComponentModule from 'my-module/src'; instead of import MyReactComponentModule from 'my-module';.

Tip 2: You can link this module with your main application using the npm link for more reading https://docs.npmjs.com/cli/link.

Tip 2.1: With npm > 5.0.0 the above link can be made defining the "file:xxx" instead of the version number, for more reading https://docs.npmjs.com/cli/link.

Have fun

Feel free to clone and fork.

Interesting for typescript module?

If you are interesting for typescript module, with other words if you want to implement everything like we do here but not exporting directly a react component, check this dyna-ts-module-boilerplate repo.

References

Webpack configuration