Skip to content

Commit

Permalink
Updated from generator v9.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cirebot.github@gmail.com committed Jan 14, 2021
1 parent 8a7a6ce commit 495eb9c
Show file tree
Hide file tree
Showing 23 changed files with 118 additions and 396 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ trim_trailing_whitespace = true
end_of_line = lf
max_line_length = 120

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
/platforms

# Electron
/dist.electron
/dist-electron
/dist-packages
/electron.main.js

# IDEs and editors
Expand Down
2 changes: 1 addition & 1 deletion .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"ignorePseudoElements": ["ng-deep"]
}
],
"unit-whitelist": ["px", "%", "em", "rem", "vw", "vh", "deg", "s"],
"unit-allowed-list": ["px", "%", "em", "rem", "vw", "vh", "deg", "s"],
"max-empty-lines": 2,
"max-line-length": 120
}
Expand Down
8 changes: 2 additions & 6 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
Expand Down Expand Up @@ -73,14 +72,11 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ng-x-rocket:build",
"hmr": true,
"hmrWarning": false
"browserTarget": "ng-x-rocket:build"
},
"configurations": {
"production": {
"browserTarget": "ng-x-rocket:build:production",
"hmr": false
"browserTarget": "ng-x-rocket:build:production"
},
"ci": {
"progress": false
Expand Down
2 changes: 1 addition & 1 deletion docs/electron.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Alternatively, you can build a package for one specific target platform using:
npm run electron:package:<windows|mac|linux>
```

The build packages will be then located in the `dist.packages` folder.
The build packages will be then located in the `dist-packages` folder.

> Note: in order to build Windows packages from non-Windows platform, you need to install
> [Wine](https://www.winehq.org) 1.6 or later.
Expand Down
4 changes: 2 additions & 2 deletions e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../tsconfig.base.json",
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
Expand All @@ -11,4 +11,4 @@
"node"
]
}
}
}
53 changes: 23 additions & 30 deletions electron.main.ts
Original file line number Diff line number Diff line change
@@ -1,61 +1,54 @@
import { app, BrowserWindow, screen } from 'electron';

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow: BrowserWindow | null;

// Enable live reload if process is started with the --serve argument
const liveReload = process.argv.slice(2).some(arg => arg === '--serve');

function createWindow() {
const electronScreen = screen;
const size = electronScreen.getPrimaryDisplay().workAreaSize;
const size = screen.getPrimaryDisplay().workAreaSize;

// Create the browser window.
mainWindow = new BrowserWindow({
const mainWindow = new BrowserWindow({
x: 0,
y: 0,
width: size.width,
height: size.height
height: size.height,
webPreferences: {
nodeIntegration: true,
allowRunningInsecureContent: liveReload
}
});

if (liveReload) {
mainWindow.webContents.openDevTools();
require('electron-reload')(__dirname, { electron: require(`${__dirname}/node_modules/electron`) });
mainWindow.loadURL('http://localhost:4200');
mainWindow.webContents.openDevTools();
} else {
// Load the index.html of the app.
mainWindow.loadFile('dist.electron/index.html');
}

// Emitted when the window is closed.
mainWindow.on('closed', () => {
// Dereference the window object, usually you would store window
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
mainWindow.loadFile('dist-electron/index.html');
}
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);
app.whenReady().then(() => {
createWindow();

app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
});
});

// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow();
app.quit();
}
});

Expand Down
62 changes: 31 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,72 @@
"main": "electron.main.js",
"scripts": {
"ng": "ng",
"build": "npm run env -s && ng build --prod",
"start": "npm run env -s && ng serve --proxy-config proxy.conf.js",
"build": "npm run write:env -s && ng build --prod",
"start": "npm run write:env -s && ng serve --proxy-config proxy.conf.js",
"lint": "ng lint && stylelint \"src/**/*.scss\" --syntax scss && htmlhint \"src\" --config .htmlhintrc",
"test": "npm run env -s && ng test",
"test:ci": "npm run env -s && npm run lint -s && ng test --configuration=ci",
"e2e": "npm run env -s && ng e2e",
"test": "npm run write:env -s && ng test",
"test:ci": "npm run write:env -s && npm run lint -s && ng test --configuration=ci",
"e2e": "npm run write:env -s && ng e2e",
"translations:extract": "ngx-translate-extract --input ./src --output ./src/translations/template.json --format=json --clean --sort",
"env": "ngx-scripts env npm_package_version",
"write:env": "ngx-scripts env npm_package_version",
"electron:compile": "tsc --project tsconfig.electron.json",
"electron:run": "npm run electron:compile -s && electron .",
"electron:build": "npm run electron:compile -s && npm run env -s && ng build --prod --base-href ./dist.electron --output-path dist.electron",
"electron:package:common": "electron-packager . --overwrite --out=dist.packages --ignore=\"/(platforms|plugins|docs|www|reports|e2e|src)\"",
"electron:build": "npm run electron:compile -s && npm run write:env -s && ng build --prod --base-href ./ --output-path dist-electron",
"electron:package:common": "electron-packager . --overwrite --out=dist-packages --ignore=\"/(platforms|plugins|docs|www|reports|e2e|src)\"",
"electron:package:windows": "npm run electron:package:common -s -- --platform=win32 --arch=x64 --icon=./resources/win/icon.ico",
"electron:package:mac": "npm run electron:package:common -s -- --platform=darwin --icon=./resources/mac/icon.icns",
"electron:package:linux": "npm run electron:package:common -s --platform=linux",
"electron:package": "npm run electron:package:windows -s && npm run electron:package:mac -s && npm run electron:package:linux -s",
"generate": "ng generate"
},
"dependencies": {
"@angular/animations": "^10.1.4",
"@angular/common": "^10.1.4",
"@angular/compiler": "^10.1.4",
"@angular/core": "^10.1.4",
"@angular/forms": "^10.1.4",
"@angular/platform-browser": "^10.1.4",
"@angular/platform-browser-dynamic": "^10.1.4",
"@angular/router": "^10.1.4",
"@angular/animations": "^11.0.8",
"@angular/common": "^11.0.8",
"@angular/compiler": "^11.0.8",
"@angular/core": "^11.0.8",
"@angular/forms": "^11.0.8",
"@angular/platform-browser": "^11.0.8",
"@angular/platform-browser-dynamic": "^11.0.8",
"@angular/router": "^11.0.8",
"@ngx-translate/core": "^13.0.0",
"@ionic/angular": "^5.3.2",
"rxjs": "^6.6.3",
"tslib": "^2.0.1",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular/cli": "~10.1.4",
"@angular/compiler-cli": "^10.1.4",
"@angular/language-service": "^10.1.4",
"@angular-devkit/build-angular": "^0.1001.4",
"@angularclass/hmr": "^3.0.0",
"@angular/cli": "~11.0.6",
"@angular/compiler-cli": "^11.0.8",
"@angular/language-service": "^11.0.8",
"@angular-devkit/build-angular": "^0.1100.6",
"@biesbjerg/ngx-translate-extract": "^7.0.3",
"@biesbjerg/ngx-translate-extract-marker": "^1.0.0",
"@ngx-rocket/scripts": "^4.0.0",
"@types/jasmine": "^3.5.14",
"@ngx-rocket/scripts": "^5.0.0",
"@ngneat/until-destroy": "^8.0.3",
"@types/jasmine": "^3.6.2",
"@types/jasminewd2": "^2.0.8",
"@types/node": "^12.12.62",
"@types/node": "^12.19.12",
"codelyzer": "^6.0.1",
"electron": "^10.1.0",
"electron": "^11.1.1",
"electron-packager": "^15.1.0",
"electron-reload": "^1.5.0",
"htmlhint": "^0.14.1",
"htmlhint": "^0.14.2",
"https-proxy-agent": "^5.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.1",
"karma": "~5.2.3",
"jasmine-spec-reporter": "~6.0.0",
"karma": "~5.1.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.5.4",
"karma-junit-reporter": "^2.0.1",
"protractor": "~7.0.0",
"stylelint": "~13.7.2",
"stylelint": "~13.8.0",
"stylelint-config-recommended-scss": "~4.2.0",
"stylelint-config-standard": "~20.0.0",
"stylelint-scss": "~3.18.0",
"ts-node": "^9.0.0",
"ts-node": "^9.1.1",
"tslint": "~6.1.0",
"typescript": "~4.0.3"
"typescript": "~4.0.5"
}
}
2 changes: 1 addition & 1 deletion src/app/@core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export * from './http/api-prefix.interceptor';
export * from './http/error-handler.interceptor';
export * from './route-reusable-strategy';
export * from './logger.service';
export * from './until-destroyed';
export * from '@ngneat/until-destroy';;
6 changes: 5 additions & 1 deletion src/app/@core/route-reusable-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ export class RouteReusableStrategy extends RouteReuseStrategy {
}

public shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
return (future.routeConfig === curr.routeConfig) || future.data.reuse;
// Reuse the route if the RouteConfig is the same, or if both routes use the
// same component, because the latter can have different RouteConfigs.
return future.routeConfig === curr.routeConfig ||
Boolean(future.routeConfig?.component &&
future.routeConfig?.component === curr.routeConfig?.component);
}

}
Loading

0 comments on commit 495eb9c

Please sign in to comment.