Skip to content

Commit

Permalink
fix(workflow): this commit fixes staging, adds a --no-optimize flag, …
Browse files Browse the repository at this point in the history
…updates the readme, and fixes the release error
  • Loading branch information
Brandon Robinson authored and Brandon Robinson committed Sep 4, 2020
1 parent 8137e54 commit 15bcc6a
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 43 deletions.
4 changes: 2 additions & 2 deletions example/project/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Formik } from 'formik';
import PageHeader from '@availity/page-header';
import { Container, Card } from 'reactstrap';
import * as yup from 'yup';
import Form from '@/components/Form';
import chain from '@/chain';
import Form from './components/Form';
import chain from './chain';

const App: React.SFC<{}> = () => (
<Container className="container-sm">
Expand Down
94 changes: 59 additions & 35 deletions packages/workflow/README.md
Original file line number Diff line number Diff line change
@@ -1,96 +1,123 @@
# CLI

## Table of Contents
* [NPM](#npm)
* [Commands](#commands)
* [help](#help)
* [start](#start)
* [lint](#lint)
* [build](#build)
* [release](#release)
* [profile](#profile)
* [test](#test)

- [NPM](#npm)
- [Commands](#commands)
- [help](#help)
- [start](#start)
- [lint](#lint)
- [build](#build)
- [release](#release)
- [profile](#profile)
- [test](#test)

## NPM

> NPM requires `--` between the command and options
```bash
npm run <command> -- <options>
```

## Commands

### `help`

Show help menu for all CLI options.

### `init <projectName>`

#### Positionals
`projectName` Required. The name of the project you want to create.

`projectName` Required. The name of the project you want to create.

#### Options
- `--version`, `-v`: Specify which version of the plugin project you want. [default: "latest"]
- `--current-dir`, `-c`: If you want the project to be created in the current directory
- `--template`, `-t`: The template you want to initialize the projec with

- `--version`, `-v`: Specify which version of the plugin project you want. [default: "latest"]
- `--current-dir`, `-c`: If you want the project to be created in the current directory
- `--template`, `-t`: The template you want to initialize the projec with

#### Examples
- `npx @availity/workflow init my-package-name`
- `npx @availity/workflow init my-package-name --template https://github.com/Availity/availity-starter-angular`
- `npx @availity/workflow init my-package-name --version 4.0.0-alpha.4`

- `npx @availity/workflow init my-package-name`
- `npx @availity/workflow init my-package-name --template https://github.com/Availity/availity-starter-angular`
- `npx @availity/workflow init my-package-name --version 4.0.0-alpha.4`

### `start`
Start the development server and watches for file changes. Hot-reloading is enabled for React projects. Angular projects hot reload CSS only.

Start the development server and watches for file changes. Hot-reloading is enabled for React projects. Angular projects hot reload CSS only.

#### options

##### `--dry-run`

Start the development server using production settings. **Example:**

`npm start -- --dry-run`

### `lint`

Lint project files using EsLint.

#### options

##### `--include`

Include additional glob patterns for linting.

##### `--ignore-git-untracked`

Ignore files that are not indexed by git.

##### `--disable-linter`

Disable linter when creating bundles for production or staging.

### `build`
- Cleans up `/dist` folder
- Bundles project assets into the `/dist` folder

- Cleans up `/dist` folder
- Bundles project assets into the `/dist` folder

### `release`
- Prompts the user for a version
- Cleans up `/dist` folder
- Bundles project assets into the `/dist` folder
- Tags the version in Git

- Prompts the user for a version
- Cleans up `/dist` folder
- Bundles project assets into the `/dist` folder
- Tags the version in Git

#### `--no-optimize`

-Bundles javascript assets without minifying

`npm run production --no-optimize`

#### NODE_ENV

##### `production`

Minifies the javascript assets.

##### `staging`

No minification is done on javascript assets

#### options

##### `--dry-run`
- Disables committing files to git
- Disables creating a git tag

- Disables committing files to git
- Disables creating a git tag

Skipped tasks will print a message in the console

```bash
ℹ [ Dry Run ] Skipping version bump
```

### `profile`
Analyze Webpack bundles and find what is contributing their sizes. This command generates an html graphical chart that automatically opens in the browser as well as a text summary report in the console.

Analyze Webpack bundles and find what is contributing their sizes. This command generates an html graphical chart that automatically opens in the browser as well as a text summary report in the console.

```
› Webpack profile:
Expand All @@ -114,14 +141,15 @@ css-loader: 2.14 KB (0.157%)
<self>: 11.71 KB (0.859%)
```


### `test`
Run the tests for your project. The behavior of the test are determined by the plugin used in the workflow engine. The engine supports `@availity/workflow-plugin-react` (Jest) and `@availity/workflow-plugin-angular` (Karma and Chrome|Firefox|IE) plugins.

Run the tests for your project. The behavior of the test are determined by the plugin used in the workflow engine. The engine supports `@availity/workflow-plugin-react` (Jest) and `@availity/workflow-plugin-angular` (Karma and Chrome|Firefox|IE) plugins.

#### options

##### `--coverage`
Indicates that test coverage information should be collected and reported in the output. React project leverage the `--coverage` option from Jest. Angular projects use Instanbul to collect coverage metrics. Angular projects output coverage statistics to the console as well as html files in the `{workspaces}/coverage` folder.

Indicates that test coverage information should be collected and reported in the output. React project leverage the `--coverage` option from Jest. Angular projects use Instanbul to collect coverage metrics. Angular projects output coverage statistics to the console as well as html files in the `{workspaces}/coverage` folder.

```bash
› Started testing
Expand All @@ -137,17 +165,13 @@ Lines : 27.23% ( 7955/29217 )
```

### `about`
Awesomeness.

Awesomeness.

## Disclaimer

Open source software components distributed or made available in the Availity Materials are licensed to Company under the terms of the applicable open source license agreements, which may be found in text files included in the Availity Materials.

## License
[MIT](../../LICENSE)





[MIT](../../LICENSE)
3 changes: 2 additions & 1 deletion packages/workflow/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node
if (process.env.NODE_ENV === 'staging') {
process.env.NODE_ENV = 'development';
process.argv.push('--no-optimize');
process.env.NODE_ENV = 'production';
}
const yargs = require('yargs');
const chalk = require('chalk');
Expand Down
3 changes: 1 addition & 2 deletions packages/workflow/scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ async function release({ settings }) {
await version.tag();
Logger.success('Finished releasing');
} catch (error) {
Logger.failed(`Failed releasing:
${error}
Logger.failed(`Failed releasing - fix errors and retry.
`);
throw error;
}
Expand Down
5 changes: 2 additions & 3 deletions packages/workflow/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const Joi = require('@hapi/joi');
function argv() {
return yargs.argv;
}

function stringify(obj) {
each(obj, (value, key) => {
if (isString(value)) {
Expand Down Expand Up @@ -313,7 +312,7 @@ const settings = {
},

isStaging() {
return this.environment() === 'staging';
return this.environment() === 'production' && process.argv.includes('--no-optimize');
},

isIntegration() {
Expand Down Expand Up @@ -345,7 +344,7 @@ const settings = {
},

isProduction() {
return argv().production || this.environment() === 'production';
return (argv().production || this.environment() === 'production') && !process.argv.includes('--no-optimize');
},

isDistribution() {
Expand Down

0 comments on commit 15bcc6a

Please sign in to comment.