Skip to content

Commit

Permalink
chore(project): upgrade deps, improve build and configurations (ngxs#656
Browse files Browse the repository at this point in the history
)
  • Loading branch information
e-cloud authored and markwhitfeld committed Nov 26, 2018
1 parent 155812a commit ffc2f63
Show file tree
Hide file tree
Showing 17 changed files with 1,781 additions and 1,052 deletions.
2 changes: 1 addition & 1 deletion .huskyrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -e $GIT_PARAMS"
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
73 changes: 16 additions & 57 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,29 @@
"newProjectRoot": "projects",
"projects": {
"ngxs": {
"root": "./",
"sourceRoot": "./",
"projectType": "application",
"root": "./packages",
"sourceRoot": "./packages",
"projectType": "library",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/",
"index": ".//integration/index.html",
"main": ".//integration/main.ts",
"tsConfig": ".//tsconfig.app.json",
"polyfills": ".//integration/polyfills.ts",
"assets": [],
"styles": [],
"scripts": []
},
"configurations": {}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ngxs:build"
},
"configurations": {}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"browserTarget": "ngxs:build"
"tsConfig": "tsconfig.lib.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": ".//test.ts",
"main": "packages/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": ".//integration/polyfills.ts",
"tsConfig": ".//tsconfig.spec.json",
"scripts": [],
"styles": [],
"assets": []
"tsConfig": "./tsconfig.spec.json"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.lib.json",
"tsconfig.spec.json"
],
"exclude": [
Expand All @@ -61,14 +36,9 @@
}
}
},
"ngxs-e2e": {
"root": "..",
"sourceRoot": "../e2e",
"projectType": "application"
},
"integration": {
"root": "",
"sourceRoot": "src",
"root": "integration",
"sourceRoot": "",
"projectType": "application",
"architect": {
"build": {
Expand All @@ -77,11 +47,8 @@
"outputPath": "dist-integration/",
"index": "./integration/index.html",
"main": "./integration/main.ts",
"tsConfig": "./integration/tsconfig.app.integration.json",
"polyfills": "./integration/polyfills.ts",
"assets": [],
"styles": [],
"scripts": []
"tsConfig": "./integration/tsconfig.app.json",
"polyfills": "./integration/polyfills.ts"
},
"configurations": {
"production": {
Expand Down Expand Up @@ -135,33 +102,25 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "./integration/test.integration.ts",
"main": "./integration/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "./integration/polyfills.ts",
"tsConfig": "./integration/tsconfig.spec.integration.json",
"scripts": [],
"styles": [],
"assets": []
"tsConfig": "./integration/tsconfig.spec.json"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json"
"integration/tsconfig.app.json",
"integration/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"integration-e2e": {
"root": "",
"sourceRoot": "e2e",
"projectType": "application"
}
},
"defaultProject": "ngxs",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"module": "es2015",
"types": ["node"]
},
"include": ["**/*.ts", "./polyfills.ts"],
"exclude": ["test.integration.ts", "**/*.spec.ts"]
"exclude": ["test.ts", "**/*.spec.ts"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"target": "es5",
"types": ["jasmine"]
},
"files": ["test.integration.ts", "polyfills.ts"],
"files": ["test.ts", "polyfills.ts"],
"include": ["**/*.spec.ts"]
}
10 changes: 8 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

const CI = process.env['CI'] === 'true';

module.exports = function(config) {
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
Expand All @@ -17,12 +18,17 @@ module.exports = function(config) {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'), reports: ['html', 'lcovonly'],
dir: require('path').join(__dirname, 'coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'production'
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
browserConsoleLogOptions: {
level: CI ? 'error' : 'debug',
format: '%b %T: %m',
Expand Down
29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,38 +89,37 @@
"@angular/platform-browser-dynamic": "7.0.0",
"@angular/router": "7.0.0",
"@angularclass/hmr": "^2.1.3",
"@commitlint/cli": "^6.1.3",
"@commitlint/config-conventional": "^6.1.3",
"@commitlint/cli": "^7.1.3",
"@commitlint/config-conventional": "^7.1.0",
"@types/deep-freeze-strict": "^1.1.0",
"@types/fs-extra": "^5.0.1",
"@types/googlemaps": "^3.29.2",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~9.6.0",
"@types/node": "^10.0.0",
"@types/semver": "^5.5.0",
"codelyzer": "^4.0.0",
"codelyzer": "^4.5.0",
"core-js": "^2.4.1",
"cross-env": "^5.2.0",
"fs-extra": "^5.0.0",
"husky": "^0.15.0-rc.13",
"jasmine-core": "~2.99.1",
"fs-extra": "^7.0.0",
"husky": "^1.1.0",
"jasmine-core": "^3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma": "^3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-coverage-istanbul-reporter": "^2.0.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"lint-staged": "^7.0.0",
"karma-jasmine-html-reporter": "^1.4.0",
"lint-staged": "^8.0.0",
"mock-socket": "^7.1.0",
"ng-packagr": "^4.3.1",
"npm-run-all": "^4.1.2",
"prettier": "1.15.2",
"rxjs": "^6.0.0",
"ts-node": "~5.0.1",
"tsickle": "^0.33.0",
"ts-node": "^7.0.1",
"tsickle": "^0.33.1",
"tslib": "^1.9.0",
"tslint": "^5.8.0",
"tslint": "^5.11.0",
"typedoc": "^0.13.0",
"typedoc-plugin-markdown": "^1.1.19",
"typescript": "^3.1.0",
Expand Down
5 changes: 3 additions & 2 deletions test.ts → packages/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'reflect-metadata';
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import 'reflect-metadata';

import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
Expand All @@ -16,7 +17,7 @@ __karma__.loaded = function() {};
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());

// Then we find all the tests.
const context = require.context('./packages', true, /\.spec\.ts$/);
const context = require.context('./', true, /\.spec\.ts$/);

// And load the modules.
context.keys().map(context);
Expand Down
4 changes: 2 additions & 2 deletions tools/publish-dev-builds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ async function main() {
}

// shorten commit
commit = commit.slice(0, 7);
commit = commit!.slice(0, 7);

// construct new version from base version 2.0.0 to become 2.0.0+dev.shortsha
const version: SemVer = parse(json.version);
const version: SemVer = parse(json.version)!;
const newVersion = `${version.major}.${version.minor}.${version.patch}-dev.master-${commit}`;

console.log('publishing new version', newVersion);
Expand Down
2 changes: 1 addition & 1 deletion tools/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Package {

export function getPackages(): Package[] {
const json = require('../package.json');
const packages = json.packages;
const packages: string[] = json.packages;

return packages.map(pack => {
const path = pack.split('/');
Expand Down
11 changes: 0 additions & 11 deletions tsconfig.app.json

This file was deleted.

28 changes: 17 additions & 11 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
{
"extends": "./tsconfig.json",
"angularCompilerOptions": {
"flatModuleId": "AUTOGENERATED",
"flatModuleOutFile": "AUTOGENERATED"
},
"compilerOptions": {
"paths": {
"@ngxs/*": ["@ngxs/*"]
},
"outDir": "out-tsc/lib",
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"inlineSources": true,
"importHelpers": true,
"skipLibCheck": true,
"importHelpers": true
"paths": {
"@ngxs/*": ["@ngxs/*"]
}
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"flatModuleId": "AUTOGENERATED",
"flatModuleOutFile": "AUTOGENERATED"
},
"files": ["AUTOGENERATED"]
"exclude": [
"**/test.ts",
"**/*.spec.ts"
]
}
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@ngxs/*": ["packages/*"]
},
"noUnusedLocals": true,
"strictPropertyInitialization": false,
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
Expand All @@ -14,5 +15,8 @@
"target": "es5",
"lib": ["es2017", "dom"],
"typeRoots": ["node_modules/@types"]
}
},
"exclude": [
"@ngxs/**"
]
}
15 changes: 15 additions & 0 deletions tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "out-tsc/lib",
"target": "es2015",
"module": "es2015",
"declaration": true,
"inlineSources": true,
"importHelpers": true
},
"exclude": [
"**/test.ts",
"**/*.spec.ts"
]
}
8 changes: 4 additions & 4 deletions tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"outDir": "./out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": ["jasmine", "node"]
"types": ["jasmine", "node"],
"importHelpers": true
},
"files": ["test.ts", "integration/polyfills.ts"],
"files": ["packages/test.ts"],
"include": ["packages/**/*.ts", "packages/**/*.spec.ts"]
}
2 changes: 1 addition & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"no-eval": true,
"no-inferrable-types": [true, "ignore-params"],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-non-null-assertion": false,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
Expand Down
Loading

0 comments on commit ffc2f63

Please sign in to comment.