Ng not ejected anymore
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
"project": {
|
"project": {
|
||||||
"name": "angular-electron",
|
"name": "angularelectron"
|
||||||
"ejected": true
|
|
||||||
},
|
},
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
@@ -22,8 +21,7 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"styles.scss"
|
"styles.scss"
|
||||||
],
|
],
|
||||||
"scripts": [
|
"scripts": [],
|
||||||
],
|
|
||||||
"environmentSource": "environments/environment.ts",
|
"environmentSource": "environments/environment.ts",
|
||||||
"environments": {
|
"environments": {
|
||||||
"dev": "environments/environment.ts",
|
"dev": "environments/environment.ts",
|
||||||
@@ -38,13 +36,16 @@
|
|||||||
},
|
},
|
||||||
"lint": [
|
"lint": [
|
||||||
{
|
{
|
||||||
"project": "src/tsconfig.app.json"
|
"project": "src/tsconfig.app.json",
|
||||||
|
"exclude": "**/node_modules/**"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"project": "src/tsconfig.spec.json"
|
"project": "src/tsconfig.spec.json",
|
||||||
|
"exclude": "**/node_modules/**"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"project": "e2e/tsconfig.e2e.json"
|
"project": "e2e/tsconfig.e2e.json",
|
||||||
|
"exclude": "**/node_modules/**"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"test": {
|
"test": {
|
||||||
@@ -54,7 +55,6 @@
|
|||||||
},
|
},
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"styleExt": "scss",
|
"styleExt": "scss",
|
||||||
"component": {
|
"component": {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
55
README.md
55
README.md
@@ -15,10 +15,10 @@ Bootstrap and package your project with Angular 5(+) and Electron (Typescript +
|
|||||||
|
|
||||||
Currently runs with:
|
Currently runs with:
|
||||||
|
|
||||||
- Angular v5.2.0
|
- Angular v5.2.5
|
||||||
- Angular-CLI v1.6.4
|
- Angular-CLI v1.6.4
|
||||||
- Electron v1.7.8
|
- Electron v1.8.2
|
||||||
- Electron Builder v19.45.4
|
- Electron Builder v20.0.4
|
||||||
|
|
||||||
With this sample, you can :
|
With this sample, you can :
|
||||||
|
|
||||||
@@ -42,6 +42,7 @@ npm install
|
|||||||
|
|
||||||
There is an issue with `yarn` and `node_modules` that are only used in electron on the backend when the application is built by the packager. Please use `npm` as dependencies manager.
|
There is an issue with `yarn` and `node_modules` that are only used in electron on the backend when the application is built by the packager. Please use `npm` as dependencies manager.
|
||||||
|
|
||||||
|
|
||||||
If you want to generate Angular components with Angular-cli , you **MUST** install `@angular/cli` in npm global context.
|
If you want to generate Angular components with Angular-cli , you **MUST** install `@angular/cli` in npm global context.
|
||||||
Please follow [Angular-cli documentation](https://github.com/angular/angular-cli) if you had installed a previous version of `angular-cli`.
|
Please follow [Angular-cli documentation](https://github.com/angular/angular-cli) if you had installed a previous version of `angular-cli`.
|
||||||
|
|
||||||
@@ -55,58 +56,36 @@ npm install -g @angular/cli
|
|||||||
|
|
||||||
Voila! You can use your Angular + Electron app in a local development environment with hot reload !
|
Voila! You can use your Angular + Electron app in a local development environment with hot reload !
|
||||||
|
|
||||||
The application code is managed by `main.ts`. In this sample, the app runs with a simple Electron window and "Developer Tools" is open.
|
The application code is managed by `main.ts`. In this sample, the app runs with a simple Angular App (http://localhost:4200) and an Electron window.
|
||||||
The Angular component contains an example of Electron and NodeJS native lib import. See [Use NodeJS Native libraries](#use-nodejs-native-libraries) charpter if you want to import other native libraries in your project.
|
The Angular component contains an example of Electron and NodeJS native lib import.
|
||||||
You can desactivate "Developer Tools" by commenting `win.webContents.openDevTools();` in `main.ts`.
|
You can desactivate "Developer Tools" by commenting `win.webContents.openDevTools();` in `main.ts`.
|
||||||
|
|
||||||
## To build for production
|
## Manage your environment variables
|
||||||
|
|
||||||
- Using development variables (environments/index.ts) : `npm run electron:dev`
|
- Using local variables : `npm start` or `cross-env ENV=local npm start`
|
||||||
- Using production variables (environments/index.prod.ts) : `npm run electron:prod`
|
- Using development variables : `cross-env ENV=dev npm start`
|
||||||
|
- Using production variables : `cross-env ENV=rod npm start`
|
||||||
Your built files are in the /dist folder.
|
|
||||||
|
|
||||||
## Included Commands
|
## Included Commands
|
||||||
|
|
||||||
|Command|Description|
|
|Command|Description|
|
||||||
|--|--|
|
|--|--|
|
||||||
|`npm run start:web`| Execute the app in the browser |
|
|`npm run ng:serve`| Execute the app in the browser |
|
||||||
|
|`npm run build`| Build the app. Your built files are in the /dist folder. |
|
||||||
|
|`npm run build:prod`| Build the app with Angular aot. Your built files are in the /dist folder. |
|
||||||
|
|`npm run electron:local`| Builds your application and start electron
|
||||||
|`npm run electron:linux`| Builds your application and creates an app consumable on linux system |
|
|`npm run electron:linux`| Builds your application and creates an app consumable on linux system |
|
||||||
|`npm run electron:windows`| On a Windows OS, builds your application and creates an app consumable in windows 32/64 bit systems |
|
|`npm run electron:windows`| On a Windows OS, builds your application and creates an app consumable in windows 32/64 bit systems |
|
||||||
|`npm run electron:mac`| On a MAC OS, builds your application and generates a `.app` file of your application that can be run on Mac |
|
|`npm run electron:mac`| On a MAC OS, builds your application and generates a `.app` file of your application that can be run on Mac |
|
||||||
|
|
||||||
**Your application is optimised. Only the files of /dist folder are included in the executable.**
|
**Your application is optimised. Only /dist folder and node dependencies are included in the executable.**
|
||||||
|
|
||||||
## Use NodeJS Native libraries
|
|
||||||
|
|
||||||
Actually Angular-Cli doesn't seem to be able to import nodeJS native libs or electron libs at compile time (Webpack error). This is (one of) the reason why webpack.config was ejected of ng-cli.
|
|
||||||
If you need to use NodeJS native libraries, you **MUST** add it manually in the file `webpack.config.js` in root folder :
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
"externals": {
|
|
||||||
"electron": 'require(\'electron\')',
|
|
||||||
"child_process": 'require(\'child_process\')',
|
|
||||||
"fs": 'require(\'fs\')'
|
|
||||||
...
|
|
||||||
},
|
|
||||||
```
|
|
||||||
|
|
||||||
Notice that all NodeJS v7 native libs are already added in this sample. Feel free to remove those you don't need.
|
|
||||||
|
|
||||||
## Browser mode
|
## Browser mode
|
||||||
|
|
||||||
Maybe you want to execute the application in the browser (WITHOUT HOT RELOAD ACTUALLY...) ? You can do it with `npm run start:web`.
|
Maybe you want to execute the application in the browser (WITHOUT HOT RELOAD ACTUALLY...) ? You can do it with `npm run ng:serve`.
|
||||||
Note that you can't use Electron or NodeJS native libraries in this case. Please check `providers/electron.service.ts` to watch how conditional import of electron/Native libraries is done.
|
Note that you can't use Electron or NodeJS native libraries in this case. Please check `providers/electron.service.ts` to watch how conditional import of electron/Native libraries is done.
|
||||||
|
|
||||||
## Execute E2E tests
|
## Contributors
|
||||||
|
|
||||||
You can find end-to-end tests in /e2e folder.
|
|
||||||
|
|
||||||
You can run tests with the command lines below :
|
|
||||||
- **in a terminal window** -> First, start a web server on port 4200 : `npm run start:web`
|
|
||||||
- **in another terminal window** -> Then, launch Protractor (E2E framework): `npm run e2e`
|
|
||||||
|
|
||||||
# Contributors
|
|
||||||
|
|
||||||
[<img alt="Maxime GRIS" src="https://avatars2.githubusercontent.com/u/10827551?v=3&s=117" width="117">](https://github.com/maximegris) |
|
[<img alt="Maxime GRIS" src="https://avatars2.githubusercontent.com/u/10827551?v=3&s=117" width="117">](https://github.com/maximegris) |
|
||||||
:---:
|
:---:
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"productName": "angular-electron",
|
"productName": "angular-electron",
|
||||||
"directories": {
|
"directories": {
|
||||||
"app": "dist",
|
|
||||||
"output": "app-builds"
|
"output": "app-builds"
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
|
|||||||
196
hooks/environments/README.md
Normal file
196
hooks/environments/README.md
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
<!--
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
-->
|
||||||
|
# Cordova Hooks
|
||||||
|
|
||||||
|
Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. Hook scripts could be defined by adding them to the special predefined folder (`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run serially in the following order:
|
||||||
|
* Application hooks from `/hooks`;
|
||||||
|
* Application hooks from `config.xml`;
|
||||||
|
* Plugin hooks from `plugins/.../plugin.xml`.
|
||||||
|
|
||||||
|
__Remember__: Make your scripts executable.
|
||||||
|
|
||||||
|
__Note__: `.cordova/hooks` directory is also supported for backward compatibility, but we don't recommend using it as it is deprecated.
|
||||||
|
|
||||||
|
## Supported hook types
|
||||||
|
The following hook types are supported:
|
||||||
|
|
||||||
|
after_build/
|
||||||
|
after_compile/
|
||||||
|
after_docs/
|
||||||
|
after_emulate/
|
||||||
|
after_platform_add/
|
||||||
|
after_platform_rm/
|
||||||
|
after_platform_ls/
|
||||||
|
after_plugin_add/
|
||||||
|
after_plugin_ls/
|
||||||
|
after_plugin_rm/
|
||||||
|
after_plugin_search/
|
||||||
|
after_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed
|
||||||
|
after_prepare/
|
||||||
|
after_run/
|
||||||
|
after_serve/
|
||||||
|
before_build/
|
||||||
|
before_compile/
|
||||||
|
before_docs/
|
||||||
|
before_emulate/
|
||||||
|
before_platform_add/
|
||||||
|
before_platform_rm/
|
||||||
|
before_platform_ls/
|
||||||
|
before_plugin_add/
|
||||||
|
before_plugin_ls/
|
||||||
|
before_plugin_rm/
|
||||||
|
before_plugin_search/
|
||||||
|
before_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed
|
||||||
|
before_plugin_uninstall/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being uninstalled
|
||||||
|
before_prepare/
|
||||||
|
before_run/
|
||||||
|
before_serve/
|
||||||
|
pre_package/ <-- Windows 8 and Windows Phone only.
|
||||||
|
|
||||||
|
## Ways to define hooks
|
||||||
|
### Via '/hooks' directory
|
||||||
|
To execute custom action when corresponding hook type is fired, use hook type as a name for a subfolder inside 'hooks' directory and place you script file here, for example:
|
||||||
|
|
||||||
|
# script file will be automatically executed after each build
|
||||||
|
hooks/after_build/after_build_custom_action.js
|
||||||
|
|
||||||
|
|
||||||
|
### Config.xml
|
||||||
|
|
||||||
|
Hooks can be defined in project's `config.xml` using `<hook>` elements, for example:
|
||||||
|
|
||||||
|
<hook type="before_build" src="scripts/appBeforeBuild.bat" />
|
||||||
|
<hook type="before_build" src="scripts/appBeforeBuild.js" />
|
||||||
|
<hook type="before_plugin_install" src="scripts/appBeforePluginInstall.js" />
|
||||||
|
|
||||||
|
<platform name="wp8">
|
||||||
|
<hook type="before_build" src="scripts/wp8/appWP8BeforeBuild.bat" />
|
||||||
|
<hook type="before_build" src="scripts/wp8/appWP8BeforeBuild.js" />
|
||||||
|
<hook type="before_plugin_install" src="scripts/wp8/appWP8BeforePluginInstall.js" />
|
||||||
|
...
|
||||||
|
</platform>
|
||||||
|
|
||||||
|
<platform name="windows8">
|
||||||
|
<hook type="before_build" src="scripts/windows8/appWin8BeforeBuild.bat" />
|
||||||
|
<hook type="before_build" src="scripts/windows8/appWin8BeforeBuild.js" />
|
||||||
|
<hook type="before_plugin_install" src="scripts/windows8/appWin8BeforePluginInstall.js" />
|
||||||
|
...
|
||||||
|
</platform>
|
||||||
|
|
||||||
|
### Plugin hooks (plugin.xml)
|
||||||
|
|
||||||
|
As a plugin developer you can define hook scripts using `<hook>` elements in a `plugin.xml` like that:
|
||||||
|
|
||||||
|
<hook type="before_plugin_install" src="scripts/beforeInstall.js" />
|
||||||
|
<hook type="after_build" src="scripts/afterBuild.js" />
|
||||||
|
|
||||||
|
<platform name="wp8">
|
||||||
|
<hook type="before_plugin_install" src="scripts/wp8BeforeInstall.js" />
|
||||||
|
<hook type="before_build" src="scripts/wp8BeforeBuild.js" />
|
||||||
|
...
|
||||||
|
</platform>
|
||||||
|
|
||||||
|
`before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired exclusively for the plugin being installed/uninstalled.
|
||||||
|
|
||||||
|
## Script Interface
|
||||||
|
|
||||||
|
### Javascript
|
||||||
|
|
||||||
|
If you are writing hooks in Javascript you should use the following module definition:
|
||||||
|
```javascript
|
||||||
|
module.exports = function(context) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can make your scipts async using Q:
|
||||||
|
```javascript
|
||||||
|
module.exports = function(context) {
|
||||||
|
var Q = context.requireCordovaModule('q');
|
||||||
|
var deferral = new Q.defer();
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
console.log('hook.js>> end');
|
||||||
|
deferral.resolve();
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
return deferral.promise;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`context` object contains hook type, executed script full path, hook options, command-line arguments passed to Cordova and top-level "cordova" object:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"hook": "before_plugin_install",
|
||||||
|
"scriptLocation": "c:\\script\\full\\path\\appBeforePluginInstall.js",
|
||||||
|
"cmdLine": "The\\exact\\command\\cordova\\run\\with arguments",
|
||||||
|
"opts": {
|
||||||
|
"projectRoot":"C:\\path\\to\\the\\project",
|
||||||
|
"cordova": {
|
||||||
|
"platforms": ["wp8"],
|
||||||
|
"plugins": ["com.plugin.withhooks"],
|
||||||
|
"version": "0.21.7-dev"
|
||||||
|
},
|
||||||
|
"plugin": {
|
||||||
|
"id": "com.plugin.withhooks",
|
||||||
|
"pluginInfo": {
|
||||||
|
...
|
||||||
|
},
|
||||||
|
"platform": "wp8",
|
||||||
|
"dir": "C:\\path\\to\\the\\project\\plugins\\com.plugin.withhooks"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cordova": {...}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
`context.opts.plugin` object will only be passed to plugin hooks scripts.
|
||||||
|
|
||||||
|
You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way:
|
||||||
|
```javascript
|
||||||
|
var Q = context.requireCordovaModule('q');
|
||||||
|
```
|
||||||
|
|
||||||
|
__Note__: new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
|
||||||
|
For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below.
|
||||||
|
|
||||||
|
### Non-javascript
|
||||||
|
|
||||||
|
Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
|
||||||
|
|
||||||
|
* CORDOVA_VERSION - The version of the Cordova-CLI.
|
||||||
|
* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
|
||||||
|
* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
|
||||||
|
* CORDOVA_HOOK - Path to the hook that is being executed.
|
||||||
|
* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
|
||||||
|
|
||||||
|
If a script returns a non-zero exit code, then the parent cordova command will be aborted.
|
||||||
|
|
||||||
|
## Writing hooks
|
||||||
|
|
||||||
|
We highly recommend writing your hooks using Node.js so that they are
|
||||||
|
cross-platform. Some good examples are shown here:
|
||||||
|
|
||||||
|
[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)
|
||||||
|
|
||||||
|
Also, note that even if you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example:
|
||||||
|
|
||||||
|
#!/usr/bin/env [name_of_interpreter_executable]
|
||||||
23
hooks/environments/app.config.ts.tpl
Normal file
23
hooks/environments/app.config.ts.tpl
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { CONF_LOCAL } from '../environments/environment.local';
|
||||||
|
import { CONF_DEV } from '../environments/environment.dev';
|
||||||
|
import { CONF_PROD } from '../environments/environment.prod';
|
||||||
|
|
||||||
|
const ENV = 'PROFILE';
|
||||||
|
|
||||||
|
const LOCAL: String = 'local';
|
||||||
|
const DEV: String = 'dev';
|
||||||
|
const PROD: String = 'prod';
|
||||||
|
|
||||||
|
let conf: any;
|
||||||
|
|
||||||
|
console.log('Env', ENV);
|
||||||
|
|
||||||
|
if (ENV === PROD) {
|
||||||
|
conf = CONF_PROD;
|
||||||
|
} else if (ENV === DEV) {
|
||||||
|
conf = CONF_DEV;
|
||||||
|
} else {
|
||||||
|
conf = CONF_LOCAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AppConfig = Object.assign({}, conf);
|
||||||
20
hooks/environments/set_profile.js
Normal file
20
hooks/environments/set_profile.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// require:
|
||||||
|
var replace = require("replace");
|
||||||
|
var fs = require('fs-extra');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
|
// use:
|
||||||
|
var profile = process.env.ENV ? process.env.ENV : 'local';
|
||||||
|
|
||||||
|
console.log('Déplacement du template de fichier de détection de configuration ...');
|
||||||
|
fs.copySync(path.resolve(__dirname,'./app.config.ts.tpl'), path.resolve(__dirname,'../src/app/app.config.ts'));
|
||||||
|
|
||||||
|
console.log('Application du profil : ' + profile);
|
||||||
|
|
||||||
|
replace({
|
||||||
|
regex: "'PROFILE'",
|
||||||
|
replacement: "'" + profile + "'",
|
||||||
|
paths: ['src/app/app.config.ts'],
|
||||||
|
recursive: true,
|
||||||
|
silent: true,
|
||||||
|
});
|
||||||
23
hooks/src/app/app.config.ts
Normal file
23
hooks/src/app/app.config.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { CONF_LOCAL } from '../environments/environment.local';
|
||||||
|
import { CONF_DEV } from '../environments/environment.dev';
|
||||||
|
import { CONF_PROD } from '../environments/environment.prod';
|
||||||
|
|
||||||
|
const ENV = 'PROFILE';
|
||||||
|
|
||||||
|
const LOCAL: String = 'local';
|
||||||
|
const DEV: String = 'dev';
|
||||||
|
const PROD: String = 'prod';
|
||||||
|
|
||||||
|
let conf: any;
|
||||||
|
|
||||||
|
console.log('Env', ENV);
|
||||||
|
|
||||||
|
if (ENV === PROD) {
|
||||||
|
conf = CONF_PROD;
|
||||||
|
} else if (ENV === DEV) {
|
||||||
|
conf = CONF_DEV;
|
||||||
|
} else {
|
||||||
|
conf = CONF_LOCAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AppConfig = Object.assign({}, conf);
|
||||||
23
hooks/src/app/appconfig.ts
Normal file
23
hooks/src/app/appconfig.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { CONF_LOCAL } from '../environments/environment.local';
|
||||||
|
import { CONF_DEV } from '../environments/environment.dev';
|
||||||
|
import { CONF_PROD } from '../environments/environment.prod';
|
||||||
|
|
||||||
|
const ENV = 'PROFILE';
|
||||||
|
|
||||||
|
const LOCAL: String = 'local';
|
||||||
|
const DEV: String = 'dev';
|
||||||
|
const PROD: String = 'prod';
|
||||||
|
|
||||||
|
let conf: any;
|
||||||
|
|
||||||
|
console.log('Env', ENV);
|
||||||
|
|
||||||
|
if (ENV === PROD) {
|
||||||
|
conf = CONF_PROD;
|
||||||
|
} else if (ENV === DEV) {
|
||||||
|
conf = CONF_DEV;
|
||||||
|
} else {
|
||||||
|
conf = CONF_LOCAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AppConfig = Object.assign({}, conf);
|
||||||
23
main.ts
23
main.ts
@@ -1,14 +1,15 @@
|
|||||||
import { app, BrowserWindow, screen } from 'electron';
|
import { app, BrowserWindow, screen } from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as url from 'url';
|
||||||
|
|
||||||
let win, serve;
|
let win, serve;
|
||||||
const args = process.argv.slice(1);
|
const args = process.argv.slice(1);
|
||||||
serve = args.some(val => val === '--serve');
|
serve = args.some(val => val === '--serve');
|
||||||
import * as url from 'url';
|
|
||||||
|
|
||||||
if (serve) {
|
try {
|
||||||
require('electron-reload')(__dirname, {
|
require('dotenv').config();
|
||||||
});
|
} catch {
|
||||||
|
console.log('asar');
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
@@ -24,18 +25,20 @@ function createWindow() {
|
|||||||
height: size.height
|
height: size.height
|
||||||
});
|
});
|
||||||
|
|
||||||
// and load the index.html of the app.
|
if (serve) {
|
||||||
|
require('electron-reload')(__dirname, {
|
||||||
|
});
|
||||||
|
win.loadURL('http://localhost:4200');
|
||||||
|
} else {
|
||||||
win.loadURL(url.format({
|
win.loadURL(url.format({
|
||||||
|
pathname: path.join(__dirname, 'dist/index.html'),
|
||||||
protocol: 'file:',
|
protocol: 'file:',
|
||||||
pathname: path.join(__dirname, '/index.html'),
|
|
||||||
slashes: true
|
slashes: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Open the DevTools.
|
|
||||||
if (serve) {
|
|
||||||
win.webContents.openDevTools();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
win.webContents.openDevTools();
|
||||||
|
|
||||||
// Emitted when the window is closed.
|
// Emitted when the window is closed.
|
||||||
win.on('closed', () => {
|
win.on('closed', () => {
|
||||||
// Dereference the window object, usually you would store window
|
// Dereference the window object, usually you would store window
|
||||||
|
|||||||
85
package.json
85
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "angular-electron",
|
"name": "angular-electron",
|
||||||
"version": "2.7.1",
|
"version": "3.0.0",
|
||||||
"description": "Angular 5 with Electron (Typescript + SASS + Hot Reload)",
|
"description": "Angular 5 with Electron (Typescript + SASS + Hot Reload)",
|
||||||
"homepage": "https://github.com/maximegris/angular-electron",
|
"homepage": "https://github.com/maximegris/angular-electron",
|
||||||
"author": {
|
"author": {
|
||||||
@@ -17,98 +17,69 @@
|
|||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"postinstall": "npx electron-builder install-app-deps",
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"lint": "ng lint",
|
"start": "node hooks/environments/set_profile.js && npm-run-all -p ng:serve electron:serve",
|
||||||
"start": "tsc main.ts && npm-run-all --parallel webpack:watch electron:serve",
|
"build": "node hooks/environments/set_profile.js && ng build && npm run electron:tsc",
|
||||||
"webpack:watch": "webpack --watch",
|
"build:prod": "node hooks/environments/set_profile.js && ng build --prod && npm run electron:tsc",
|
||||||
"start:web": "webpack-dev-server --content-base . --port 4200 --inline",
|
"ng:serve": "ng serve",
|
||||||
"build:electron:main": "tsc main.ts --outDir dist && copyfiles package.json dist && cd dist && npm install --prod && cd ..",
|
"electron:tsc": "tsc main.ts",
|
||||||
"build": "webpack --display-error-details && npm run build:electron:main",
|
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:tsc && electron . --serve",
|
||||||
"build:prod": "cross-env NODE_ENV=production npm run build",
|
"electron:local": "npm run build:prod && electron .",
|
||||||
"electron:serve": "npm run build:electron:main && electron ./dist --serve",
|
|
||||||
"electron:test": "electron ./dist",
|
|
||||||
"electron:dev": "npm run build && electron ./dist",
|
|
||||||
"electron:prod": "npm run build:prod && electron ./dist",
|
|
||||||
"electron:linux": "npm run build:prod && npx electron-builder build --linux",
|
"electron:linux": "npm run build:prod && npx electron-builder build --linux",
|
||||||
"electron:windows": "npm run build:prod && npx electron-builder build --windows",
|
"electron:windows": "npm run build:prod && npx electron-builder build --windows",
|
||||||
"electron:mac": "npm run build:prod && npx electron-builder build --mac",
|
"electron:mac": "npm run build:prod && npx electron-builder build --mac",
|
||||||
"test": "karma start ./karma.conf.js",
|
"test": "karma start ./karma.conf.js",
|
||||||
"pree2e": "webdriver-manager update --standalone false --gecko false --quiet && npm run build",
|
"pree2e:build": "webdriver-manager update --gecko false && npm run ng:serve",
|
||||||
"e2e": "protractor ./protractor.conf.js"
|
"pree2e:protractor" : "wait-on http-get://localhost:4200/ && protractor ./protractor.conf.js",
|
||||||
|
"e2e": "npm-run-all -p pree2e:build pree2e:protractor"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@angular/cli": "1.7.1",
|
||||||
"@angular/common": "5.2.5",
|
"@angular/common": "5.2.5",
|
||||||
"@angular/compiler": "5.2.5",
|
"@angular/compiler": "5.2.5",
|
||||||
|
"@angular/compiler-cli": "5.2.5",
|
||||||
"@angular/core": "5.2.5",
|
"@angular/core": "5.2.5",
|
||||||
"@angular/forms": "5.2.5",
|
"@angular/forms": "5.2.5",
|
||||||
"@angular/http": "5.2.5",
|
"@angular/http": "5.2.5",
|
||||||
|
"@angular/language-service": "5.2.5",
|
||||||
"@angular/platform-browser": "5.2.5",
|
"@angular/platform-browser": "5.2.5",
|
||||||
"@angular/platform-browser-dynamic": "5.2.5",
|
"@angular/platform-browser-dynamic": "5.2.5",
|
||||||
"@angular/router": "5.2.5",
|
"@angular/router": "5.2.5",
|
||||||
"@ngx-translate/core": "9.1.1",
|
"@ngx-translate/core": "9.1.1",
|
||||||
"@ngx-translate/http-loader": "2.0.1",
|
"@ngx-translate/http-loader": "2.0.1",
|
||||||
"core-js": "2.4.1",
|
|
||||||
"enhanced-resolve": "3.3.0",
|
|
||||||
"rxjs": "5.5.2",
|
|
||||||
"zone.js": "0.8.17",
|
|
||||||
"@angular/cli": "1.6.8",
|
|
||||||
"@angular/compiler-cli": "5.2.5",
|
|
||||||
"@angular/language-service": "5.2.5",
|
|
||||||
"@types/core-js": "0.9.36",
|
"@types/core-js": "0.9.36",
|
||||||
"@types/jasmine": "2.5.54",
|
"@types/jasmine": "2.8.3",
|
||||||
"@types/jasminewd2": "2.0.2",
|
"@types/jasminewd2": "2.0.2",
|
||||||
"@types/node": "7.0.7",
|
"@types/node": "7.0.7",
|
||||||
"autoprefixer": "8.0.0",
|
"codelyzer": "4.0.1",
|
||||||
"circular-dependency-plugin": "4.4.0",
|
|
||||||
"codelyzer": "4.1.0",
|
|
||||||
"copy-webpack-plugin": "4.1.1",
|
|
||||||
"copyfiles": "1.2.0",
|
"copyfiles": "1.2.0",
|
||||||
|
"core-js": "2.4.1",
|
||||||
"cross-env": "5.0.5",
|
"cross-env": "5.0.5",
|
||||||
"css-loader": "0.28.9",
|
"dotenv": "5.0.0",
|
||||||
"cssnano": "3.10.0",
|
|
||||||
"electron": "1.8.2",
|
"electron": "1.8.2",
|
||||||
"electron-builder": "20.0.4",
|
"electron-builder": "20.0.4",
|
||||||
"electron-reload": "1.2.2",
|
"electron-reload": "1.2.2",
|
||||||
"exports-loader": "0.7.0",
|
"enhanced-resolve": "3.3.0",
|
||||||
"file-loader": "1.1.6",
|
"fs-extra": "5.0.0",
|
||||||
"html-loader": "0.5.5",
|
|
||||||
"html-webpack-plugin": "2.30.1",
|
|
||||||
"istanbul-instrumenter-loader": "3.0.0",
|
|
||||||
"jasmine-core": "2.8.0",
|
"jasmine-core": "2.8.0",
|
||||||
"jasmine-spec-reporter": "4.2.1",
|
"jasmine-spec-reporter": "4.2.1",
|
||||||
"json-loader": "0.5.7",
|
"karma": "2.0.0",
|
||||||
"karma": "1.7.1",
|
|
||||||
"karma-chrome-launcher": "2.2.0",
|
"karma-chrome-launcher": "2.2.0",
|
||||||
"karma-cli": "1.0.1",
|
"karma-coverage-istanbul-reporter": "1.2.1",
|
||||||
"karma-coverage-istanbul-reporter": "1.3.0",
|
|
||||||
"karma-jasmine": "1.1.0",
|
"karma-jasmine": "1.1.0",
|
||||||
"karma-jasmine-html-reporter": "0.2.2",
|
"karma-jasmine-html-reporter": "0.2.2",
|
||||||
"karma-sourcemap-loader": "0.3.7",
|
|
||||||
"less-loader": "4.0.5",
|
|
||||||
"minimist": "1.2.0",
|
|
||||||
"mkdirp": "0.5.1",
|
|
||||||
"npm-run-all": "4.1.2",
|
"npm-run-all": "4.1.2",
|
||||||
"npx": "9.7.1",
|
"npx": "9.7.1",
|
||||||
"postcss-loader": "2.1.0",
|
|
||||||
"postcss-url": "7.3.0",
|
|
||||||
"postcss-custom-properties": "6.2.0",
|
|
||||||
"protractor": "5.3.0",
|
"protractor": "5.3.0",
|
||||||
"raw-loader": "0.5.1",
|
"replace": "0.3.0",
|
||||||
"sass-loader": "6.0.6",
|
"rxjs": "5.5.6",
|
||||||
"script-loader": "0.7.2",
|
|
||||||
"source-map-loader": "0.2.3",
|
|
||||||
"style-loader": "0.20.1",
|
|
||||||
"stylus-loader": "3.0.1",
|
|
||||||
"ts-node": "4.1.0",
|
"ts-node": "4.1.0",
|
||||||
"tslint": "5.9.1",
|
"tslint": "5.9.1",
|
||||||
"typescript": "2.6.2",
|
"typescript": "2.6.2",
|
||||||
"uglifyjs-webpack-plugin": "1.1.8",
|
"wait-on": "^2.1.0",
|
||||||
"url-loader": "0.6.2",
|
|
||||||
"webdriver-manager": "12.0.6",
|
"webdriver-manager": "12.0.6",
|
||||||
"webpack": "3.11.0",
|
"zone.js": "0.8.19"
|
||||||
"webpack-concat-plugin": "2.4.2",
|
}
|
||||||
"webpack-dev-server": "2.11.1"
|
|
||||||
},
|
|
||||||
"license": "SEE LICENSE IN LICENSE.md"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ const { SpecReporter } = require('jasmine-spec-reporter');
|
|||||||
|
|
||||||
exports.config = {
|
exports.config = {
|
||||||
allScriptsTimeout: 25000,
|
allScriptsTimeout: 25000,
|
||||||
getPageTimeout: 15000,
|
|
||||||
delayBrowserTimeInSeconds: 0,
|
delayBrowserTimeInSeconds: 0,
|
||||||
specs: [
|
specs: [
|
||||||
'./e2e/**/*.e2e-spec.ts'
|
'./e2e/**/*.e2e-spec.ts'
|
||||||
@@ -13,18 +12,20 @@ exports.config = {
|
|||||||
capabilities: {
|
capabilities: {
|
||||||
'browserName': 'chrome',
|
'browserName': 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
binary: './node_modules/electron/dist/electron.exe',
|
args: ["--no-sandbox", "--headless", "--disable-gpu"]
|
||||||
args: ['--test-type=webdriver', 'app=dist/main.js']
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
chromeOnly: true,
|
||||||
directConnect: true,
|
directConnect: true,
|
||||||
baseUrl: 'http://localhost:4200/',
|
baseUrl: 'http://localhost:4200/',
|
||||||
framework: 'jasmine2',
|
framework: 'jasmine2',
|
||||||
jasmineNodeOpts: {
|
jasmineNodeOpts: {
|
||||||
showColors: true,
|
showColors: true,
|
||||||
defaultTimeoutInterval: 30000,
|
defaultTimeoutInterval: 30000,
|
||||||
print: function () { }
|
print: function () { },
|
||||||
|
realtimeFailure: true
|
||||||
},
|
},
|
||||||
|
useAllAngular2AppRoots: true,
|
||||||
beforeLaunch: function () {
|
beforeLaunch: function () {
|
||||||
require('ts-node').register({
|
require('ts-node').register({
|
||||||
project: 'e2e/tsconfig.e2e.json'
|
project: 'e2e/tsconfig.e2e.json'
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { TestBed, async } from '@angular/core/testing';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { ElectronService } from 'app/providers/electron.service';
|
import { ElectronService } from './providers/electron.service';
|
||||||
|
|
||||||
|
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
describe('AppComponent', () => {
|
describe('AppComponent', () => {
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
@@ -10,9 +12,12 @@ describe('AppComponent', () => {
|
|||||||
AppComponent
|
AppComponent
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
ElectronService
|
ElectronService,
|
||||||
|
{ provide: TranslateService, useClass: TranslateServiceStub }
|
||||||
],
|
],
|
||||||
imports: [RouterTestingModule]
|
imports: [RouterTestingModule,
|
||||||
|
TranslateModule.forRoot()
|
||||||
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -22,3 +27,8 @@ describe('AppComponent', () => {
|
|||||||
expect(app).toBeTruthy();
|
expect(app).toBeTruthy();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
class TranslateServiceStub {
|
||||||
|
setDefaultLang(lang: string): void {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { ElectronService } from './providers/electron.service';
|
import { ElectronService } from './providers/electron.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { AppConfig } from './app.config';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@@ -12,13 +13,12 @@ export class AppComponent {
|
|||||||
private translate: TranslateService) {
|
private translate: TranslateService) {
|
||||||
|
|
||||||
translate.setDefaultLang('en');
|
translate.setDefaultLang('en');
|
||||||
|
console.log('AppConfig', AppConfig);
|
||||||
|
|
||||||
if (electronService.isElectron()) {
|
if (electronService.isElectron()) {
|
||||||
console.log('Mode electron');
|
console.log('Mode electron');
|
||||||
// Check if electron is correctly injected (see externals in webpack.config.js)
|
console.log('Electron ipcRenderer', electronService.ipcRenderer);
|
||||||
console.log('c', electronService.ipcRenderer);
|
console.log('NodeJS childProcess', electronService.childProcess);
|
||||||
// Check if nodeJs childProcess is correctly injected (see externals in webpack.config.js)
|
|
||||||
console.log('c', electronService.childProcess);
|
|
||||||
} else {
|
} else {
|
||||||
console.log('Mode web');
|
console.log('Mode web');
|
||||||
}
|
}
|
||||||
|
|||||||
23
src/app/app.config.ts
Normal file
23
src/app/app.config.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { CONF_LOCAL } from '../environments/environment.local';
|
||||||
|
import { CONF_DEV } from '../environments/environment.dev';
|
||||||
|
import { CONF_PROD } from '../environments/environment.prod';
|
||||||
|
|
||||||
|
const ENV = 'prod';
|
||||||
|
|
||||||
|
const LOCAL: String = 'local';
|
||||||
|
const DEV: String = 'dev';
|
||||||
|
const PROD: String = 'prod';
|
||||||
|
|
||||||
|
let conf: any;
|
||||||
|
|
||||||
|
console.log('Env', ENV);
|
||||||
|
|
||||||
|
if (ENV === PROD) {
|
||||||
|
conf = CONF_PROD;
|
||||||
|
} else if (ENV === DEV) {
|
||||||
|
conf = CONF_DEV;
|
||||||
|
} else {
|
||||||
|
conf = CONF_LOCAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AppConfig = Object.assign({}, conf);
|
||||||
@@ -15,7 +15,7 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
|||||||
|
|
||||||
import { ElectronService } from './providers/electron.service';
|
import { ElectronService } from './providers/electron.service';
|
||||||
|
|
||||||
import { WebviewDirective } from 'app/directives/webview.directive';
|
import { WebviewDirective } from './directives/webview.directive';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { HomeComponent } from './components/home/home.component';
|
import { HomeComponent } from './components/home/home.component';
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { HomeComponent } from './home.component';
|
import { HomeComponent } from './home.component';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
describe('HomeComponent', () => {
|
describe('HomeComponent', () => {
|
||||||
let component: HomeComponent;
|
let component: HomeComponent;
|
||||||
@@ -8,7 +9,10 @@ describe('HomeComponent', () => {
|
|||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ HomeComponent ]
|
declarations: [ HomeComponent ],
|
||||||
|
imports: [
|
||||||
|
TranslateModule.forRoot()
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
@@ -23,16 +27,8 @@ describe('HomeComponent', () => {
|
|||||||
expect(component).toBeTruthy();
|
expect(component).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should have as title 'App works !'`, async(() => {
|
|
||||||
fixture = TestBed.createComponent(HomeComponent);
|
|
||||||
const app = fixture.debugElement.componentInstance;
|
|
||||||
expect(app.title).toEqual('App works !');
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should render title in a h1 tag', async(() => {
|
it('should render title in a h1 tag', async(() => {
|
||||||
fixture = TestBed.createComponent(HomeComponent);
|
|
||||||
fixture.detectChanges();
|
|
||||||
const compiled = fixture.debugElement.nativeElement;
|
const compiled = fixture.debugElement.nativeElement;
|
||||||
expect(compiled.querySelector('h1').textContent).toContain('App works !');
|
expect(compiled.querySelector('h1').textContent).toBeTruthy();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|||||||
9
src/environments/environment.dev.ts
Normal file
9
src/environments/environment.dev.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// The file contents for the current environment will overwrite these during build.
|
||||||
|
// The build system defaults to the dev environment which uses `index.ts`, but if you do
|
||||||
|
// `ng build --env=prod` then `index.prod.ts` will be used instead.
|
||||||
|
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||||
|
|
||||||
|
export const CONF_DEV = {
|
||||||
|
production: false,
|
||||||
|
environment: 'DEV'
|
||||||
|
};
|
||||||
4
src/environments/environment.local.ts
Normal file
4
src/environments/environment.local.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export const CONF_LOCAL = {
|
||||||
|
production: false,
|
||||||
|
environment: 'LOCAL'
|
||||||
|
};
|
||||||
4
src/environments/environment.prod.ts
Normal file
4
src/environments/environment.prod.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export const CONF_PROD = {
|
||||||
|
production: true,
|
||||||
|
environment: 'PROD'
|
||||||
|
};
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// This file contains production variables. (When you work in PROD MODE)
|
|
||||||
// This file is use by webpack. Please don't rename it and don't move it to another directory.
|
|
||||||
export const environment = {
|
|
||||||
production: true
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// This file contains development variables. (When you work in DEV MODE)
|
|
||||||
// This file is use by webpack. Please don't rename it and don't move it to another directory.
|
|
||||||
export const environment = {
|
|
||||||
production: false
|
|
||||||
};
|
|
||||||
@@ -2,9 +2,9 @@ import { enableProdMode } from '@angular/core';
|
|||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { AppModule } from './app/app.module';
|
import { AppModule } from './app/app.module';
|
||||||
import { environment } from 'environments';
|
import { AppConfig } from './app/app.config';
|
||||||
|
|
||||||
if (environment.production) {
|
if (AppConfig.production) {
|
||||||
enableProdMode();
|
enableProdMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import {
|
|||||||
BrowserDynamicTestingModule,
|
BrowserDynamicTestingModule,
|
||||||
platformBrowserDynamicTesting
|
platformBrowserDynamicTesting
|
||||||
} from '@angular/platform-browser-dynamic/testing';
|
} from '@angular/platform-browser-dynamic/testing';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { TranslateLoader, TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
|
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
|
||||||
declare const __karma__: any;
|
declare const __karma__: any;
|
||||||
@@ -28,5 +30,6 @@ getTestBed().initTestEnvironment(
|
|||||||
const context = require.context('./', true, /\.spec\.ts$/);
|
const context = require.context('./', true, /\.spec\.ts$/);
|
||||||
// And load the modules.
|
// And load the modules.
|
||||||
context.keys().map(context);
|
context.keys().map(context);
|
||||||
|
|
||||||
// Finally, start Karma to run the tests.
|
// Finally, start Karma to run the tests.
|
||||||
__karma__.start();
|
__karma__.start();
|
||||||
|
|||||||
@@ -2,32 +2,18 @@
|
|||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./dist/out-tsc",
|
"outDir": "./dist/out-tsc",
|
||||||
"baseUrl": "src",
|
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"allowJs": false,
|
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"paths": {
|
|
||||||
"environments": [
|
|
||||||
"./environments"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"types": [
|
|
||||||
"node",
|
|
||||||
"jasmine"
|
|
||||||
],
|
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
],
|
||||||
"lib": [
|
"lib": [
|
||||||
"es2016",
|
"es2017",
|
||||||
"dom"
|
"dom"
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
53
tslint.json
53
tslint.json
@@ -3,6 +3,7 @@
|
|||||||
"node_modules/codelyzer"
|
"node_modules/codelyzer"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"arrow-return-shorthand": true,
|
||||||
"callable-types": true,
|
"callable-types": true,
|
||||||
"class-name": true,
|
"class-name": true,
|
||||||
"comment-format": [
|
"comment-format": [
|
||||||
@@ -10,9 +11,16 @@
|
|||||||
"check-space"
|
"check-space"
|
||||||
],
|
],
|
||||||
"curly": true,
|
"curly": true,
|
||||||
|
"deprecation": {
|
||||||
|
"severity": "warn"
|
||||||
|
},
|
||||||
"eofline": true,
|
"eofline": true,
|
||||||
"forin": true,
|
"forin": true,
|
||||||
"import-blacklist": [true, "rxjs"],
|
"import-blacklist": [
|
||||||
|
true,
|
||||||
|
"rxjs",
|
||||||
|
"rxjs/Rx"
|
||||||
|
],
|
||||||
"import-spacing": true,
|
"import-spacing": true,
|
||||||
"indent": [
|
"indent": [
|
||||||
true,
|
true,
|
||||||
@@ -27,8 +35,14 @@
|
|||||||
"member-access": false,
|
"member-access": false,
|
||||||
"member-ordering": [
|
"member-ordering": [
|
||||||
true,
|
true,
|
||||||
"static-before-instance",
|
{
|
||||||
"variables-before-functions"
|
"order": [
|
||||||
|
"static-field",
|
||||||
|
"instance-field",
|
||||||
|
"static-method",
|
||||||
|
"instance-method"
|
||||||
|
]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"no-arg": true,
|
"no-arg": true,
|
||||||
"no-bitwise": true,
|
"no-bitwise": true,
|
||||||
@@ -42,16 +56,22 @@
|
|||||||
],
|
],
|
||||||
"no-construct": true,
|
"no-construct": true,
|
||||||
"no-debugger": true,
|
"no-debugger": true,
|
||||||
"no-duplicate-variable": true,
|
"no-duplicate-super": true,
|
||||||
"no-empty": false,
|
"no-empty": false,
|
||||||
"no-empty-interface": true,
|
"no-empty-interface": true,
|
||||||
"no-eval": true,
|
"no-eval": true,
|
||||||
"no-inferrable-types": [true, "ignore-params"],
|
"no-inferrable-types": [
|
||||||
|
true,
|
||||||
|
"ignore-params"
|
||||||
|
],
|
||||||
|
"no-misused-new": true,
|
||||||
|
"no-non-null-assertion": true,
|
||||||
"no-shadowed-variable": true,
|
"no-shadowed-variable": true,
|
||||||
"no-string-literal": false,
|
"no-string-literal": false,
|
||||||
"no-string-throw": true,
|
"no-string-throw": true,
|
||||||
"no-switch-case-fall-through": true,
|
"no-switch-case-fall-through": true,
|
||||||
"no-trailing-whitespace": true,
|
"no-trailing-whitespace": true,
|
||||||
|
"no-unnecessary-initializer": true,
|
||||||
"no-unused-expression": true,
|
"no-unused-expression": true,
|
||||||
"no-use-before-declare": true,
|
"no-use-before-declare": true,
|
||||||
"no-var-keyword": true,
|
"no-var-keyword": true,
|
||||||
@@ -70,6 +90,7 @@
|
|||||||
],
|
],
|
||||||
"radix": true,
|
"radix": true,
|
||||||
"semicolon": [
|
"semicolon": [
|
||||||
|
true,
|
||||||
"always"
|
"always"
|
||||||
],
|
],
|
||||||
"triple-equals": [
|
"triple-equals": [
|
||||||
@@ -86,7 +107,6 @@
|
|||||||
"variable-declaration": "nospace"
|
"variable-declaration": "nospace"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"typeof-compare": true,
|
|
||||||
"unified-signatures": true,
|
"unified-signatures": true,
|
||||||
"variable-name": false,
|
"variable-name": false,
|
||||||
"whitespace": [
|
"whitespace": [
|
||||||
@@ -97,9 +117,19 @@
|
|||||||
"check-separator",
|
"check-separator",
|
||||||
"check-type"
|
"check-type"
|
||||||
],
|
],
|
||||||
|
"directive-selector": [
|
||||||
"directive-selector": [true, "attribute", "app", "camelCase"],
|
true,
|
||||||
"component-selector": [true, "element", "app", "kebab-case"],
|
"attribute",
|
||||||
|
"app",
|
||||||
|
"camelCase"
|
||||||
|
],
|
||||||
|
"component-selector": [
|
||||||
|
true,
|
||||||
|
"element",
|
||||||
|
"app",
|
||||||
|
"kebab-case"
|
||||||
|
],
|
||||||
|
"no-output-on-prefix": true,
|
||||||
"use-input-property-decorator": true,
|
"use-input-property-decorator": true,
|
||||||
"use-output-property-decorator": true,
|
"use-output-property-decorator": true,
|
||||||
"use-host-property-decorator": true,
|
"use-host-property-decorator": true,
|
||||||
@@ -108,9 +138,6 @@
|
|||||||
"use-life-cycle-interface": true,
|
"use-life-cycle-interface": true,
|
||||||
"use-pipe-transform-interface": true,
|
"use-pipe-transform-interface": true,
|
||||||
"component-class-suffix": true,
|
"component-class-suffix": true,
|
||||||
"directive-class-suffix": true,
|
"directive-class-suffix": true
|
||||||
"no-access-missing-member": true,
|
|
||||||
"templates-use-public": true,
|
|
||||||
"invoke-injectable": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,550 +0,0 @@
|
|||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
||||||
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
|
|
||||||
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
||||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
|
||||||
const autoprefixer = require('autoprefixer');
|
|
||||||
const postcssUrl = require('postcss-url');
|
|
||||||
const customProperties = require('postcss-custom-properties');
|
|
||||||
|
|
||||||
const { NoEmitOnErrorsPlugin, SourceMapDevToolPlugin, DefinePlugin, NamedModulesPlugin } = require('webpack');
|
|
||||||
const { BaseHrefWebpackPlugin, NamedLazyChunksWebpackPlugin, ScriptsWebpackPlugin } = require('@angular/cli/plugins/webpack');
|
|
||||||
const { CommonsChunkPlugin } = require('webpack').optimize;
|
|
||||||
const { AngularCompilerPlugin } = require('@ngtools/webpack');
|
|
||||||
const ConcatPlugin = require('webpack-concat-plugin');
|
|
||||||
|
|
||||||
const nodeModules = path.join(process.cwd(), 'node_modules');
|
|
||||||
const realNodeModules = fs.realpathSync(nodeModules);
|
|
||||||
const genDirNodeModules = path.join(process.cwd(), 'src', '$$_gendir', 'node_modules');
|
|
||||||
const entryPoints = ["inline", "polyfills", "sw-register", "styles", "vendor", "main"];
|
|
||||||
const minimizeCss = false;
|
|
||||||
const baseHref = "";
|
|
||||||
const deployUrl = "";
|
|
||||||
|
|
||||||
const postcssPlugins = function () {
|
|
||||||
// safe settings based on: https://github.com/ben-eb/cssnano/issues/358#issuecomment-283696193
|
|
||||||
const importantCommentRe = /@preserve|@license|[@#]\s*source(?:Mapping)?URL|^!/i;
|
|
||||||
const minimizeOptions = {
|
|
||||||
autoprefixer: false,
|
|
||||||
safe: true,
|
|
||||||
mergeLonghand: false,
|
|
||||||
discardComments: { remove: (comment) => !importantCommentRe.test(comment) }
|
|
||||||
};
|
|
||||||
return [
|
|
||||||
postcssUrl({
|
|
||||||
url: (obj) => {
|
|
||||||
if (!obj.url.startsWith('/') || obj.url.startsWith('//')) {
|
|
||||||
return obj.url;
|
|
||||||
}
|
|
||||||
if (deployUrl.match(/:\/\//)) {
|
|
||||||
// If deployUrl contains a scheme, ignore baseHref use deployUrl as is.
|
|
||||||
return `${deployUrl.replace(/\/$/, '')}${obj.url}`;
|
|
||||||
}
|
|
||||||
else if (baseHref.match(/:\/\//)) {
|
|
||||||
// If baseHref contains a scheme, include it as is.
|
|
||||||
return baseHref.replace(/\/$/, '') +
|
|
||||||
`/${deployUrl}/${obj.url}`.replace(/\/\/+/g, '/');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Join together base-href, deploy-url and the original URL.
|
|
||||||
// Also dedupe multiple slashes into single ones.
|
|
||||||
return `/${baseHref}/${deployUrl}/${obj.url}`.replace(/\/\/+/g, '/');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
autoprefixer(),
|
|
||||||
customProperties({ preserve: true })
|
|
||||||
].concat(minimizeCss ? [cssnano(minimizeOptions)] : []);
|
|
||||||
};
|
|
||||||
|
|
||||||
const isProd = (process.env.NODE_ENV === 'production');
|
|
||||||
|
|
||||||
//add all external css to be added in our index.html--> like as if it's .angular-cli.json
|
|
||||||
const styles = [
|
|
||||||
"./src/styles.scss"
|
|
||||||
];
|
|
||||||
|
|
||||||
//we add all our external scripts we want to load externally, like inserting in our index.html --> like as if it's .angular-cli.json
|
|
||||||
const scripts = [
|
|
||||||
];
|
|
||||||
|
|
||||||
//create file path for each , so we use for our excludes and includes where needed
|
|
||||||
let style_paths = styles.map(style_src => path.join(process.cwd(), style_src));
|
|
||||||
|
|
||||||
function getPlugins() {
|
|
||||||
var plugins = [];
|
|
||||||
|
|
||||||
// Always expose NODE_ENV to webpack, you can now use `process.env.NODE_ENV`
|
|
||||||
// inside your code for any environment checks; UglifyJS will automatically
|
|
||||||
// drop any unreachable code.
|
|
||||||
plugins.push(new DefinePlugin({
|
|
||||||
"process.env.NODE_ENV": "\"production\""
|
|
||||||
}));
|
|
||||||
|
|
||||||
plugins.push(new NoEmitOnErrorsPlugin());
|
|
||||||
|
|
||||||
if (scripts.length > 0) {
|
|
||||||
plugins.push(new ConcatPlugin({
|
|
||||||
"uglify": false,
|
|
||||||
"sourceMap": true,
|
|
||||||
"name": "scripts",
|
|
||||||
"fileName": "[name].bundle.js",
|
|
||||||
"filesToConcat": scripts
|
|
||||||
}));
|
|
||||||
plugins.push(new ScriptsWebpackPlugin({
|
|
||||||
name: "scripts",
|
|
||||||
sourceMap: true,
|
|
||||||
scripts: scripts
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins.push(new CopyWebpackPlugin([
|
|
||||||
{
|
|
||||||
"context": "src",
|
|
||||||
"to": "",
|
|
||||||
"from": {
|
|
||||||
"glob": "assets/**/*",
|
|
||||||
"dot": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"context": "src",
|
|
||||||
"to": "",
|
|
||||||
"from": {
|
|
||||||
"glob": "favicon.*",
|
|
||||||
"dot": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
], {
|
|
||||||
"ignore": [
|
|
||||||
".gitkeep"
|
|
||||||
],
|
|
||||||
"debug": "warning"
|
|
||||||
}));
|
|
||||||
|
|
||||||
plugins.push(new ProgressPlugin());
|
|
||||||
|
|
||||||
plugins.push(new CircularDependencyPlugin({
|
|
||||||
"exclude": /(\\|\/)node_modules(\\|\/)/,
|
|
||||||
"failOnError": false
|
|
||||||
}));
|
|
||||||
|
|
||||||
plugins.push(new NamedLazyChunksWebpackPlugin());
|
|
||||||
|
|
||||||
plugins.push(new HtmlWebpackPlugin({
|
|
||||||
"template": "./src/index.html",
|
|
||||||
"filename": "./index.html",
|
|
||||||
"hash": false,
|
|
||||||
"inject": true,
|
|
||||||
"compile": true,
|
|
||||||
"favicon": false,
|
|
||||||
"minify": false,
|
|
||||||
"cache": true,
|
|
||||||
"showErrors": true,
|
|
||||||
"chunks": "all",
|
|
||||||
"excludeChunks": [],
|
|
||||||
"title": "Webpack App",
|
|
||||||
"xhtml": true,
|
|
||||||
"chunksSortMode": function sort(left, right) {
|
|
||||||
let leftIndex = entryPoints.indexOf(left.names[0]);
|
|
||||||
let rightindex = entryPoints.indexOf(right.names[0]);
|
|
||||||
if (leftIndex > rightindex) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (leftIndex < rightindex) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
plugins.push(new BaseHrefWebpackPlugin({}));
|
|
||||||
|
|
||||||
plugins.push(new CommonsChunkPlugin({
|
|
||||||
"name": [
|
|
||||||
"inline"
|
|
||||||
],
|
|
||||||
"minChunks": null
|
|
||||||
}));
|
|
||||||
|
|
||||||
plugins.push(new CommonsChunkPlugin({
|
|
||||||
"name": [
|
|
||||||
"vendor"
|
|
||||||
],
|
|
||||||
"minChunks": (module) => {
|
|
||||||
return module.resource
|
|
||||||
&& (module.resource.startsWith(nodeModules)
|
|
||||||
|| module.resource.startsWith(genDirNodeModules)
|
|
||||||
|| module.resource.startsWith(realNodeModules));
|
|
||||||
},
|
|
||||||
"chunks": [
|
|
||||||
"main"
|
|
||||||
]
|
|
||||||
}));
|
|
||||||
|
|
||||||
plugins.push(new SourceMapDevToolPlugin({
|
|
||||||
"filename": "[file].map[query]",
|
|
||||||
"moduleFilenameTemplate": "[resource-path]",
|
|
||||||
"fallbackModuleFilenameTemplate": "[resource-path]?[hash]",
|
|
||||||
"sourceRoot": "webpack:///"
|
|
||||||
}));
|
|
||||||
|
|
||||||
plugins.push(new CommonsChunkPlugin({
|
|
||||||
"name": [
|
|
||||||
"main"
|
|
||||||
],
|
|
||||||
"minChunks": 2,
|
|
||||||
"async": "common"
|
|
||||||
}));
|
|
||||||
|
|
||||||
plugins.push(new NamedModulesPlugin({}));
|
|
||||||
|
|
||||||
if (isProd) {
|
|
||||||
plugins.push(new AngularCompilerPlugin({
|
|
||||||
"mainPath": "main.ts",
|
|
||||||
"platform": 0,
|
|
||||||
"sourceMap": true,
|
|
||||||
"tsConfigPath": "src/tsconfig.app.json",
|
|
||||||
"skipCodeGeneration": true,
|
|
||||||
"compilerOptions": {},
|
|
||||||
"hostReplacementPaths": {
|
|
||||||
"environments/index.ts": "environments/index.prod.ts"
|
|
||||||
},
|
|
||||||
"exclude": []
|
|
||||||
}));
|
|
||||||
|
|
||||||
plugins.push(new UglifyJsPlugin({
|
|
||||||
"sourceMap": false
|
|
||||||
}));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
plugins.push(new AngularCompilerPlugin({
|
|
||||||
"mainPath": "main.ts",
|
|
||||||
"platform": 0,
|
|
||||||
"sourceMap": true,
|
|
||||||
"tsConfigPath": "src/tsconfig.app.json",
|
|
||||||
"skipCodeGeneration": true,
|
|
||||||
"compilerOptions": {},
|
|
||||||
"hostReplacementPaths": {
|
|
||||||
"environments/index.ts": "environments/index.ts"
|
|
||||||
},
|
|
||||||
"exclude": []
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
return plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
"devtool": "source-map",
|
|
||||||
"externals": {
|
|
||||||
"electron": "require('electron')",
|
|
||||||
"buffer": "require('buffer')",
|
|
||||||
"child_process": "require('child_process')",
|
|
||||||
"crypto": "require('crypto')",
|
|
||||||
"events": "require('events')",
|
|
||||||
"fs": "require('fs')",
|
|
||||||
"http": "require('http')",
|
|
||||||
"https": "require('https')",
|
|
||||||
"assert": "require('assert')",
|
|
||||||
"dns": "require('dns')",
|
|
||||||
"net": "require('net')",
|
|
||||||
"os": "require('os')",
|
|
||||||
"path": "require('path')",
|
|
||||||
"querystring": "require('querystring')",
|
|
||||||
"readline": "require('readline')",
|
|
||||||
"repl": "require('repl')",
|
|
||||||
"stream": "require('stream')",
|
|
||||||
"string_decoder": "require('string_decoder')",
|
|
||||||
"url": "require('url')",
|
|
||||||
"util": "require('util')",
|
|
||||||
"zlib": "require('zlib')"
|
|
||||||
},
|
|
||||||
"resolve": {
|
|
||||||
"extensions": [
|
|
||||||
".ts",
|
|
||||||
".js",
|
|
||||||
".scss",
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"aliasFields": [],
|
|
||||||
"alias": { // WORKAROUND See. angular-cli/issues/5433
|
|
||||||
"environments": isProd ? path.resolve(__dirname, 'src/environments/index.prod.ts') : path.resolve(__dirname, 'src/environments/index.ts')
|
|
||||||
},
|
|
||||||
"modules": [
|
|
||||||
"./node_modules"
|
|
||||||
],
|
|
||||||
"mainFields": [
|
|
||||||
"browser",
|
|
||||||
"module",
|
|
||||||
"main"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"resolveLoader": {
|
|
||||||
"modules": [
|
|
||||||
"./node_modules"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"entry": {
|
|
||||||
"main": [
|
|
||||||
"./src/main.ts"
|
|
||||||
],
|
|
||||||
"polyfills": [
|
|
||||||
"./src/polyfills.ts"
|
|
||||||
],
|
|
||||||
"styles": styles
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
"path": path.join(process.cwd(), "dist"),
|
|
||||||
"filename": "[name].bundle.js",
|
|
||||||
"chunkFilename": "[id].chunk.js",
|
|
||||||
"crossOriginLoading": false
|
|
||||||
},
|
|
||||||
"module": {
|
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"test": /\.html$/,
|
|
||||||
"use": ["html-loader"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2|json|xml|ico|cur|ani)$/,
|
|
||||||
"use": ["file-loader?name=[path][name].[ext]"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"exclude": style_paths,
|
|
||||||
"test": /\.css$/,
|
|
||||||
"use": [
|
|
||||||
"exports-loader?module.exports.toString()",
|
|
||||||
{
|
|
||||||
"loader": "css-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"importLoaders": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "postcss-loader",
|
|
||||||
"options": {
|
|
||||||
"ident": "postcss",
|
|
||||||
"plugins": postcssPlugins
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"exclude": style_paths,
|
|
||||||
"test": /\.scss$|\.sass$/,
|
|
||||||
"use": [
|
|
||||||
"exports-loader?module.exports.toString()",
|
|
||||||
{
|
|
||||||
"loader": "css-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"importLoaders": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "postcss-loader",
|
|
||||||
"options": {
|
|
||||||
"ident": "postcss",
|
|
||||||
"plugins": postcssPlugins
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "sass-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"precision": 8,
|
|
||||||
"includePaths": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"exclude": style_paths,
|
|
||||||
"test": /\.less$/,
|
|
||||||
"use": [
|
|
||||||
"exports-loader?module.exports.toString()",
|
|
||||||
{
|
|
||||||
"loader": "css-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"importLoaders": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "postcss-loader",
|
|
||||||
"options": {
|
|
||||||
"ident": "postcss",
|
|
||||||
"plugins": postcssPlugins
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "less-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"exclude": style_paths,
|
|
||||||
"test": /\.styl$/,
|
|
||||||
"use": [
|
|
||||||
"exports-loader?module.exports.toString()",
|
|
||||||
{
|
|
||||||
"loader": "css-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"importLoaders": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "postcss-loader",
|
|
||||||
"options": {
|
|
||||||
"ident": "postcss",
|
|
||||||
"plugins": postcssPlugins
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "stylus-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"paths": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": style_paths,
|
|
||||||
"test": /\.css$/,
|
|
||||||
"use": [
|
|
||||||
"style-loader",
|
|
||||||
{
|
|
||||||
"loader": "css-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"importLoaders": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "postcss-loader",
|
|
||||||
"options": {
|
|
||||||
"ident": "postcss",
|
|
||||||
"plugins": postcssPlugins
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": style_paths,
|
|
||||||
"test": /\.scss$|\.sass$/,
|
|
||||||
"use": [
|
|
||||||
"style-loader",
|
|
||||||
{
|
|
||||||
"loader": "css-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"importLoaders": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "postcss-loader",
|
|
||||||
"options": {
|
|
||||||
"ident": "postcss",
|
|
||||||
"plugins": postcssPlugins
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "sass-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"precision": 8,
|
|
||||||
"includePaths": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include":style_paths,
|
|
||||||
"test": /\.less$/,
|
|
||||||
"use": [
|
|
||||||
"style-loader",
|
|
||||||
{
|
|
||||||
"loader": "css-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"importLoaders": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "postcss-loader",
|
|
||||||
"options": {
|
|
||||||
"ident": "postcss",
|
|
||||||
"plugins": postcssPlugins
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "less-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"include": style_paths,
|
|
||||||
"test": /\.styl$/,
|
|
||||||
"use": [
|
|
||||||
"style-loader",
|
|
||||||
{
|
|
||||||
"loader": "css-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"importLoaders": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "postcss-loader",
|
|
||||||
"options": {
|
|
||||||
"ident": "postcss",
|
|
||||||
"plugins": postcssPlugins
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"loader": "stylus-loader",
|
|
||||||
"options": {
|
|
||||||
"sourceMap": false,
|
|
||||||
"paths": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"test": /\.ts$/,
|
|
||||||
"use": "@ngtools/webpack"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"plugins": getPlugins(),
|
|
||||||
"node": {
|
|
||||||
fs: "empty",
|
|
||||||
global: true,
|
|
||||||
crypto: "empty",
|
|
||||||
tls: "empty",
|
|
||||||
net: "empty",
|
|
||||||
process: true,
|
|
||||||
module: false,
|
|
||||||
clearImmediate: false,
|
|
||||||
setImmediate: false,
|
|
||||||
__dirname: false,
|
|
||||||
__filename: false
|
|
||||||
},
|
|
||||||
"devServer": {
|
|
||||||
"historyApiFallback": true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user