@onelogin/web-scripts
Common scripts for OneLogin web projects
Last updated 10 months ago by onelogininc_dev .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @onelogin/web-scripts 
SYNC missed versions from official npm registry.

web-scripts

Collection of common scripts for React web projects inspired by react-scripts. With web-scripts we can have centralized and unified configuration for common tasks such as building, running in container, linting, code formating and many others. So our web projects don't have to maintain their own configuration.

Usage

Install web-scripts as dev dependency to your project

npm i -D @onelogin/web-scripts

use provided scripts by web-scripts in scripts within package.json in your project

"scripts": {
  "start": "web-scripts start",
  "start-local": "web-scripts start-local",
  "build": "web-scripts build-and-gzip",
  "test": "web-scripts test",
  "lint": "web-scripts lint src/**.js",
  "format": "web-scripts format src/**.js"
},
"husky": {
  "hooks": {
    "pre-commit": "web-scripts pre-commit"
  }
}

Running with IKE

HOWTO make your fronted service working with IKE

Available scripts

List of available scripts that you can use in your projects. All of them are opt-in so you specify which one should be used within package.json in your project (see Usage section above)

start

Target designed for IKE and running in docker container. It supports both dev mode and standard mode:

  • standard mode (regular start with IKE) compile your application into production like bundle and serve it via serve from container, it uses port specified in PORT ENV variable that IKE will also provide
  • dev mode (when you start you service with IKE using --dev flag) in this case IKE mounts folder with your project into container. Then it starts webpack-dev-server that serves your application. Whenever there is any change in source code of your applications, it recompiles your application and refresh browser to show new version (if you have it opened in browser)

There is dedicated page describing HOWTO make your fronted service working with IKE.

format

formats files provided as argument using Prettier (it use Prettier with default configuration)

lint

lint files provided as argument using eslint; (use linting rules defined by Create React App)

pre-commit

use lint-staged to automatically format and lint all modified files that you are trying to commit - it has to be registered via husky as pre-commit hook (see example configuration in package.json above)

start-local

locally on your computer starts webpack-dev-server serving your application, it uses default configuration coming from create-react-app. It is simple proxy to react-scripts start

test

run tests - it simple proxy to react-scripts test and it also pass all arguments to it (we didn't need any customization yet)

build-and-gzip

build a optimized bundle that is ready for use in production; gzip it and place output into build folder

Note on Create React App usage

web-scripts uses react-scripts version 3.x provided by Create React App under the hood so please make sure that your application is compatible with it.

Also react-scripts are installed as (transient) dependency into your project when you install web-scripts so your application should NOT declare react-scripts as direct dependency.

Debugging

If there is an issue with web-scripts in your project. You can set DEBUG ENV variable to web-scripts and execute problematic script from context of your project. Example:

DEBUG=web-scripts npx @onelogin/web-scripts build-and-gzip

It is going to execute build-and-gzip script from web-scripts in context of your project with debugging messages enabled. Note that web-scripts uses debug module to handle this.

Changelog

Changelog

Author

Matej Prokop mailto:matej.prokop@onelogin.com

Current Tags

  • 0.0.11-alpha.0                                ...           alpha (10 months ago)
  • 1.0.1-alpha.0                                ...           beta (10 months ago)
  • 1.0.1                                ...           latest (10 months ago)

16 Versions

  • 1.0.1                                ...           10 months ago
  • 1.0.1-alpha.0                                ...           10 months ago
  • 1.0.0                                ...           10 months ago
  • 0.0.11-alpha.2                                ...           10 months ago
  • 0.0.11-alpha.1                                ...           10 months ago
  • 0.0.11-alpha.0                                ...           10 months ago
  • 0.0.10                                ...           a year ago
  • 0.0.9                                ...           a year ago
  • 0.0.8                                ...           a year ago
  • 0.0.7                                ...           a year ago
  • 0.0.6                                ...           a year ago
  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.1                                ...           a year ago
  • 0.0.2                                ...           a year ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (7)
Dev Dependencies (1)
  • np 5.0.3
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |