Package Exports
- @leanup/cli/babel.config
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@leanup/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
LEAN⭧up (CLI)
@leanup/cli shows how much is really required to develop, test and build a realisitic sized JavaScript web application.
- LEAN⭧up (CLI)
Motivation
- Learnability
- Controllability
- Universality
- Flexibility
- Scalability
- Durability
- Transparency
Tools and technologies
We use all tools and technologies without cluttered facades.
Principles
- convention over configuration
- pure commands under the hood
- don't repeat yourself
- following the generic instead of the influenced way
- keep the dependencies always up to date
Arguments
The arguments for and against this concept are documented here:
Pro
- select only one pure and popular tool for each use case (e.g. bundling, unit-test)
- there are extensible configuration files for each tool
- the CLI bundles all the necessary tools in a portable/scalable way
- the risk to get vulnerabilites in dependencies is lower
Contra
- please give feedback
- please show us your perspective
Demo
There are some working examples:
Installation
npm install @leanup/cli typescript --save-dev and npm audit fix
Install the peer dependencies chromedriver, geckodriver, graphql, selenium-server or typescript in the required version, if you need that feature.
npm install chromedriver --save-devnpm install geckodriver --save-devnpm install graphql --save-devnpm install selenium-server--save-devnpm install typescript --save-dev
Features
| Tool/Technology | Description | Status | Note |
|---|---|---|---|
| Babel | Transpiler | ✔️ | ready |
| Webpack | Bundler | ✔️ | ready |
| TypeScript | Language | ✔️ | ready |
| Mocha | Unit-Test-Runner | ✔️ | ready |
| Chai | Assertion | ✔️ | ready |
| Sinon | Mocking | ✔️ | ready |
| NYC | Code-Coverage | ✔️ | ready |
| ESLint | Code-Checker | ✔️ | ready |
| Nightwatch.js | E2E-Test-Runner | ✔️ | ready |
| Allsure | Report | ✔️ | ready |
| Cucumber | BDD | ✔️ | ready |
| Storybook | Documentation | ⌛ | upcoming |
| GraphQL | API | ✔️ | ready |
| Workbox | PWA | ✔️ | ready |
| Lerna | Mono-Repo | ✔️ | ready |
| Ant-Design | Material Design | ✔️ | proved |
| Material | Material Design | ✔️ | proved |
| Bootstrap | Material Design | ✔️ | proved |
| Less | CSS | ✔️ | proved |
| Sass | CSS | ✔️ | proved |
| Webhint | Webhint | ✔️ | moved *** |
| [TestCafe] | E2E-Test-Runner | ⌛ | is being evaluated **** |
| TSLint | Code-Checker | ❌ | removed ** |
| Cypress | E2E-Test-Runner | ❌ | excluded * |
* Arguments agains Cypress:
- reinvent wheel
- detect css selectors
- BDD test syntax
- principals
- large tooling
- a lot of binaries
- many dependencies
- ci integration vs selenium hub
It is difficult to keep focus with Cypress as it is more a nice tool than an effective tool. It is expected that a lot of time will be invested to justify the requirements of a project.
** TSLint is deprecated.
*** Webhint is not practical for the development of components, since component tags often have no relation to standard HTML. In addition, the webhint package alone is over 100 MB in size. I have good by using a IDE webhint plugin, like VSCode webhint.
**** [TestCafe] The idea that defined TestCafe architecture was that you don't really need an external driver to run end-to-end tests in the browser. That's interesting.
Structure
Vanilla Java-/TypeScript are supported by default. That means for example custom elements and any plain Java-/TypeScript code.
@leanup/cli✔️
Extensions
Frameworks
Vanilla Java-/TypeScript are supported by default. That means for example custom elements and any plain Java-/TypeScript code.
The selection of the following frameworks depends in parts on the following references:
Currently the following framework extensions are available:
@leanup/cli-angular✔️@leanup/cli-angularjs✔️@leanup/cli-aurelia✔️@leanup/cli-inferno✔️@leanup/cli-preact✔️@leanup/cli-react✔️@leanup/cli-svelte✔️@leanup/cli-vue✔️
Addons
A separate package contains some nice but not required addons for webpack.
Thinks
There a separate packages for important application features.
@leanup/features✔️@leanup/git-hooks✔️ NEW- @leanup/forms ⌛
@leanup/material-preact⌛@leanup/material-vanilla⌛
Usage
Command-Line-Interface (CLI)
If the CLI is also installed globally with npm install -g @leanup/cli, you can use the command lean directly in the bash.
If not, you must use npx and put it before the command. Like this: npx lean
Help
> lean -h(ornpx lean -h)
Usage: lean [options] [command]
Options:
-v, --version output the current version
-h, --help output usage information
Commands:
serve [options] Developing
build [options] Building
test [options] Unit-Testing
coverage Test-Coverage
e2e [options] E2E-Testing
format [options] Formatter
lint [options] LinterDeveloping
> lean serve -h(ornpx lean serve -h)
Usage: lean serve [options]
Developing
Options:
-f, --framework <framework> javascript framework (SPA)
-e, --environment <environment> technical environment (CMS)
-t, --template <template> corporate design (Style)
-o, --open open the default browser
-p, --port port
-h, --help output usage informationBuilding
> lean build -h(ornpx lean build -h)
Usage: lean build [options]
Building
Options:
-f, --framework <framework> javascript framework (SPA)
-e, --environment <environment> technical environment (CMS)
-t, --template <template> corporate design (Style)
-h, --help output usage informationUnit-Testing
> lean test -h(ornpx lean test -h)
Usage: lean test [options]
Unit-Testing
Options:
-w, --watch run tests in watch mode
-h, --help output usage informationTest-Coverage
> lean coverage -h(ornpx lean coverage -h)
Usage: lean coverage [options]
Test-Coverage
Options:
-h, --help output usage informationE2E-Testing
> lean e2e -h(ornpx lean e2e -h)
Usage: lean e2e [options]
E2E-Testing
Options:
--headless run tests in the headless mode
-h, --help output usage informationFormatter
> lean format -h(ornpx lean format -h)
Usage: lean format [options]
Formatter
Options:
-f, --fix fix the code format
-h, --help output usage informationLinter
> lean lint -h(ornpx lean lint -h)
Usage: lean lint [options]
Linter
Options:
-f, --fix fix the lint findings
-h, --help output usage informationScripts (NPM)
The following script commands are exactly the same executions that the CLI has under the hood.
Use this scripts in your package.json:
...
scripts {
"build": "webpack --colors --config=node_modules/@leanup/cli/webpack.config.js --mode=production",
"coverage": "cross-env NODE_ENV=test nyc mocha --config=node_modules/@leanup/cli/.mocharc.js && nyc check-coverage",
"e2e": "nightwatch --config=node_modules/@leanup/cli/nightwatch.conf",
"format": "prettier \"src/**/*\"",
"lint": "tslint \"src/**/*.ts*\"",
"serve": "webpack-dev-server --colors --config=node_modules/@leanup/cli/webpack.config.js --devtool=source-map --progress",
"test": "cross-env NODE_ENV=test mocha --config=node_modules/@leanup/cli/.mocharc.js"
}
...- Developing:
npm run serve -- [options] - Building:
npm run serve -- [options] - Unit-Testing:
npm run test -- [options] - Coverage:
npm run coverage - E2E-Testing:
npm run e2e -- [options] - Formatter:
npm run format -- [options] - Linter:
npm run lint -- [options]
Replaced environment variables
The following variable names are replaced by the values from package.json file in the bundle:
| Name | Description |
|---|---|
| APP_AUTHER | The value of the author attribute from the package.json file. |
| APP_HOMEPAGE | The value of the homepage attribute from the package.json file. |
| APP_NAME | The value of the name attribute from the package.json file. |
| APP_VERSION | The value of the version attribute from the package.json file. |
For example:
package.json:
{
"name": "@leanup/cli",
"version": "1.0.0-rc.219",
"description": "This CLI brings along all required tools to serve, test and build multi framework SPAs",
"author": "Martin Oppitz <npmjs@martinoppitz.com>",
"homepage": "https://github.com/martinoppitz/leanup#readme",
...App code:
const APP_METADATA = {
author: 'APP_AUTHER',
homepage: 'APP_HOMEPAGE',
name: 'APP_NAME',
version: 'APP_VERSION',
environment: 'NODE_ENV', // development | test | production ⌛
};
console.log(APP_METADATA);Dependencies
Peer dependencies
| Package | Size | Vulnerabilities |
|---|---|---|
| chromedriver | ||
| geckodriver | ||
| graphql | ||
| selenium-server | ||
| typescript |
Optional tools
| Package | Size | Vulnerabilities |
|---|---|---|
| @leanup/git-hooks | ||
| allure-commandline | ||
| lerna | ||
| workbox-cli |