Skip to content

Commit b36f972

Browse files
NothingEverHappensjamesdaniels
authored andcommitted
Set up builder/schematic in package.json (#2053)
Make sure everything works 🔥
1 parent 125cc13 commit b36f972

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
1515
"build:wrapper": "npm i --prefix wrapper && VERSION=5.1.2 npm run --prefix wrapper build"
1616
},
17+
"schematics": "./dist/packages-dist/collection.json",
18+
"builders": "./dist/packages-dist/builders.json",
1719
"keywords": [
1820
"angular",
1921
"firebase",

src/core/collection.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"schematics": {
44
"ng-add": {
55
"description": "Add firebase deploy schematic",
6-
"factory": "./schematics/ng-add/index#ngDeploy"
6+
"factory": "./schematics/index#ngDeploy"
77
}
88
}
9-
}
9+
}

src/schematics/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { Tree } from '@angular-devkit/schematics';
22
import { from } from 'rxjs';
3-
import { map } from 'rxjs/operators';
3+
import { map, switchMap } from 'rxjs/operators';
44
import { Project } from './interfaces';
55
import { ngAdd } from './ng-add';
66
import { listProjects, projectPrompt } from './utils';
77

88
interface DeployOptions {
9-
project: string;
9+
project: string;
1010
}
1111

1212
// You don't have to export the function as default. You can also have more than one rule factory
1313
// per file.
1414
export const ngDeploy = ({project}: DeployOptions) => (host: Tree) => from(listProjects()).pipe(
15-
map((projects: Project[]) => projectPrompt(projects)),
16-
map(({firebaseProject}: any) => ngAdd(host, {firebaseProject, project}))
17-
)
15+
switchMap((projects: Project[]) => projectPrompt(projects)),
16+
map(({firebaseProject}: any) => ngAdd(host, {firebaseProject, project}))
17+
);

src/schematics/ng-add.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import 'jasmine';
2+
3+
describe('ng add', () => {
4+
it('adds', () => {
5+
expect(1).toBe(1);
6+
});
7+
});

src/schematics/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
"target": "es6",
2121
"types": [ "node"]
2222
},
23-
"include": ["*"]
24-
}
23+
"include": ["**/*.ts"]
24+
}

0 commit comments

Comments
 (0)