Skip to content

Commit

Permalink
feature #550 Clean up the public API file and improve a few other thi…
Browse files Browse the repository at this point in the history
…ngs (Lyrkan)

This PR was squashed before being merged into the master branch (closes #550).

Discussion
----------

Clean up the public API file and improve a few other things

Now that we don't have many active PRs anymore I figured it was a good time to do some spring cleaning, especially in the `index.js` file (since we often recommend users to look at its content).

This PR:

* Moves the proxy creation into its own file (`lib/EncoreProxy.js`)
* Moves the content of `initializeWebpackConfig(...)` inside of the `WebpackConfig`'s constructor (we already had some checks related to the `RuntimeConfig` there anyway)
* Fixes a few JSDoc issues (missing or misplaced comments, types not resolving correctly, etc.)
* Puts examples from the `index.js` file's comments inside of Markdown code-blocks, which are supported by at least PHPStorm and VSCode:

  * In PHPStorm

  | Before | After |
  |--------|-------|
  | ![image](https://user-images.githubusercontent.com/850046/55289907-ac42bf00-53cc-11e9-9aeb-33cde4bec1f9.png) | ![image](https://user-images.githubusercontent.com/850046/55289910-b2d13680-53cc-11e9-8275-605017b2018d.png) |

  * In VSCode (note that the leading whitespaces and asterisk are caused by this bug: microsoft/TypeScript#23517)

  | Before | After |
  |--------|-------|
  | ![image](https://user-images.githubusercontent.com/850046/55289926-e4e29880-53cc-11e9-84d3-9b8a27cc33cc.png) | ![image](https://user-images.githubusercontent.com/850046/55289929-eca23d00-53cc-11e9-84cd-d8cf5082a2e9.png) |

* Indicates that `Encore.getWebpackConfig()` returns a Webpack configuration, which allows IDEs' autocompletion to work on it:

  ![image](https://user-images.githubusercontent.com/850046/55289982-aa2d3000-53cd-11e9-8abd-2c5179ec289c.png)

Commits
-------

8531000 Clean up the public API file and improve a few other things
  • Loading branch information
weaverryan committed Apr 10, 2019
2 parents 6bdfa12 + 8531000 commit f9c3fc6
Show file tree
Hide file tree
Showing 42 changed files with 600 additions and 402 deletions.
4 changes: 2 additions & 2 deletions bin/encore.js
Expand Up @@ -12,7 +12,7 @@

const parseRuntime = require('../lib/config/parse-runtime');
const context = require('../lib/context');
const chalk = require('chalk');
const chalk = require('chalk').default;
const logger = require('../lib/logger');

const runtimeConfig = parseRuntime(
Expand Down Expand Up @@ -40,7 +40,7 @@ if (!runtimeConfig.isValidCommand) {
}
showUsageInstructions();

process.exit(1);
process.exit(1); // eslint-disable-line no-process-exit
}

if (runtimeConfig.helpRequested) {
Expand Down

0 comments on commit f9c3fc6

Please sign in to comment.