From ed164dd6723a7329435336a18e8afdb48a870ec8 Mon Sep 17 00:00:00 2001 From: Viktor Vincze Date: Mon, 28 Jan 2019 17:13:49 +0100 Subject: [PATCH] docs(structure): improvement --- docs/configs/babel.md | 2 -- docs/configs/eslint.md | 2 -- docs/configs/gitignore.md | 2 -- docs/configs/jest.md | 2 -- docs/configs/manifest.md | 2 -- docs/configs/mhy.md | 16 ++++++---------- docs/configs/npmignore.md | 2 -- docs/configs/prettier.md | 2 -- docs/configs/storybook.md | 2 -- docs/configs/tslint.md | 2 -- docs/configs/typescript.md | 2 -- docs/configs/webpack.md | 2 -- docs/ide-setup/storm.md | 20 +++++++++----------- docs/others/development.md | 8 +++----- docs/others/faq.md | 6 ++---- docs/others/help.md | 8 +++----- docs/processes/babel.md | 16 +++++++--------- docs/processes/eslint.md | 14 ++++++-------- docs/processes/jest.md | 16 +++++++--------- docs/processes/prettier.md | 12 +++++------- docs/processes/storybook-start.md | 2 -- docs/processes/tsc.md | 12 +++++------- docs/processes/webpack-dev-server.md | 12 +++++------- docs/processes/webpack.md | 12 +++++------- 24 files changed, 63 insertions(+), 113 deletions(-) diff --git a/docs/configs/babel.md b/docs/configs/babel.md index 0434404..32818b7 100644 --- a/docs/configs/babel.md +++ b/docs/configs/babel.md @@ -1,7 +1,5 @@ # babel -## babel - [https://babeljs.io/docs/en/options](https://babeljs.io/docs/en/options) ```bash diff --git a/docs/configs/eslint.md b/docs/configs/eslint.md index 942747f..abcb231 100644 --- a/docs/configs/eslint.md +++ b/docs/configs/eslint.md @@ -1,7 +1,5 @@ # eslint -## eslint - [https://eslint.org/docs/user-guide/configuring](https://eslint.org/docs/user-guide/configuring) ```bash diff --git a/docs/configs/gitignore.md b/docs/configs/gitignore.md index 08a31e5..875d892 100644 --- a/docs/configs/gitignore.md +++ b/docs/configs/gitignore.md @@ -1,7 +1,5 @@ # gitignore -## gitignore - [https://git-scm.com/docs/gitignore](https://git-scm.com/docs/gitignore) ```bash diff --git a/docs/configs/jest.md b/docs/configs/jest.md index 6ab21d3..981eb78 100644 --- a/docs/configs/jest.md +++ b/docs/configs/jest.md @@ -1,7 +1,5 @@ # jest -## jest - [https://jestjs.io/docs/en/configuration.html](https://jestjs.io/docs/en/configuration.html) ```bash diff --git a/docs/configs/manifest.md b/docs/configs/manifest.md index 84d0eb8..a6d1c3f 100644 --- a/docs/configs/manifest.md +++ b/docs/configs/manifest.md @@ -4,8 +4,6 @@ Used by `webpack` to generate `manifest.json` WebApp Manifest file. -## manifest - ```bash # Print config to console mhy config manifest diff --git a/docs/configs/mhy.md b/docs/configs/mhy.md index b00ea51..3310b35 100644 --- a/docs/configs/mhy.md +++ b/docs/configs/mhy.md @@ -1,19 +1,15 @@ # mhy -## mhy - `mhy` is being built using `mhy` :\) Just like `npm` is a package on `npm`. It's core configuration values are stored using `mhy` also. -## manifest - ```bash # Print config to console mhy config mhy ``` -### Options +## Options -#### `defaultIndexHtml` +### `defaultIndexHtml` The `index.html` file to load when using `webpack`. @@ -21,19 +17,19 @@ Default is provided by `mhy`: `resources/index.html` > You can use your own by putting it to your `src` folder. Not necessary to overwrite this value. -#### `srcFolder` +### `srcFolder` Folder to your source files from you project root. Default: `src` -#### `defaultIgnoreList` +### `defaultIgnoreList` An array including the list of filenames needed to be excluded in general \(like cache folders, log files, etc\). Both `gitignore` and `npmignore` configs are extending this list. > Please see source file for details. -#### `defaultAliases` +### `defaultAliases` Aliases provided for `Babel` and `TypeScript` imports. @@ -45,7 +41,7 @@ Example: `import Foo from '@/components/foo'` > Please note that previously aliases were provided for certain folders as `@components`. These are being **DEPRECATED** and should not be used. The new way is more flexible and avoids collision with NPM namespaces. -#### `ecosystem` +### `ecosystem` The ecosystem you want to load when simply run `mhy` or `mhy ui`. diff --git a/docs/configs/npmignore.md b/docs/configs/npmignore.md index db37d2b..f37444b 100644 --- a/docs/configs/npmignore.md +++ b/docs/configs/npmignore.md @@ -1,7 +1,5 @@ # npmignore -## npmignore - [https://docs.npmjs.com/misc/developers\#keeping-files-out-of-your-package](https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package) ```bash diff --git a/docs/configs/prettier.md b/docs/configs/prettier.md index 77a13ac..a3031a7 100644 --- a/docs/configs/prettier.md +++ b/docs/configs/prettier.md @@ -1,7 +1,5 @@ # prettier -## prettier - [https://prettier.io/docs/en/configuration.html](https://prettier.io/docs/en/configuration.html) ```bash diff --git a/docs/configs/storybook.md b/docs/configs/storybook.md index fad9c51..335075a 100644 --- a/docs/configs/storybook.md +++ b/docs/configs/storybook.md @@ -1,7 +1,5 @@ # storybook -## storybook - > Currently only `start` options are available. Support for standalone Storybook build will come soon\)\*\[\]: [https://storybook.js.org/configurations/cli-options/](https://storybook.js.org/configurations/cli-options/) diff --git a/docs/configs/tslint.md b/docs/configs/tslint.md index 7696141..6d8ebf8 100644 --- a/docs/configs/tslint.md +++ b/docs/configs/tslint.md @@ -1,7 +1,5 @@ # tslint -## tslint - [https://palantir.github.io/tslint/rules/](https://palantir.github.io/tslint/rules/) ```bash diff --git a/docs/configs/typescript.md b/docs/configs/typescript.md index 9442027..6e0bab7 100644 --- a/docs/configs/typescript.md +++ b/docs/configs/typescript.md @@ -1,7 +1,5 @@ # typescript -## typescript - * [https://www.typescriptlang.org/docs/handbook/compiler-options.html](https://www.typescriptlang.org/docs/handbook/compiler-options.html) * [https://www.typescriptlang.org/docs/handbook/tsconfig-json.html](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) diff --git a/docs/configs/webpack.md b/docs/configs/webpack.md index 3a0af14..db2ecf2 100644 --- a/docs/configs/webpack.md +++ b/docs/configs/webpack.md @@ -1,7 +1,5 @@ # webpack -## webpack - [https://webpack.js.org/configuration/](https://webpack.js.org/configuration/) ```bash diff --git a/docs/ide-setup/storm.md b/docs/ide-setup/storm.md index 2c8366a..d078f01 100644 --- a/docs/ide-setup/storm.md +++ b/docs/ide-setup/storm.md @@ -1,32 +1,30 @@ # storm -## WebStorm and PHPStorm - -### Search for global `node_modules` folder (GLOBAL_NODE_MODULES) +## Search for global `node_modules` folder (GLOBAL_NODE_MODULES) 1. Use the `which mhy` (`where mhy` on Windows) command to find the path to the `mhy` executable file. 2. The _global_ `node_modules` folder should be around there somewhere. It varies between different systems, maybe it is right next to it, maybe inside a `lib` directory next to it or the upper levels. 3. Inside the _global_ `node_modules` folder, you'll find `mhy/node_modules`. The path to that directory is what we will need. -### Generate every possible config files +## Generate every possible config files ```bash mhy config // Use -o to overwrite existing files ``` -### `node_modules` resolution +## `node_modules` resolution Since you're using modules coming from `mhy`, you need to tell the IDE to include a `node_modules` folder outside your project's directory. 1. Find `GLOBAL_NODE_MODULES/mhy/node_modules` 2. Add the path at `File > Settings > Directories` and mark it as `Excluded` and `Resource root`. -### Alias resolution +## Alias resolution Alias resolution is done by Webpack. You only need to have a `webpack.config.js` file in your root. 1. **ONLY** in case you haven't run `mhy config` yet to set-up your empty project, run `mhy config webpack -i` to initialize a config file. 2. Make sure at `File > Settings > Webpack` that the feature is turned on. -### Prettier (for automatic formatting on save; recommended) +## Prettier (for automatic formatting on save; recommended) While it's possible to add watchers without the `Prettier plugin`, the plugin simply helps you with pre-filling the necessary fields with the necessary values for your watcher. 1. Install `Prettier plugin` from `File > Settings > Plugins` @@ -41,7 +39,7 @@ While it's possible to add watchers without the `Prettier plugin`, the plugin si > Unfortunately you'll need to create watcher for each `File Type` you want the IDE to watch. By default it was creating it only for JavaScript. Most probably you want to add `jsx, ts, tsx` watcher also. Do this with copying the watcher and change the `File Type`. -### TypeScript +## TypeScript > Step 0: If it's necessary, please do `npm i` first for your project, only create `tsconfig.json` file after that. This is important to avoid duplicated `@types` to be loaded. 1. **ONLY** in case you don't have `tsconfig.json` file yet: `mhy config typescript -i` @@ -50,19 +48,19 @@ While it's possible to add watchers without the `Prettier plugin`, the plugin si > Note that in `mhy` TypeScript is only being used to perform type-checks and to generate `.d.ts` files. You don't need to enable compilation, that is being done by Babel. -### ESLint +## ESLint 1. **ONLY** in case you don't have `.eslintrc` file yet: `mhy config eslint -i` 2. Go to `File > Settings > Language & Frameworks > JavaScript > Code Quality Tools > ESLint` 3. `Enable` 4. For `ESLint package` set `GLOBAL_NODE_MODULES/mhy/node_modules/eslint` -### TSLint +## TSLint 1. **ONLY** in case you don't have `tsconfig.json` file yet: `mhy config tslint -i` 2. Go to `File > Settings > Language & Frameworks > JavaScript > TSLint` 3. `Enable` 4. For `TSLint package` set `GLOBAL_NODE_MODULES/mhy/node_modules/tslint` -### Tips +## Tips 1. Disable automatic `package.json` dependency inspection. 2. Disable statement termination inspection. `CTRL+Enter` at the end of any line. (ONLY in case you choose to continue using ASI which is the default setting.) 3. Set 4 spaces for indent. (ONLY in case you choose to continue using the default setting.) diff --git a/docs/others/development.md b/docs/others/development.md index 3f47a6c..139ebe1 100644 --- a/docs/others/development.md +++ b/docs/others/development.md @@ -1,8 +1,6 @@ # Development -## Development - -### Setup environment +## Setup environment 1. Fork repository 2. Rewrite `name` and `bin` key to something else \(eg: `mhyd` for dev\). @@ -11,10 +9,10 @@ 5. Create PR when done. > Use `npm run build -- --watch` to watch for file changes. -> + > The name rewrite is needed because `mhy` itself is being built using `mhy` which is why you also need an untouched stable version of it. -### Creating processes/commands +## Creating processes/commands Coming soon... diff --git a/docs/others/faq.md b/docs/others/faq.md index f5e03db..091aafb 100644 --- a/docs/others/faq.md +++ b/docs/others/faq.md @@ -1,12 +1,10 @@ # FAQ -## FAQ - -### Are there any upcoming features? +## Are there any upcoming features? You can always follow our continuous TODO list here: [https://github.com/wintercounter/mhy/issues/1](https://github.com/wintercounter/mhy/issues/1) -### Why no more question? +## Why no more question? I have more important things to do now :\) diff --git a/docs/others/help.md b/docs/others/help.md index 370e05f..e1ff020 100644 --- a/docs/others/help.md +++ b/docs/others/help.md @@ -1,13 +1,11 @@ # Help -## Help - -### Experienced/resolve any issues? +## Experienced/resolve any issues? Help your fellow developers and make a PR to this page with your solution! Thank you! -### TypeScript +## TypeScript -#### Errors after updating `mhy` to the latest version. +### Errors after updating `mhy` to the latest version. 1. Remove your local `node_modules` folder if you have any. 2. `npm i` if you have any local dependencies. 3. Use `mhy config typescript -io` to regenerate your `tsconfig.json` file. diff --git a/docs/processes/babel.md b/docs/processes/babel.md index 760f58b..c1f4ccb 100644 --- a/docs/processes/babel.md +++ b/docs/processes/babel.md @@ -1,7 +1,5 @@ # babel -## babel - - Environment: `production` - Alias: `bb` - By default it uses the whole `src` directory. @@ -11,7 +9,7 @@ > Should be used usually to generate production files for libraries. -### Default command +## Default command ```bash babel ./src --out-dir dist \ --config-file mhy/configs/babel \ @@ -20,29 +18,29 @@ babel ./src --out-dir dist \ --extensions .js,.jsx,.ts,.tsx ``` -### CLI Options +## CLI Options https://babeljs.io/docs/en/babel-cli -### Examples +## Examples -#### Default CLI +### Default CLI ```bash mhy babel --mhy-prod # or NODE_ENV=production mhy bb ``` -#### mhy UI +### mhy UI ```bash mhy ui babel --mhy-prod ``` -#### Start with watcher +### Start with watcher ```bash mhy babel --watch --mhy-prod ``` -#### Only transform one file +### Only transform one file ```bash mhy babel script.js --mhy-prod mhy babel script.js --mhy-prod --out-file script-compiled.js diff --git a/docs/processes/eslint.md b/docs/processes/eslint.md index 3100062..bf43e65 100644 --- a/docs/processes/eslint.md +++ b/docs/processes/eslint.md @@ -1,32 +1,30 @@ # eslint -## eslint - - Environment: `development` > Linting is done by Webpack also. You only need this process to manually run linting, or run it's `fix` command for example. -### Default command +## Default command ```bash eslint ./src/**/*.{js,jsx,ts,tsx} ``` -### CLI Options +## CLI Options https://eslint.org/docs/user-guide/command-line-interface -### Examples +## Examples -#### Default CLI +### Default CLI ```bash mhy eslint ``` -#### Only lint one file +### Only lint one file ```bash mhy eslint src/file.js ``` -#### Fix fixable errors +### Fix fixable errors ```bash mhy eslint --fix ``` diff --git a/docs/processes/jest.md b/docs/processes/jest.md index 5a53f57..939cadf 100644 --- a/docs/processes/jest.md +++ b/docs/processes/jest.md @@ -1,38 +1,36 @@ # jest -## jest - - Environment: `development` - Jest is using `mhy/configs/babel` config. You don't want your test environment to act differently. - By default, running in CLI will launch the default Jest UI **without watcher** for **all test files**. - By default, running in `ui` will run **with watcher** for the **files changed** since your last commit. -### Default command +## Default command ```bash jest --passWithNoTests --colors --config=mhy/configs/jest ``` -### CLI Options +## CLI Options https://jestjs.io/docs/en/cli.html -### Examples +## Examples -#### Default CLI +### Default CLI ```bash mhy jest ``` -#### Only test one file +### Only test one file ```bash mhy jest src/test.js ``` -#### Update snapshots +### Update snapshots ```bash mhy jest -u ``` -#### Watcher +### Watcher ```bash mhy jest --watch ``` diff --git a/docs/processes/prettier.md b/docs/processes/prettier.md index dd1c018..3dacb90 100644 --- a/docs/processes/prettier.md +++ b/docs/processes/prettier.md @@ -1,28 +1,26 @@ # prettier -## prettier - - Environment: `development` - By default, running in `ui` will use a `chokidar` watcher to apply prettier on the changed files. This also means that watcher is not available with the default CLI. > Using in `ui` is not the preferred way, it's better if you set up your IDE for prettier or run it manually once you finished. -### Default command +## Default command ```bash prettier --config=mhy/configs/prettier --write src/**/*.{js,jsx,ts,tsx} ``` -### CLI Options +## CLI Options https://prettier.io/docs/en/cli.html -### Examples +## Examples -#### Default CLI +### Default CLI ```bash mhy prettier ``` -#### On another directory +### On another directory ```bash mhy prettier another_directory ``` diff --git a/docs/processes/storybook-start.md b/docs/processes/storybook-start.md index eb9b0e6..a0543ee 100644 --- a/docs/processes/storybook-start.md +++ b/docs/processes/storybook-start.md @@ -1,7 +1,5 @@ # storybook-start -## storybook-start - - Environment: `development` - Alias: `sb-start` - Storybook is being setup to use `mhy`'s `Webpack` and `Babel` config. diff --git a/docs/processes/tsc.md b/docs/processes/tsc.md index 03c43c3..9d4a999 100644 --- a/docs/processes/tsc.md +++ b/docs/processes/tsc.md @@ -1,29 +1,27 @@ # tsc -## tsc - - Environment: `development` - By default `tsc` is only used for type-checking and to generate `.d.ts` files. Compilation is done by `babel`. - Inside `ui` the `-w` flag is being added to the command to automatically watch for changes. > A `tsconfig.json` is required for you to have at your project's root folder. `mhy` will create one if it doesn't exists yet. -### Default command +## Default command ```bash tsc --project ./tsconfig.json ``` -### CLI Options +## CLI Options https://www.typescriptlang.org/docs/handbook/compiler-options.html -### Examples +## Examples -#### Default CLI +### Default CLI ```bash mhy tsc ``` -#### With watcher +### With watcher ```bash mhy tsc -w ``` \ No newline at end of file diff --git a/docs/processes/webpack-dev-server.md b/docs/processes/webpack-dev-server.md index 4d1c111..902ea32 100644 --- a/docs/processes/webpack-dev-server.md +++ b/docs/processes/webpack-dev-server.md @@ -1,30 +1,28 @@ # webpack -## webpack - - Environment: `development` - Alias: `wds` - Usually ony used for generation development. For production builds use `webpack`. -### Default command +## Default command ```bash webpack-sev-server --config mhy/configs/webpack ``` -### CLI Options +## CLI Options - https://webpack.js.org/api/cli/ - https://webpack.js.org/configuration/dev-server/#devserver -### Examples +## Examples -#### Default CLI +### Default CLI ```bash mhy webpack --mhy-prod # or NODE_ENV=production mhy webpack ``` -#### With watcher +### With watcher ```bash mhy webpack --mhy-prod -w ``` diff --git a/docs/processes/webpack.md b/docs/processes/webpack.md index 75a5108..e670b02 100644 --- a/docs/processes/webpack.md +++ b/docs/processes/webpack.md @@ -1,29 +1,27 @@ # webpack -## webpack - - Environment: `production` - Alias: `wp` - Usually ony used for generation production build. For development use `webpack-dev-server`. -### Default command +## Default command ```bash webpack --config mhy/configs/webpack ``` -### CLI Options +## CLI Options https://webpack.js.org/api/cli/ -### Examples +## Examples -#### Default CLI +### Default CLI ```bash mhy webpack --mhy-prod # or NODE_ENV=production mhy webpack ``` -#### With watcher +### With watcher ```bash mhy webpack --mhy-prod -w ```