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

hybrid-boilerplate

v1.2.0

Published

hybrid handlebar and react boilerplate

Downloads

5

Readme

hybrid-boilerplate

boilerplate suitable for project that need React for app and client side and handlebar for server side rendering.
this boilerplate use Rollup to Build web-component and pages and use webpack to run react and has live module reloading too.
you can have simple server rendered html css js web-component for website and multiple react app in one project with shared dependancy
we have web-component builder so you can build your own web component in project
we use multi staging app setting additional to NODE_ENV so you can choose if you want to build in production mode or develop mode and by set APP_STAGE env variable for your internal use such as choose right URL base on your envirement or log strategy or other logical reason you have dev, uat, release, main ,...
you can have multi react app and multi non react page with customizable url
you can load data in nodejs server and render it serverside for SEO need

stack

  • ReactJS
  • MobX
  • Handlebar
  • Sass
  • ExpressJs
  • Rollup
  • Webpack
  • Rust

usage

for development

1- clone the project
2- run npm i
3- run npm start

for production

1- clone from your git 2- run npm i
3- set NODE_ENV and APP_STAGE
4- run npm run build
5- run npm run serve

environment variables

| env variable name| values | | ------------- | ------------- | | NODE_ENV | development, production | | App_Stage | dev, test, release, main,... |

commands

set envirement variable on windows:

$env:APP_STAGE="dev"

we have 3 main command in our boilerplate

1- build: this command will build your source code using rollup & webpack and store built file in app/dist folder. remember that app/dist don't contain all of your apps source and just contain builded source so other assetsand filed are needed to run the project. 2- serve: will run built application so you can see app with browser 3- start: will build and serve app. this command will run build in watch mode so you must run it only in development env. see React apps webpack analytics report:

npm run analysis

it will open analytic report of your app package so you can detect heavy package of your app. remember you cant run this command before you build your project and you have to build your project once before run this command.

build wasm projects:
open terminal in project root ant type

wasm-pack build --target web

using WASM

cargo install wasm-pack  

build wasm projects:
we just put hello-world lib as a sample in wasm folder. you can modify it or create new WASM library in wasm folder.

cargo new --lib wasm/hello-wasm2

After that to biuld your library do the following:
open terminal in project root folder for example wasm/hello-world and type

wasm-pack build --target web

styling

sass

hybrid-boilerplate support sass for hbs , html , web-component and react apps. in web-component and react apps ypu can easily import sass file in your js/ts file:

import './style.scss';

for handlebar or simple html file you may compile scss to css, then use it in your page. to doso you should add your sass file to config/build-config.js in sassFiles section like this:

sassFiles:[
        {
            //orginal path of file
            path:'/app/assets/styles/pages/your-file.scss',
            //determine where we put compiled css after compile
            outputPath:'/app/dist/assets/styles/pages/your-file.css',
            //you can make watch true to decrease build and watch overhead and run npm run build manually every time you need to build the sass file
            watch:true
        },
    ]

and then use link tag in your html file to access compiled css

styled component

you can use styled component only in react apps by just writing them and importing them in your component. we recommend to define your global styles class in sass files and define your specific element and components styles in styled component files to make your code flexible and maintainable as best as it could be.

folder structure:

  • app: all front-end code will be placed here.learn more...
  • command: executable npm commands like serve and build will be code there. learn more...
  • config: whole app configs are placed there. learn more...
  • server: if you have custom express server
  • wasm: for rust wasm code if you have one.