Skip to content

Commit

Permalink
chore(build): use ng-packagr (angular-redux#37)
Browse files Browse the repository at this point in the history
Switches the build system for all of the libraries to use ng-packagr. This brings the library in line with the official Angular Package Format. Also adjusts the package peer dependencies to more acurately reflect the reality of each library

BREAKING CHANGE:
- changes the output to conform to the Angular Package Format. This may cause subtle differences in consumption behaviour
- peer dependencies have been corrected to actual dependencies
closes angular-redux#9
  • Loading branch information
smithad15 committed Nov 8, 2018
1 parent 336cc60 commit dffe23a
Show file tree
Hide file tree
Showing 55 changed files with 425 additions and 980 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ coverage
lerna-debug.log
yarn-debug.log
yarn-error.log
.vscode
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ module.exports = {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/jest/file.mock.ts',
},
modulePathIgnorePatterns: ['dist'],
reporters: ['default', 'jest-junit'],
collectCoverageFrom: [
'**/packages/**/*.{ts,js}',
'!**/node_modules/**',
'!**/dist/**',
'!**/lib/**',
],
coverageReporters: ['lcov', 'text-summary'],
};
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"packages/*"
],
"scripts": {
"build": "lerna run build",
"build": "npm-run-all build:*",
"build:store": "ng-packagr -p packages/store",
"build:form": "ng-packagr -p packages/form",
"build:router": "ng-packagr -p packages/router",
"clean": "npm-run-all -p clean:*",
"clean:workspace-deps": "rimraf node_modules",
"clean:package-deps": "rimraf packages/*/node_modules",
"clean:coverage": "rimraf coverage",
"lint": "tslint -p tsconfig.json",
"lint:packages": "lerna run lint",
"clean:package-dist": "rimraf packages/*/dist",
"lint": "npm-run-all -p lint:*",
"lint:packages": "tslint -p tsconfig.json",
"lint:prettier": "prettier -l \"**/*.*(ts|js|css|scss|json|md)\"",
"test": "jest --coverage",
"test:ci": "jest --coverage --ci --maxWorkers=2",
Expand Down Expand Up @@ -39,6 +43,7 @@
"jest-zone-patch": "0.0.8",
"lerna": "2.11.0",
"lint-staged": "7.2.0",
"ng-packagr": "3.0.6",
"npm-run-all": "4.1.3",
"prettier": "1.13.7",
"rimraf": "2.6.2",
Expand Down
3 changes: 0 additions & 3 deletions packages/form/.babelrc

This file was deleted.

52 changes: 0 additions & 52 deletions packages/form/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions packages/form/.npmignore

This file was deleted.

8 changes: 8 additions & 0 deletions packages/form/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "src/index.ts",
"languageLevel": ["esnext", "dom", "dom.iterable"]
},
"whitelistedNonPeerDependencies": ["tslib", "immutable"]
}
52 changes: 26 additions & 26 deletions packages/form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
"name": "@angular-redux/form",
"version": "9.0.1",
"description": "Build Angular 2+ forms with Redux",
"main": "dist/source/index.js",
"typings": "dist/source/index.d.ts",
"repository": "https://github.com/angular-redux/form",
"author": "Chris Bond",
"license": "MIT",
"publishConfig": {
"access": "public"
"homepage": "https://github.com/angular-redux/platform",
"repository": {
"type": "git",
"url": "git+https://github.com/angular-redux/platform.git"
},
"engines": {
"node": ">=6.0"
"bugs": {
"url": "https://github.com/angular-redux/platform/issues"
},
"scripts": {
"prebuild": "npm run clean",
"build": "ngc",
"clean": "rimraf dist",
"cover": "istanbul report --include=**/chrome/coverage-final.json text text-summary",
"prepublish": "npm run build"
"keywords": [
"angular",
"redux",
"form",
"forms"
],
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"@angular-redux/store": "^9.0.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"redux": "^4.0.0"
"rxjs": "^6.0.0"
},
"dependencies": {
"immutable": "3.8.2"
Expand All @@ -39,19 +39,19 @@
"@angular/forms": "6.0.7",
"@angular/platform-browser": "6.0.7",
"@angular/platform-browser-dynamic": "6.0.7",
"@ngtools/webpack": "6.0.7",
"@types/node": "6.0.114",
"babel-core": "6.26.3",
"babel-loader": "6.4.1",
"babel-preset-es2015": "6.24.1",
"cross-env": "2.0.1",
"redux": "4.0.0",
"redux-logger": "2.10.2",
"reflect-metadata": "0.1.12",
"rimraf": "2.6.2",
"rxjs": "6.2.1",
"typescript": "2.7.2",
"webpack": "2.7.0",
"zone.js": "0.8.26"
}
},
"main": "dist/bundles/angular-redux-form.umd.js",
"module": "dist/fesm5/angular-redux-form.js",
"es2015": "dist/fesm2015/angular-redux-form.js",
"esm5": "dist/esm5/angular-redux-form.js",
"esm2015": "dist/esm2015/angular-redux-form.js",
"fesm5": "dist/fesm5/angular-redux-form.js",
"fesm2015": "dist/fesm2015/angular-redux-form.js",
"typings": "dist/angular-redux-form.d.ts",
"metadata": "dist/angular-redux-form.metadata.json"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ import { ConnectArrayTemplate } from './connect-array-template';
},
],
})
export class ConnectArrayDirective extends ControlContainer implements OnInit, OnDestroy {
export class ConnectArrayDirective extends ControlContainer
implements OnInit, OnDestroy {
private stateSubscription: Unsubscribe;

private array = new FormArray([]);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
// export class UpdateTextComponent {}

describe('connect directive', () => {
it('should have a fake test for now until we can fix them...', () => undefined);
it('should have a fake test for now until we can fix them...', () =>
undefined);
// let store: Store<AppState>;

// beforeEach(done => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions packages/form/source/state.ts → packages/form/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export type TraverseCallback = (
) => any;

export abstract class State {
static traverse<StateType>(state: StateType, path: string[], fn?: TraverseCallback) {
static traverse<StateType>(
state: StateType,
path: string[],
fn?: TraverseCallback,
) {
let deepValue = state;

for (const k of path) {
Expand Down Expand Up @@ -280,15 +284,15 @@ export abstract class State {
if (key != null) {
return { ...parent, [key]: value };
}
return { ...parent, ...value as any };
return { ...parent, ...(value as any) };
},
(parent: any, _: any, value: K) => {
for (const k of Object.keys(value)) {
parent[k] = (value as any)[k];
}
return parent;
},
() => ({ ...object as any }),
() => ({ ...(object as any) }),
);
default:
break;
Expand Down
File renamed without changes.
33 changes: 0 additions & 33 deletions packages/form/tsconfig.json

This file was deleted.

32 changes: 0 additions & 32 deletions packages/form/webpack/loaders.js

This file was deleted.

15 changes: 0 additions & 15 deletions packages/form/webpack/plugins.js

This file was deleted.

8 changes: 0 additions & 8 deletions packages/router/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions packages/router/.npmignore

This file was deleted.

7 changes: 7 additions & 0 deletions packages/router/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "src/index.ts",
"languageLevel": ["esnext", "dom", "dom.iterable"]
}
}
Loading

0 comments on commit dffe23a

Please sign in to comment.