-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow user to pass in all options when loading xrun build tasks (#1739)
- Loading branch information
1 parent
c7f1f03
commit 374926e
Showing
13 changed files
with
410 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Optional features to support | ||
*/ | ||
export type AddOnFeatures = { | ||
/** Enable flow.js support? **Default: `false`** */ | ||
flow?: boolean; | ||
|
||
/** | ||
* Enable xarc's built-in eslint checks | ||
* - This is enabled if you add `@xarc/opt-eslint` to your devDependencies | ||
*/ | ||
eslint?: boolean; | ||
|
||
/** | ||
* Enable support for running function tests with Karma | ||
* - **Default: `false`** | ||
* - This is enabled if you add `@xarc/opt-karma` to your devDependencies | ||
*/ | ||
karma?: boolean; | ||
|
||
/** | ||
* Enable support for running test with jest | ||
* - This is enabled if you add `@xarc/opt-jest` to your devDependencies | ||
*/ | ||
jest?: boolean; | ||
|
||
/** | ||
* Enable support for running tests with mocha | ||
* - This is enabled if you add `@xarc/opt-mocha` to your devDependencies | ||
*/ | ||
mocha?: boolean; | ||
|
||
/** | ||
* Select an implementation of the React UI framework **Default: `react`** | ||
*/ | ||
reactLib?: "react" | "preact" | "inferno"; | ||
|
||
/** Enable support for using TypeScript */ | ||
typescript?: boolean; | ||
|
||
/** | ||
* Enable support for sass styling | ||
* - This is enabled if you add `@xarc/opt-sass` to your devDependencies | ||
*/ | ||
sass?: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// options from ../env-babel.ts | ||
|
||
/** | ||
* configurable options related to transpiler (babel) | ||
*/ | ||
export type BabelOptions = { | ||
/** | ||
* enable support for typescript types using `@babel/preset-typescript` | ||
* | ||
* @remarks | ||
* transpile only, no type checking | ||
* | ||
* - **Default: true** | ||
* - if not set, then we check env `ENABLE_BABEL_TYPESCRIPT` | ||
*/ | ||
enableTypeScript?: boolean; | ||
// DEPRECATE: enableDynamicImport?: boolean; | ||
|
||
/** | ||
* Enable support for stripping flow.js types using `@babel/plugin-transform-flow-strip-types` | ||
* | ||
* @remarks | ||
* transpile only, no type checking | ||
* | ||
* - **Default: `false`** | ||
* - if not set, then we check env `ENABLE_BABEL_FLOW` | ||
* - To require the `@flow` directive in source, set it to `{ requireDirective: true }` | ||
*/ | ||
enableFlow?: boolean | { requireDirective: boolean }; | ||
|
||
// DEPRECATE: flowRequireDirective?: boolean; | ||
|
||
/** | ||
* Add `@babel/plugin-proposal-decorators` | ||
* - **Default: `false`** | ||
* - To use the legacy decorators behavior, set it to `{ legacy: true }` | ||
* - if not set, then we check env `BABEL_PROPOSAL_DECORATORS` | ||
*/ | ||
proposalDecorators?: boolean | { legacy: boolean }; | ||
|
||
// DEPRECATE: legacyDecorators?: boolean; | ||
|
||
/** | ||
* Add `@babel/plugin-proposal-class-properties` for class properties support | ||
* - **Default: `false`** | ||
* - To use loose class props behavior, set it to `{ loose: true }`, which compile to | ||
* assignment expression instead of `Object.defineProperty`. | ||
* - if not set, then we check env `BABEL_CLASS_PROPS` | ||
*/ | ||
transformClassProps?: boolean | { loose: boolean }; | ||
|
||
// DEPRECATE: looseClassProps?: boolean; | ||
|
||
// DEPRECATE: | ||
// envTargets?: { | ||
// default?: {}; | ||
// node?: {}; | ||
// }; | ||
|
||
// DEPRECATE: target?: string | string[]; | ||
|
||
// DEPRECATE: extendLoader?: {}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// configs from ../env-karma.ts | ||
|
||
/** | ||
* configurable options for karma | ||
* - Only applicable if `@xarc/opt-karma` feature is added and enabled. | ||
*/ | ||
export type KarmaConfigs = { | ||
/** | ||
* Set the browser to use for karma. | ||
* | ||
* - **Default: "chrome"** | ||
* - if not set, then check env KARMA_BROWSER | ||
*/ | ||
browser?: "chrome" | "phantomjs"; | ||
}; |
141 changes: 141 additions & 0 deletions
141
packages/xarc-app-dev/src/config/opt2/webpack-options.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
// webpack config collected from env-webpack.ts | ||
|
||
/** | ||
* User configurable options that are related to Webpack | ||
*/ | ||
export type WebpackOptions = { | ||
/** | ||
* Enable webpack dev mode. **Default: `false`** | ||
* - If not set, then will check env `WEBPACK_DEV` | ||
*/ | ||
webpackDev?: boolean; | ||
/** | ||
* Host name to use for webpack dev URL. **Default: `localhost`** | ||
* - If not set, then check env `WEBPACK_HOST`, then `WEBPACK_DEV_HOST`, and finally `HOST` | ||
*/ | ||
devHostname?: string; | ||
/** | ||
* Port to use for webpack dev URL. **Default: 2992** | ||
* - If not set, then check env `WEBPACK_DEV_PORT` | ||
*/ | ||
devPort?: number; | ||
|
||
/** | ||
* Using a built-in reverse proxy, the webpack dev assets are served from the | ||
* same host and port as the app. In that case, the URLs to assets are relative | ||
* without protocol, host, port. | ||
* | ||
* However, user can simulate CDN server with the proxy and have assets URLs | ||
* specifying different host/port from the app. To do that, the following | ||
* should be defined. | ||
* | ||
* - If not set, then check env `WEBPACK_DEV_CDN_PROTOCOL` | ||
*/ | ||
cdnProtocol?: string; | ||
/** | ||
* Host name to use for CDN simulation, see option `cdnProtocol` for more info. | ||
* | ||
* - If not set, then check env `WEBPACK_DEV_CDN_HOST` | ||
*/ | ||
cdnHostname?: string; | ||
/** | ||
* Host name to use for CDN simulation, see option `cdnProtocol` for more info. | ||
* | ||
* - If not set, then check env `WEBPACK_DEV_CDN_PORT` | ||
*/ | ||
cdnPort?: number; | ||
|
||
/** | ||
* in dev mode, all webpack output are saved to memory only, but some files like | ||
* stats.json are needed by different uses and the stats partial saves a copy to | ||
* disk. It will use this as the path to save the file. | ||
* - **Default: `.etmp`** | ||
* - If not set, then check env `WEBPACK_DEV_ARTIFACTS_PATH` | ||
*/ | ||
devArtifactsPath?: string; | ||
|
||
/** | ||
* Set to true to explicitly enable CSS module support for all style files | ||
* - **Default: `undefined` (auto detect)** | ||
* - If not set, then check env `CSS_MODULE_SUPPORT` | ||
*/ | ||
cssModuleSupport?: boolean; | ||
|
||
/** | ||
* Enable loading `@babel/polyfill` for application | ||
* - **Default: `false`** | ||
*/ | ||
enableBabelPolyfill?: boolean; | ||
|
||
/** | ||
* Enable webpack's NodeSourcePlugin to simulate node.js libs in browser | ||
* - **Default: `false`** | ||
* - If not set, then check env `ENABLE_NODESOURCE_PLUGIN` | ||
* @remarks | ||
* This will bundle 100K+ of JavaScript to simulate node.js env | ||
*/ | ||
enableNodeSourcePlugin?: boolean; | ||
|
||
/** | ||
* Support hot module reload for your web app code | ||
* - **Default: `true`** | ||
* - if not set, then we check env `WEBPACK_HOT_MODULE_RELOAD` | ||
*/ | ||
enableHotModuleReload?: boolean; | ||
/** | ||
* If hot module reload is enabled, then if you make a change that has error, | ||
* then an overlay on top of the browser page will show the error. | ||
* - **Default: `true`** | ||
* - if not set, then we check env `WEBPACK_DEV_WARNINGS_OVERLAY` | ||
*/ | ||
enableWarningsOverlay?: boolean; | ||
|
||
/** | ||
* Size limit to prevent inlining woff fonts data | ||
* - **Default: `1000`** | ||
* - if not set, then we check env `WOFF_FONT_INLINE_LIMIT` | ||
*/ | ||
woffFontInlineLimit?: number; | ||
|
||
/** | ||
* https://webpack.js.org/configuration/resolve/#resolve-symlinks | ||
* - **Default: `false`** | ||
* - if not set, then we check env `WEBPACK_PRESERVE_SYMLINKS`, then `NODE_PRESERVE_SYMLINKS` | ||
*/ | ||
preserveSymlinks?: boolean; | ||
|
||
/** | ||
* If CSS module is used, then use a shorten class name for CSS in production mode | ||
* - **Default: `true`** | ||
* - if not set, then we check env `ENABLE_SHORTEN_CSS_NAMES` | ||
*/ | ||
enableShortenCSSNames?: boolean; | ||
|
||
/** | ||
* Code splitting should optimize to minimize the number of JS chunks are generated. | ||
* | ||
* **Default: `false`** | ||
* - if not set, then we check env: `MINIMIZE_SUBAPP_CHUNKS` | ||
*/ | ||
minimizeSubappChunks?: boolean; | ||
|
||
/** | ||
* Custom options for optimizing critical CSS | ||
* - if not set, then we check env: `OPTIMIZE_CSS_OPTIONS` (which should be a JSON string) | ||
* - TBD: define type for it | ||
*/ | ||
optimizeCssOptions?: object; | ||
/** | ||
* Custom object with list of webpack DLLs to load | ||
* - **Default: `{}`** | ||
* - if not set, then we check env: `ELECTRODE_LOAD_DLLS` (which should be a JSON string) | ||
* - TBD: define type for it | ||
*/ | ||
loadDlls?: object; | ||
/** | ||
* Should webpack minify code output in production mode? | ||
* - **Default: `true`** | ||
* - Useful if you want to build production without minifying for debugging | ||
*/ | ||
minify?: boolean; | ||
}; |
Oops, something went wrong.