diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 873a989660..f3fef63907 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -98,6 +98,7 @@ The scope should be the name of the npm package affected (as perceived by the pe The following is the list of supported scopes: +- **component** - **data** - **effects** - **entity** diff --git a/build/tasks.ts b/build/tasks.ts index 44719a9510..ca13fc1b42 100644 --- a/build/tasks.ts +++ b/build/tasks.ts @@ -18,7 +18,10 @@ export async function copySchematicsCore(config: Config) { .toString('utf-8'); const pkgConfig = JSON.parse(packageJson); - if (pkgConfig.schematics || pkgConfig['ng-update'].migrations) { + if ( + pkgConfig.schematics || + (pkgConfig['ng-update'] && pkgConfig['ng-update'].migrations) + ) { ncp( `${modulesDir}/schematics-core`, `${modulesDir}/${pkg}/schematics-core`, diff --git a/modules/component/BUILD b/modules/component/BUILD new file mode 100644 index 0000000000..04b2f541f8 --- /dev/null +++ b/modules/component/BUILD @@ -0,0 +1,34 @@ +package(default_visibility = ["//visibility:public"]) + +load("//tools:defaults.bzl", "ng_module", "ng_package") + +ng_module( + name = "component", + srcs = glob([ + "*.ts", + "src/**/*.ts", + ]), + module_name = "@ngrx/component", + deps = [ + # TODO: @ngrx/component - add ngrx deps, also add it to package.json as peerDependency + # "//modules/store", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//rxjs", + ], +) + +ng_package( + name = "npm_package", + srcs = glob(["**/*.externs.js"]) + [ + "package.json", + ], + entry_point = "modules/component/index.js", + packages = [ + # TODO: @ngrx/component - add schematic + # "//modules/component/schematics-core:npm_package", + ], + deps = [ + ":component", + ], +) diff --git a/modules/component/CHANGELOG.md b/modules/component/CHANGELOG.md new file mode 100644 index 0000000000..3b9c4d91aa --- /dev/null +++ b/modules/component/CHANGELOG.md @@ -0,0 +1,3 @@ +# Change Log + +See [CHANGELOG.md](https://github.com/ngrx/platform/blob/master/CHANGELOG.md) diff --git a/modules/component/README.md b/modules/component/README.md new file mode 100644 index 0000000000..42302b410a --- /dev/null +++ b/modules/component/README.md @@ -0,0 +1,5 @@ +# @ngrx/component + +The sources for this package are in the main [NgRx](https://github.com/ngrx/platform) repo. Please file issues and pull requests against that repo. + +License: MIT diff --git a/modules/component/index.ts b/modules/component/index.ts new file mode 100644 index 0000000000..637e1cf2bf --- /dev/null +++ b/modules/component/index.ts @@ -0,0 +1,7 @@ +/** + * DO NOT EDIT + * + * This file is automatically generated at build + */ + +export * from './public_api'; diff --git a/modules/component/package.json b/modules/component/package.json new file mode 100644 index 0000000000..c57916ea12 --- /dev/null +++ b/modules/component/package.json @@ -0,0 +1,28 @@ +{ + "name": "@ngrx/component", + "version": "0.0.0-PLACEHOLDER", + "description": "Reactive utilities for components", + "repository": { + "type": "git", + "url": "https://github.com/ngrx/platform.git" + }, + "keywords": [ + "Angular", + "Redux", + "NgRx", + "Schematics", + "Angular CLI" + ], + "author": "NgRx", + "license": "MIT", + "bugs": { + "url": "https://github.com/ngrx/platform/issues" + }, + "homepage": "https://github.com/ngrx/platform#readme", + "peerDependencies": { + "@angular/common": "NG_VERSION", + "@angular/core": "NG_VERSION", + "rxjs": "RXJS_VERSION" + }, + "sideEffects": false +} diff --git a/modules/component/public_api.ts b/modules/component/public_api.ts new file mode 100644 index 0000000000..cba1843545 --- /dev/null +++ b/modules/component/public_api.ts @@ -0,0 +1 @@ +export * from './src/index'; diff --git a/modules/component/rollup.config.js b/modules/component/rollup.config.js new file mode 100644 index 0000000000..0a2f2d98e9 --- /dev/null +++ b/modules/component/rollup.config.js @@ -0,0 +1,11 @@ +export default { + entry: './dist/component/@ngrx/component.es5.js', + dest: './dist/component/bundles/component.umd.js', + format: 'umd', + exports: 'named', + moduleName: 'ngrx.component', + globals: { + // TODO: @ngrx/component - add ngrx deps, also add it to tsconfig-build.json as path + // '@ngrx/store': 'ngrx.store', + }, +}; diff --git a/modules/component/spec/BUILD b/modules/component/spec/BUILD new file mode 100644 index 0000000000..18a0fa4678 --- /dev/null +++ b/modules/component/spec/BUILD @@ -0,0 +1,27 @@ +load("//tools:defaults.bzl", "jasmine_node_test", "ts_test_library") + +ts_test_library( + name = "test_lib", + srcs = glob( + [ + "**/*.ts", + ], + ), + deps = [ + "//modules/component", + # TODO: @ngrx/component - add ngrx deps + # "//modules/store", + "@npm//@angular/common", + "@npm//rxjs", + ], +) + +jasmine_node_test( + name = "test", + deps = [ + ":test_lib", + "//modules/component", + # TODO: @ngrx/component - add ngrx deps + # "//modules/store", + ], +) diff --git a/modules/component/spec/placeholder.spec.ts b/modules/component/spec/placeholder.spec.ts new file mode 100644 index 0000000000..13b296cdb1 --- /dev/null +++ b/modules/component/spec/placeholder.spec.ts @@ -0,0 +1,9 @@ +// TODO: @ngrx/component - remove this file + +import { sum } from '@ngrx/component'; + +describe('placeholder', () => { + it('should run specs', () => { + expect(sum(2, 5)).toBe(7); + }); +}); diff --git a/modules/component/src/index.ts b/modules/component/src/index.ts new file mode 100644 index 0000000000..44ebde2c43 --- /dev/null +++ b/modules/component/src/index.ts @@ -0,0 +1 @@ +export * from './placeholder'; diff --git a/modules/component/src/placeholder.ts b/modules/component/src/placeholder.ts new file mode 100644 index 0000000000..c35602f081 --- /dev/null +++ b/modules/component/src/placeholder.ts @@ -0,0 +1,5 @@ +// TODO: @ngrx/component - remove this file + +export function sum(a: number, b: number) { + return a + b; +} diff --git a/modules/component/tsconfig-build.json b/modules/component/tsconfig-build.json new file mode 100644 index 0000000000..369636fce6 --- /dev/null +++ b/modules/component/tsconfig-build.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "stripInternal": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "strictPropertyInitialization": false, + "module": "es2015", + "moduleResolution": "node", + "noEmitOnError": false, + "noImplicitAny": true, + "noImplicitReturns": true, + "downlevelIteration": true, + "outDir": "../../dist/packages/component", + "paths": {}, + "rootDir": ".", + "sourceMap": true, + "inlineSources": true, + "lib": ["es2015", "dom"], + "target": "es2015", + "skipLibCheck": true + }, + "files": ["public_api.ts"], + "angularCompilerOptions": { + "annotateForClosureCompiler": true, + // Work around for issue: https://github.com/angular/angular/issues/22210 + "strictMetadataEmit": false, + "flatModuleOutFile": "index.js", + "flatModuleId": "@ngrx/component", + "enableIvy": false + } +} diff --git a/projects/ngrx.io/content/guide/component/index.md b/projects/ngrx.io/content/guide/component/index.md new file mode 100644 index 0000000000..7376c2b6db --- /dev/null +++ b/projects/ngrx.io/content/guide/component/index.md @@ -0,0 +1,3 @@ +# @ngrx/component + +Placeholder diff --git a/projects/ngrx.io/content/guide/nightlies.md b/projects/ngrx.io/content/guide/nightlies.md index d2a38419bd..b4a2e8b900 100644 --- a/projects/ngrx.io/content/guide/nightlies.md +++ b/projects/ngrx.io/content/guide/nightlies.md @@ -62,6 +62,16 @@ npm install github:ngrx/data-builds yarn add github:ngrx/data-builds ``` +### Component + +```sh +npm install github:ngrx/component-builds +``` + +```sh +yarn add github:ngrx/component-builds +``` + ### Schematics ```sh diff --git a/projects/ngrx.io/content/navigation.json b/projects/ngrx.io/content/navigation.json index 162e47b303..48783acba9 100644 --- a/projects/ngrx.io/content/navigation.json +++ b/projects/ngrx.io/content/navigation.json @@ -315,6 +315,15 @@ } ] }, + { + "title": "@ngrx/component", + "children": [ + { + "title": "Overview", + "url": "guide/component" + } + ] + }, { "title": "@ngrx/schematics", "children": [ @@ -425,7 +434,8 @@ { "url": "https://stackoverflow.com/questions/tagged/ngrx", "title": "Stack Overflow", - "tooltip": "Stack Overflow: where the community answers your technical NgRx questions." + "tooltip": + "Stack Overflow: where the community answers your technical NgRx questions." }, { "url": "https://gitter.im/ngrx/platform", diff --git a/tools/defaults.bzl b/tools/defaults.bzl index ed43c3d43f..727aa01634 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -17,6 +17,7 @@ NGRX_SCOPED_PACKAGES = ["@ngrx/%s" % p for p in [ "entity", "router-store", "data", + "component", "schematics", "store-devtools", ]] diff --git a/tsconfig.json b/tsconfig.json index b10fbd6068..0b218bb8f8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,7 @@ "rootDir": "./", "strict": true, "paths": { + "@ngrx/component": ["./modules/component"], "@ngrx/data": ["./modules/data"], "@ngrx/data/schematics-core": ["./modules/data/schematics-core"], "@ngrx/effects": ["./modules/effects"],