lagleki / webpack-typescript-rust-boilerplate

MIT License
0 stars 0 forks source link

Webpack 5 Typescript Rust Boilerplate Template

Maintenance webpack-current node-current (scoped) Build Status webpack-typescript-rust-boilerplate GitHub Issues Known Vulnerabilities npm GitHub License

Based on https://github.com/WeAreAthlon/frontend-webpack-boilerplate with additions of Rust and TypeScript.

Demo

Table of Contents

Features

"browserslist": [
    "last 2 versions",
    "> 5%"
]

Requirements

Setup

Installation

  1. Choose and download the latest template release from List of Releases.
  2. Extract the release archive to a new directory, rename it to your project name and browse the directory.
  3. Install all dependencies using the following command:
$ yarn install --immutable  --immutable-cache --check-cache

Define Package Metadata

Configuration

Environment Configuration

Additional webpack configuration

You can additionally configure webpack for specific environment:

Development

Assets Source

Build Assets

One time build assets for development

$ yarn build

Build assets and enable source files watcher

$ yarn watch

This command is suitable if you develop with external web server.

Note: File watching does not work with NFS (Windows) and virtual machines under VirtualBox. Extend the configuration in such cases by:

module.exports = {
  //...
  watchOptions: {
    poll: 1000 // Check for changes every second
  }
};

Start a development server - reloading automatically after each file change.

$ yarn dev

Production

Build Assets

Optimize assets for production by:

$ yarn production

Get Built Assets

Run Code Style Linters

SASS

$ yarn lint:sass

JavaScript

$ yarn lint:js

Additional Tools

Run Assets Bundle Analyzer

$ yarn stats

This will open the visualisaion on the default configuraiton URL localhost:8888, you can change this URL or port following the package documentation.

Continuous Integration

This boilerplate template contains integration with Travis CI. The build system runs all linting scripts and deploys production optimized pages to GitHub pages upon push to the master branch. However, note that this deployment flow only works for Project Pages, as User and Organization pages only support the master branch flow.

For more information on how to set up alternative deployment processes, check out the Travis CI documentation on deployment. The service can deploy to dozens of cloud providers, including Heroku, AWS, and Firebase.