Skip to content

Commit

Permalink
feat(component-store): add initial setup (#2519)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-okrushko authored May 12, 2020
1 parent 4f7dcdc commit a2657ac
Show file tree
Hide file tree
Showing 19 changed files with 164 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,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**
- **component-store**
- **data**
- **effects**
- **entity**
Expand Down
27 changes: 27 additions & 0 deletions modules/component-store/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])

load("//tools:defaults.bzl", "ng_package", "ts_library")

ts_library(
name = "component-store",
srcs = glob([
"*.ts",
"src/**/*.ts",
]),
module_name = "@ngrx/component-store",
deps = [
"@npm//rxjs",
"@npm//tslib",
],
)

ng_package(
name = "npm_package",
srcs = glob(["**/*.externs.js"]) + [
"package.json",
],
entry_point = "modules/component-store/index.js",
deps = [
":component-store",
],
)
3 changes: 3 additions & 0 deletions modules/component-store/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Change Log

See [CHANGELOG.md](https://github.com/ngrx/platform/blob/master/CHANGELOG.md)
3 changes: 3 additions & 0 deletions modules/component-store/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @ngrx/component-store

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.
7 changes: 7 additions & 0 deletions modules/component-store/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* DO NOT EDIT
*
* This file is automatically generated at build
*/

export * from './public_api';
28 changes: 28 additions & 0 deletions modules/component-store/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@ngrx/component-store",
"version": "0.0.0-PLACEHOLDER",
"description": "Reactive store for component state",
"repository": {
"type": "git",
"url": "https://github.com/ngrx/platform.git"
},
"keywords": [
"Angular",
"Redux",
"NgRx",
"Schematics",
"Local State",
"Component State",
"State management"
],
"author": "NgRx",
"license": "MIT",
"bugs": {
"url": "https://github.com/ngrx/platform/issues"
},
"homepage": "https://github.com/ngrx/platform#readme",
"peerDependencies": {
"rxjs": "RXJS_VERSION"
},
"sideEffects": false
}
1 change: 1 addition & 0 deletions modules/component-store/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src/index';
9 changes: 9 additions & 0 deletions modules/component-store/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
entry: './dist/component-store/@ngrx/component-store.es5.js',
dest: './dist/component-store/bundles/component-store.umd.js',
format: 'umd',
exports: 'named',
moduleName: 'ngrx.component-store',
globals: {
},
};
21 changes: 21 additions & 0 deletions modules/component-store/spec/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_test_library")

ts_test_library(
name = "test_lib",
srcs = glob(
[
"**/*.ts",
],
),
deps = [
"//modules/component-store",
"@npm//rxjs",
],
)

jasmine_node_test(
name = "test",
deps = [
":test_lib",
],
)
7 changes: 7 additions & 0 deletions modules/component-store/spec/placeholder.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { sum } from '@ngrx/component-store';

describe('placeholder', () => {
it('should run specs', () => {
expect(sum(2, 5)).toBe(7);
});
});
1 change: 1 addition & 0 deletions modules/component-store/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './placeholder';
3 changes: 3 additions & 0 deletions modules/component-store/src/placeholder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function sum(a: number, b: number) {
return a + b;
}
27 changes: 27 additions & 0 deletions modules/component-store/tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",
"strict": true,
"outDir": "../../dist/packages/component-store",
"paths": {},
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es2015", "dom"],
"target": "es2015",
"skipLibCheck": true
},
"files": ["public_api.ts"],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"flatModuleOutFile": "index.js",
"flatModuleId": "@ngrx/component-store",
"enableIvy": false
}
}
3 changes: 3 additions & 0 deletions projects/ngrx.io/content/guide/component-store/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @ngrx/component-store

Placeholder
10 changes: 10 additions & 0 deletions projects/ngrx.io/content/guide/nightlies.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ npm install github:ngrx/component-builds
yarn add github:ngrx/component-builds
```

### Component Store

```sh
npm install github:ngrx/component-store-builds
```

```sh
yarn add github:ngrx/component-store-builds
```

### Schematics

```sh
Expand Down
3 changes: 2 additions & 1 deletion projects/ngrx.io/content/marketing/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ NgRx is also powered by memoized selector functions which optimize state query c

In particular, you might use NgRx when you build an application with a lot of user interactions and multiple data sources, when managing state in services are no longer sufficient.

A good substance that might answer the question "Do I need NgRx", is the
A good substance that might answer the question "Do I need NgRx", is the
<a href="https://youtu.be/omnwu_etHTY" target="_blank">**SHARI**</a> principle:

* **S**hared: state that is accessed by many components and services.
Expand All @@ -63,4 +63,5 @@ It is also often require a steep learning curve, including some good understandi
- [Entity](guide/entity) - Entity State adapter for managing record collections.
- [NgRx Data](guide/data) - Extension for simplified entity data management.
- [NgRx Component](guide/component) - Extension for fully reactive, fully zone-less applications.
- [ComponentStore](guide/component-store) - Standalone library for managing local/component state.
- [Schematics](guide/schematics) - Scaffolding library for Angular applications using NgRx libraries.
9 changes: 9 additions & 0 deletions projects/ngrx.io/content/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,15 @@
}
]
},
{
"title": "@ngrx/component-store",
"children": [
{
"title": "Overview",
"url": "guide/component-store"
}
]
},
{
"title": "@ngrx/schematics",
"children": [
Expand Down
1 change: 1 addition & 0 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ NGRX_SCOPED_PACKAGES = ["@ngrx/%s" % p for p in [
"router-store",
"data",
"component",
"component-store",
"schematics",
"store-devtools",
]]
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"strict": true,
"paths": {
"@ngrx/component": ["./modules/component"],
"@ngrx/component-store": ["./modules/component-store"],
"@ngrx/data": ["./modules/data"],
"@ngrx/data/schematics-core": ["./modules/data/schematics-core"],
"@ngrx/effects": ["./modules/effects"],
Expand Down

0 comments on commit a2657ac

Please sign in to comment.