@nauto/web-apps-archetype-dev
v0.4.0
Published
Builder archetype for Nauto's frontend applications (Development)
Downloads
12
Maintainers
Keywords
Readme
Web Apps Archetype
This package contains the builder archetype for Nauto's web applications.
Scripts
The following scripts are provided by the archetype and are meant to provide sensible defaults for development workflows on our web applications. They leverage a project's local tsconfig.json
and tslint.json
to determine which files are relevant for a particular script.
ENV variables
We're using webpack to inject some global variables to be used by both your application and by your build tooling:
process.env.NODE_ENV
- Is set to 'production' when using
NODE_ENV=production
, and 'development' otherwise.
- Is set to 'production' when using
process.env.APP_ENV
- Is set to the value of
NODE_ENV
- e.g. in
NODE_ENV=staging ne builder build
,process.env.APP_ENV
will be 'staging', andprocess.env.NODE_ENV
will be 'development'
- Is set to the value of
start
Runs a webpack
dev server with hot module reloading.
build
Runs webpack
with the --optimize-minimize
flag and the archetypal webpack configuration. Outputs to the dist/
folder. In order to build for a particular environment, you'll need to set NODE_ENV appropriately:
NODE_ENV=production ne builder run build
server
Runs an express server serving static files from dist/
; typically used with the build
script to serve its output.
lint
Runs tslint
against the files specified in your local tsconfig.json
test
Runs jest
with the archetypal configuration.
Examples
The following examples can be run from within a project using builder
and this archetype:
# list all available scripts
ne builder
# run an archetypal script
# (behavior can be overridden with a local script of the same name)
ne builder run <script-name>
Publishing the archetype to NPM
This is currently a manual process that will some day be automated:
# in projects/archetyp:
# bump versions of archetype
npm --no-git-tag-version version <version-type>
# sync with dev archetype
npm run builder:gen-dev
# commit
git commit
# tag
git tag @nauto/web-apps-archetype@<version-number>
# publish archetype
npm publish
# publish dev archetype
(cd dev && npm publish)
# push tags and code
git push && git push --tags
If that all succeeds, you should be able to start using your changes right away:
# in your app folder
yarn add @nauto/web-apps-archetype{,-dev}
Technology
- Node 8
- Yarn
- Typescript 2.7
- Webpack 3
- React 16
- React-Router 4
- Redux
- Styled-components
- Jest
- Cypress