@simondotm/nx-firebase 2.2.0 → 17.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -21
- package/executors.json +2 -2
- package/generators.json +1 -1
- package/package.json +7 -7
- package/src/__generated__/nx-firebase-versions.d.ts +11 -0
- package/src/__generated__/nx-firebase-versions.js +19 -0
- package/src/__generated__/nx-firebase-versions.js.map +1 -0
- package/src/executors/serve/schema.json +3 -3
- package/src/generators/application/application.d.ts +6 -6
- package/src/generators/application/application.js +65 -36
- package/src/generators/application/application.js.map +1 -1
- package/src/generators/application/files/firestore.indexes.json +25 -2
- package/src/generators/application/files/firestore.rules +10 -6
- package/src/generators/application/files/public/404.html +33 -0
- package/src/generators/application/files/public/index.html +11 -11
- package/src/generators/application/files/storage.rules +6 -3
- package/src/generators/application/lib/create-files.d.ts +2 -2
- package/src/generators/application/lib/create-files.js +11 -0
- package/src/generators/application/lib/create-files.js.map +1 -1
- package/src/generators/application/schema.d.ts +9 -4
- package/src/generators/application/schema.json +14 -9
- package/src/generators/function/files/src/main.ts__tmpl__ +4 -7
- package/src/generators/function/function.d.ts +6 -6
- package/src/generators/function/function.js +63 -26
- package/src/generators/function/function.js.map +1 -1
- package/src/generators/function/lib/add-function-config.d.ts +2 -2
- package/src/generators/function/lib/add-function-config.js +2 -2
- package/src/generators/function/lib/add-function-config.js.map +1 -1
- package/src/generators/function/lib/create-files.d.ts +3 -3
- package/src/generators/function/lib/create-files.js +16 -5
- package/src/generators/function/lib/create-files.js.map +1 -1
- package/src/generators/function/lib/delete-files.d.ts +4 -4
- package/src/generators/function/lib/delete-files.js +3 -3
- package/src/generators/function/lib/delete-files.js.map +1 -1
- package/src/generators/function/lib/update-project.d.ts +2 -2
- package/src/generators/function/lib/update-project.js +11 -5
- package/src/generators/function/lib/update-project.js.map +1 -1
- package/src/generators/function/schema.d.ts +15 -11
- package/src/generators/function/schema.json +14 -8
- package/src/generators/init/init.d.ts +2 -2
- package/src/generators/init/init.js +10 -4
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/init/lib/add-dependencies.js +19 -10
- package/src/generators/init/lib/add-dependencies.js.map +1 -1
- package/src/generators/init/schema.d.ts +3 -1
- package/src/generators/init/schema.json +7 -1
- package/src/generators/migrate/schema.json +1 -2
- package/src/utils/index.d.ts +0 -1
- package/src/utils/index.js +0 -1
- package/src/utils/index.js.map +1 -1
- package/src/utils/update-tsconfig.d.ts +2 -1
- package/src/utils/update-tsconfig.js +13 -3
- package/src/utils/update-tsconfig.js.map +1 -1
- package/src/utils/workspace.js +5 -3
- package/src/utils/workspace.js.map +1 -1
- package/src/utils/versions.d.ts +0 -13
- package/src/utils/versions.js +0 -33
- package/src/utils/versions.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,31 +1,116 @@
|
|
|
1
|
-
# @simondotm/nx-firebase
|
|
1
|
+
# @simondotm/nx-firebase    
|
|
2
2
|
|
|
3
|
-
A plugin for [Nx](https://nx.dev) v16.
|
|
3
|
+
A plugin for [Nx](https://nx.dev) v16.8.1+ that integrates Firebase workflows in an Nx monorepo workspace.
|
|
4
|
+
|
|
5
|
+
* Easily generate Firebase applications and functions
|
|
6
|
+
* Uses `esbuild` for fast Firebase function builds so you can easily create & import shared Nx libraries with the benefits of tree-shaking
|
|
7
|
+
* Supports function environment variables and secrets
|
|
8
|
+
* Supports single or multiple firebase projects/apps within an Nx workspace
|
|
9
|
+
* Full support for the Firebase Emulator suite for local development, with watch mode for functions
|
|
10
|
+
* Keeps your `firebase.json` configurations in sync when renaming or deleting Firebase apps & functions
|
|
11
|
+
* Only very lightly opinionated about your Firebase configurations and workspace layouts; you can use Nx or the Firebase CLI
|
|
4
12
|
|
|
5
13
|
See [CHANGELOG](https://github.com/simondotm/nx-firebase/blob/main/CHANGELOG.md) for release notes.
|
|
6
14
|
|
|
7
|
-
##
|
|
15
|
+
## Install Plugin
|
|
16
|
+
|
|
17
|
+
**`npm install @simondotm/nx-firebase --save-dev`**
|
|
18
|
+
|
|
19
|
+
- Installs this plugin into your Nx workspace
|
|
20
|
+
- This will also install `@nx/node` and firebase SDK's to your root workspace `package.json` if they are not already installed
|
|
21
|
+
|
|
22
|
+
## Generate Firebase Application
|
|
23
|
+
|
|
24
|
+
**`nx g @simondotm/nx-firebase:app my-new-firebase-app [--directory=dir] [--project=proj]`**
|
|
25
|
+
|
|
26
|
+
- Generates a new Nx Firebase application project in the workspace
|
|
27
|
+
- The app generator will also create a Firebase configuration file in the root of your workspace (along with a default `.firebaserc` and `firebase.json` if they don't already exist)
|
|
28
|
+
- For the first firebase application you create, the project firebase configuration will be `firebase.json`
|
|
29
|
+
- If you create additional firebase applications, the project firebase configuration will be `firebase.<app-project-name>.json`
|
|
30
|
+
- Use `--project` to link your Firebase App to a Firebase project name in your `.firebaserc` file
|
|
31
|
+
|
|
32
|
+
## Generate Firebase Function
|
|
33
|
+
|
|
34
|
+
**`nx g @simondotm/nx-firebase:function my-new-firebase-function --app=my-new-firebase-app [--directory=dir]`**
|
|
35
|
+
|
|
36
|
+
- Generates a new Nx Firebase function application project in the workspace
|
|
37
|
+
- Firebase Function projects must be linked to a Firebase application project with the `--app` option
|
|
38
|
+
- Firebase Function projects can contain one or more firebase functions
|
|
39
|
+
- You can generate as many Firebase Function projects as you need for your application
|
|
40
|
+
|
|
41
|
+
## Build
|
|
42
|
+
|
|
43
|
+
**`nx build my-new-firebase-app`**
|
|
44
|
+
|
|
45
|
+
- Compiles & builds all Firebase function applications linked to the Nx Firebase application or an individual function
|
|
46
|
+
|
|
47
|
+
**`nx build my-new-firebase-function`**
|
|
48
|
+
|
|
49
|
+
- Compiles & builds an individual function
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Serve
|
|
53
|
+
|
|
54
|
+
**`nx serve my-new-firebase-app`**
|
|
55
|
+
|
|
56
|
+
- Builds & Watches all Firebase functions apps linked to the Firebase application
|
|
57
|
+
- Starts the Firebase emulators
|
|
58
|
+
|
|
59
|
+
## Deploy
|
|
60
|
+
|
|
61
|
+
### Firebase Application
|
|
62
|
+
|
|
63
|
+
**`nx deploy my-new-firebase-app [--only ...]`**
|
|
64
|
+
|
|
65
|
+
- By default, deploys ALL of your cloud resources associated with your Firebase application (eg. sites, functions, database rules etc.)
|
|
66
|
+
- Use the `--only` option to selectively deploy (same as Firebase CLI)
|
|
67
|
+
|
|
68
|
+
For initial deployment:
|
|
69
|
+
|
|
70
|
+
- **`firebase login`** if not already authenticated
|
|
71
|
+
- **`firebase use --add`** to add your Firebase Project(s) to the `.firebaserc` file in your workspace. This step must be completed before you can deploy anything to Firebase.
|
|
72
|
+
|
|
73
|
+
Note that you can also use the firebase CLI directly if you prefer:
|
|
74
|
+
|
|
75
|
+
- **`firebase deploy --config=firebase.<appname>.json --only functions`**
|
|
76
|
+
|
|
77
|
+
### Firebase Function
|
|
78
|
+
|
|
79
|
+
**`nx deploy my-new-firebase-function`**
|
|
80
|
+
|
|
81
|
+
- Deploys only a specific Firebase function
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Test
|
|
86
|
+
|
|
87
|
+
**`nx test my-new-firebase-app`**
|
|
88
|
+
|
|
89
|
+
- Runs unit tests for all Firebase functions apps linked to the Firebase application
|
|
90
|
+
|
|
91
|
+
**`nx test my-new-firebase-function`**
|
|
92
|
+
|
|
93
|
+
- Runs unit tests for an individual function
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## Lint
|
|
97
|
+
|
|
98
|
+
**`nx lint my-new-firebase-app`**
|
|
99
|
+
|
|
100
|
+
- Runs linter for all Firebase functions apps linked to the Firebase application or an individual function
|
|
101
|
+
|
|
102
|
+
**`nx lint my-new-firebase-function`**
|
|
103
|
+
|
|
104
|
+
- Runs linter for an individual function
|
|
8
105
|
|
|
9
|
-
|
|
106
|
+
## Sync Workspace
|
|
10
107
|
|
|
11
|
-
|
|
108
|
+
**`nx g @simondotm/nx-firebase:sync`**
|
|
12
109
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* Generates Firebase function apps based on Typescript Nx node applications
|
|
17
|
-
* Bundling of Firebase functions using `esbuild` for extremely fast compilation & tree-shaking for optimal function cold starts
|
|
18
|
-
* Easily import Typescript Nx libraries from your Nx workspace into your Firebase functions for code sharing across projects
|
|
19
|
-
* Supports function environment variables and secrets
|
|
20
|
-
* **Firebase Features**
|
|
21
|
-
* Use the Firebase Emulator suite whilst developing locally - all functions are watched and updated live while you work
|
|
22
|
-
* Use Firebase hosting with Nx to easily build & deploy web apps
|
|
23
|
-
* **Workspace Management**
|
|
24
|
-
* Nx's automatic dependency checking for no-fuss builds, and per-project or per-function deployments
|
|
25
|
-
* Supports single or multiple firebase projects/apps within an Nx workspace
|
|
26
|
-
* Nx workspace management with the `sync` generator keeps your project & `firebase.json` configs automatically updated when renaming or deleting Firebase apps & functions
|
|
27
|
-
* Only very lightly opinionated about your Firebase configurations and workspace layouts; you can use Nx or the Firebase CLI
|
|
110
|
+
- Ensures that your `firebase.json` configurations are kept up to date with your workspace
|
|
111
|
+
- If you rename or move firebase application or firebase function projects
|
|
112
|
+
- If you delete firebase function projects
|
|
28
113
|
|
|
29
114
|
## Further Information
|
|
30
115
|
|
|
31
|
-
See the full plugin [
|
|
116
|
+
See the full plugin [User Guide](https://github.com/simondotm/nx-firebase/blob/main/docs/user-guide.md) for more details.
|
package/executors.json
CHANGED
package/generators.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simondotm/nx-firebase",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.3.1",
|
|
4
4
|
"description": "A Firebase plugin for Nx monorepo workspaces.",
|
|
5
5
|
"author": "Simon Morris",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"Nx",
|
|
18
18
|
"Monorepo"
|
|
19
19
|
],
|
|
20
|
-
"main": "src/index.js",
|
|
20
|
+
"main": "./src/index.js",
|
|
21
21
|
"generators": "./generators.json",
|
|
22
22
|
"executors": "./executors.json",
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@nx/devkit": ">=
|
|
25
|
-
"@nx/workspace": ">=
|
|
26
|
-
"nx": ">=
|
|
24
|
+
"@nx/devkit": ">= 17.3.1",
|
|
25
|
+
"@nx/workspace": ">= 17.3.1",
|
|
26
|
+
"nx": ">= 17.3.1"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {},
|
|
29
|
-
"
|
|
30
|
-
}
|
|
29
|
+
"type": "commonjs"
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const packageVersions: {
|
|
2
|
+
nx: string;
|
|
3
|
+
firebase: string;
|
|
4
|
+
firebaseAdmin: string;
|
|
5
|
+
firebaseFunctions: string;
|
|
6
|
+
firebaseFunctionsTest: string;
|
|
7
|
+
firebaseTools: string;
|
|
8
|
+
killPort: string;
|
|
9
|
+
nodeEngine: string;
|
|
10
|
+
googleCloudFunctionsFramework: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.packageVersions = void 0;
|
|
4
|
+
//------------------------------------------------------------------------------
|
|
5
|
+
// This file is automatically generated by tools/generate-package-versions.js
|
|
6
|
+
// Do not edit this file manually
|
|
7
|
+
//------------------------------------------------------------------------------
|
|
8
|
+
exports.packageVersions = {
|
|
9
|
+
nx: '17.3.1',
|
|
10
|
+
firebase: '10.10.0',
|
|
11
|
+
firebaseAdmin: '11.11.1',
|
|
12
|
+
firebaseFunctions: '4.8.2',
|
|
13
|
+
firebaseFunctionsTest: '3.1.1',
|
|
14
|
+
firebaseTools: '12.9.1',
|
|
15
|
+
killPort: '2.0.1',
|
|
16
|
+
nodeEngine: '18',
|
|
17
|
+
googleCloudFunctionsFramework: '3.3.0',
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=nx-firebase-versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nx-firebase-versions.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/__generated__/nx-firebase-versions.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,6EAA6E;AAC7E,iCAAiC;AACjC,gFAAgF;AACnE,QAAA,eAAe,GAAG;IAC7B,EAAE,EAAE,QAAQ;IACZ,QAAQ,EAAE,SAAS;IACnB,aAAa,EAAE,SAAS;IACxB,iBAAiB,EAAE,OAAO;IAC1B,qBAAqB,EAAE,OAAO;IAC9B,aAAa,EAAE,QAAQ;IACvB,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,IAAI;IAChB,6BAA6B,EAAE,OAAO;CACvC,CAAA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function normalizeOptions(
|
|
2
|
+
import type { Schema, NormalizedSchema } from './schema';
|
|
3
|
+
export declare function normalizeOptions(host: Tree, options: Schema, callingGenerator?: string): Promise<NormalizedSchema>;
|
|
4
4
|
/**
|
|
5
5
|
* Firebase application generator
|
|
6
6
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
7
|
+
* @param host
|
|
8
|
+
* @param schema
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
|
11
|
-
export declare function applicationGenerator(
|
|
11
|
+
export declare function applicationGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
12
12
|
export default applicationGenerator;
|
|
13
|
-
export declare const applicationSchematic: (generatorOptions:
|
|
13
|
+
export declare const applicationSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -4,53 +4,82 @@ exports.applicationSchematic = exports.applicationGenerator = exports.normalizeO
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const lib_1 = require("./lib");
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
7
|
const init_1 = require("../init/init");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
8
|
+
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
9
|
+
function normalizeOptions(host, options, callingGenerator = '@simondotm/nx-firebase:application') {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
const { projectName: appProjectName, projectRoot, projectNameAndRootFormat, } = yield (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
12
|
+
name: options.name,
|
|
13
|
+
projectType: 'application',
|
|
14
|
+
directory: options.directory,
|
|
15
|
+
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
16
|
+
rootProject: options.rootProject,
|
|
17
|
+
callingGenerator,
|
|
18
|
+
});
|
|
19
|
+
options.rootProject = projectRoot === '.';
|
|
20
|
+
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
21
|
+
const parsedTags = options.tags
|
|
22
|
+
? options.tags.split(',').map((s) => s.trim())
|
|
23
|
+
: [];
|
|
24
|
+
// const { projectName, projectRoot } = getProjectName(
|
|
25
|
+
// host,
|
|
26
|
+
// options.name,
|
|
27
|
+
// options.directory,
|
|
28
|
+
// )
|
|
29
|
+
/**
|
|
30
|
+
* Plugin filename naming convention for firebase.json config is:
|
|
31
|
+
* firebase config will be `firebase.json` for the first firebase app
|
|
32
|
+
* additional apps will use `firebase.<projectname>.json`
|
|
33
|
+
* this makes the config filename deterministic for the plugin
|
|
34
|
+
*
|
|
35
|
+
* - plugin can try `firebase.<projectname>.json` and use if exists
|
|
36
|
+
* - otherwise fallback is `firebase.json`
|
|
37
|
+
*/
|
|
38
|
+
const firebaseConfigName = host.exists('firebase.json')
|
|
39
|
+
? `firebase.${appProjectName}.json`
|
|
40
|
+
: 'firebase.json';
|
|
41
|
+
// firebase config name has to be unique.
|
|
42
|
+
if (host.exists(firebaseConfigName)) {
|
|
43
|
+
throw Error(`There is already a firebase configuration called '${firebaseConfigName}' in this workspace. Please use a different project name.`);
|
|
44
|
+
}
|
|
45
|
+
return Object.assign(Object.assign({}, options), { name: (0, devkit_1.names)(options.name).fileName, projectName: appProjectName, projectRoot,
|
|
46
|
+
parsedTags,
|
|
47
|
+
firebaseConfigName });
|
|
48
|
+
// return {
|
|
49
|
+
// ...options,
|
|
50
|
+
// projectRoot,
|
|
51
|
+
// projectName,
|
|
52
|
+
// firebaseConfigName,
|
|
53
|
+
// }
|
|
54
|
+
});
|
|
30
55
|
}
|
|
31
56
|
exports.normalizeOptions = normalizeOptions;
|
|
32
57
|
/**
|
|
33
58
|
* Firebase application generator
|
|
34
59
|
*
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
60
|
+
* @param host
|
|
61
|
+
* @param schema
|
|
37
62
|
* @returns
|
|
38
63
|
*/
|
|
39
|
-
function applicationGenerator(
|
|
64
|
+
function applicationGenerator(host, schema) {
|
|
40
65
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const options = normalizeOptions(
|
|
42
|
-
const initTask = yield (0, init_1.default)(
|
|
66
|
+
const options = yield normalizeOptions(host, Object.assign({ projectNameAndRootFormat: 'derived' }, schema));
|
|
67
|
+
const initTask = yield (0, init_1.default)(host, {});
|
|
43
68
|
const firebaseCliProject = options.project
|
|
44
69
|
? ` --project=${options.project}`
|
|
45
70
|
: '';
|
|
46
|
-
const tags = [
|
|
47
|
-
|
|
48
|
-
options.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
(
|
|
71
|
+
const tags = [
|
|
72
|
+
`firebase:app`,
|
|
73
|
+
`firebase:name:${options.projectName}`,
|
|
74
|
+
...options.parsedTags,
|
|
75
|
+
];
|
|
76
|
+
// if (options.tags) {
|
|
77
|
+
// options.tags.split(',').map((s) => {
|
|
78
|
+
// s.trim()
|
|
79
|
+
// tags.push(s)
|
|
80
|
+
// })
|
|
81
|
+
// }
|
|
82
|
+
(0, devkit_1.addProjectConfiguration)(host, options.projectName, {
|
|
54
83
|
root: options.projectRoot,
|
|
55
84
|
projectType: 'application',
|
|
56
85
|
targets: {
|
|
@@ -130,7 +159,7 @@ function applicationGenerator(tree, rawOptions) {
|
|
|
130
159
|
},
|
|
131
160
|
tags,
|
|
132
161
|
});
|
|
133
|
-
(0, lib_1.createFiles)(
|
|
162
|
+
(0, lib_1.createFiles)(host, options);
|
|
134
163
|
return (0, devkit_1.runTasksInSerial)(initTask);
|
|
135
164
|
});
|
|
136
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/nx-firebase/src/generators/application/application.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/nx-firebase/src/generators/application/application.ts"],"names":[],"mappings":";;;;AAAA,uCAOmB;AAEnB,+BAAmC;AAInC,uCAAwC;AACxC,uGAA0G;AAE1G,SAAsB,gBAAgB,CACpC,IAAU,EACV,OAAe,EACf,gBAAgB,GAAG,oCAAoC;;QAEvD,MAAM,EACJ,WAAW,EAAE,cAAc,EAC3B,WAAW,EACX,wBAAwB,GACzB,GAAG,MAAM,IAAA,gEAAkC,EAAC,IAAI,EAAE;YACjD,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,aAAa;YAC1B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;YAC1D,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,gBAAgB;SACjB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",
|
|
7
|
+
// "queryScope": "COLLECTION",
|
|
8
|
+
// "fields": [
|
|
9
|
+
// { "fieldPath": "foo", "arrayConfig": "CONTAINS" },
|
|
10
|
+
// { "fieldPath": "bar", "mode": "DESCENDING" }
|
|
11
|
+
// ]
|
|
12
|
+
// },
|
|
13
|
+
//
|
|
14
|
+
// "fieldOverrides": [
|
|
15
|
+
// {
|
|
16
|
+
// "collectionGroup": "widgets",
|
|
17
|
+
// "fieldPath": "baz",
|
|
18
|
+
// "indexes": [
|
|
19
|
+
// { "order": "ASCENDING", "queryScope": "COLLECTION" }
|
|
20
|
+
// ]
|
|
21
|
+
// },
|
|
22
|
+
// ]
|
|
23
|
+
// ]
|
|
24
|
+
"indexes": [],
|
|
25
|
+
"fieldOverrides": []
|
|
26
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
rules_version = '2';
|
|
2
|
-
// These default Firestore rules were generated by Nx-Firebase plugin
|
|
3
|
-
// Change them to suit your own requirements.
|
|
4
|
-
|
|
5
|
-
// Allow read/write access on all documents to any user signed in to the application
|
|
6
1
|
service cloud.firestore {
|
|
7
2
|
match /databases/{database}/documents {
|
|
8
3
|
match /{document=**} {
|
|
9
|
-
|
|
4
|
+
// This rule allows anyone with your database reference to view, edit,
|
|
5
|
+
// and delete all data in your database. It is useful for getting
|
|
6
|
+
// started, but it is configured to expire after 30 days because it
|
|
7
|
+
// leaves your app open to attackers. At that time, all client
|
|
8
|
+
// requests to your database will be denied.
|
|
9
|
+
//
|
|
10
|
+
// Make sure to write security rules for your app before that time, or
|
|
11
|
+
// else all client requests to your database will be denied until you
|
|
12
|
+
// update your rules.
|
|
13
|
+
allow read, write: if request.time < timestamp.date(<%= IN_30_DAYS %>);
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Page Not Found</title>
|
|
7
|
+
|
|
8
|
+
<style media="screen">
|
|
9
|
+
body { background: #ECEFF1; color: rgba(0,0,0,0.87); font-family: Roboto, Helvetica, Arial, sans-serif; margin: 0; padding: 0; }
|
|
10
|
+
#message { background: white; max-width: 360px; margin: 100px auto 16px; padding: 32px 24px 16px; border-radius: 3px; }
|
|
11
|
+
#message h3 { color: #888; font-weight: normal; font-size: 16px; margin: 16px 0 12px; }
|
|
12
|
+
#message h2 { color: #ffa100; font-weight: bold; font-size: 16px; margin: 0 0 8px; }
|
|
13
|
+
#message h1 { font-size: 22px; font-weight: 300; color: rgba(0,0,0,0.6); margin: 0 0 16px;}
|
|
14
|
+
#message p { line-height: 140%; margin: 16px 0 24px; font-size: 14px; }
|
|
15
|
+
#message a { display: block; text-align: center; background: #039be5; text-transform: uppercase; text-decoration: none; color: white; padding: 16px; border-radius: 4px; }
|
|
16
|
+
#message, #message a { box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); }
|
|
17
|
+
#load { color: rgba(0,0,0,0.4); text-align: center; font-size: 13px; }
|
|
18
|
+
@media (max-width: 600px) {
|
|
19
|
+
body, #message { margin-top: 0; background: white; box-shadow: none; }
|
|
20
|
+
body { border-top: 16px solid #ffa100; }
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<div id="message">
|
|
26
|
+
<h2>404</h2>
|
|
27
|
+
<h1>Page Not Found</h1>
|
|
28
|
+
<p>The specified file was not found on this website. Please check the URL for mistakes and try again.</p>
|
|
29
|
+
<h3>Why am I seeing this?</h3>
|
|
30
|
+
<p>This page was generated by the Firebase Command-Line Interface. To modify it, edit the <code>404.html</code> file in your project's configured <code>public</code> directory.</p>
|
|
31
|
+
</div>
|
|
32
|
+
</body>
|
|
33
|
+
</html>
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
<title>Welcome to Firebase Hosting</title>
|
|
7
7
|
|
|
8
8
|
<!-- update the version number as needed -->
|
|
9
|
-
<script defer src="/__/firebase/
|
|
9
|
+
<script defer src="/__/firebase/10.10.0/firebase-app-compat.js"></script>
|
|
10
10
|
<!-- include only the Firebase features as you need -->
|
|
11
|
-
<script defer src="/__/firebase/
|
|
12
|
-
<script defer src="/__/firebase/
|
|
13
|
-
<script defer src="/__/firebase/
|
|
14
|
-
<script defer src="/__/firebase/
|
|
15
|
-
<script defer src="/__/firebase/
|
|
16
|
-
<script defer src="/__/firebase/
|
|
17
|
-
<script defer src="/__/firebase/
|
|
18
|
-
<script defer src="/__/firebase/
|
|
19
|
-
<script defer src="/__/firebase/
|
|
11
|
+
<script defer src="/__/firebase/10.10.0/firebase-auth-compat.js"></script>
|
|
12
|
+
<script defer src="/__/firebase/10.10.0/firebase-database-compat.js"></script>
|
|
13
|
+
<script defer src="/__/firebase/10.10.0/firebase-firestore-compat.js"></script>
|
|
14
|
+
<script defer src="/__/firebase/10.10.0/firebase-functions-compat.js"></script>
|
|
15
|
+
<script defer src="/__/firebase/10.10.0/firebase-messaging-compat.js"></script>
|
|
16
|
+
<script defer src="/__/firebase/10.10.0/firebase-storage-compat.js"></script>
|
|
17
|
+
<script defer src="/__/firebase/10.10.0/firebase-analytics-compat.js"></script>
|
|
18
|
+
<script defer src="/__/firebase/10.10.0/firebase-remote-config-compat.js"></script>
|
|
19
|
+
<script defer src="/__/firebase/10.10.0/firebase-performance-compat.js"></script>
|
|
20
20
|
<!--
|
|
21
21
|
initialize the SDK after all desired features are loaded, set useEmulator to false
|
|
22
22
|
to avoid connecting the SDK to running emulators.
|
|
@@ -86,4 +86,4 @@
|
|
|
86
86
|
});
|
|
87
87
|
</script>
|
|
88
88
|
</body>
|
|
89
|
-
</html>
|
|
89
|
+
</html>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
// replace this file with your own firebase storage rules
|
|
2
1
|
rules_version = '2';
|
|
2
|
+
|
|
3
|
+
// Craft rules based on data in your Firestore database
|
|
4
|
+
// allow write: if firestore.get(
|
|
5
|
+
// /databases/(default)/documents/users/$(request.auth.uid)).data.isAdmin;
|
|
3
6
|
service firebase.storage {
|
|
4
7
|
match /b/{bucket}/o {
|
|
5
8
|
match /{allPaths=**} {
|
|
6
|
-
allow read, write: if
|
|
9
|
+
allow read, write: if false;
|
|
7
10
|
}
|
|
8
11
|
}
|
|
9
|
-
}
|
|
12
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
-
import type {
|
|
2
|
+
import type { NormalizedSchema } from '../schema';
|
|
3
3
|
/**
|
|
4
4
|
* Generate the firebase app specific files
|
|
5
5
|
*
|
|
6
6
|
* @param tree
|
|
7
7
|
* @param options
|
|
8
8
|
*/
|
|
9
|
-
export declare function createFiles(tree: Tree, options:
|
|
9
|
+
export declare function createFiles(tree: Tree, options: NormalizedSchema): void;
|
|
@@ -10,11 +10,22 @@ const devkit_1 = require("@nx/devkit");
|
|
|
10
10
|
*/
|
|
11
11
|
function createFiles(tree, options) {
|
|
12
12
|
const firebaseAppConfig = options.firebaseConfigName;
|
|
13
|
+
// Firebase SDK firestore.rules template has a placeholder for the date 30 days from now
|
|
14
|
+
// so we add that substitution here at the point of app generation
|
|
15
|
+
const date = new Date();
|
|
16
|
+
date.setDate(date.getDate() + 30);
|
|
17
|
+
const dateString = date
|
|
18
|
+
.toISOString()
|
|
19
|
+
.split('T')[0]
|
|
20
|
+
.split('-')
|
|
21
|
+
.map((v) => parseInt(v).toString())
|
|
22
|
+
.join(', ');
|
|
13
23
|
const substitutions = {
|
|
14
24
|
tmpl: '',
|
|
15
25
|
projectName: options.projectName,
|
|
16
26
|
projectRoot: options.projectRoot,
|
|
17
27
|
firebaseAppConfig,
|
|
28
|
+
IN_30_DAYS: dateString,
|
|
18
29
|
};
|
|
19
30
|
// The default functions package.json & templated typescript source files are added here
|
|
20
31
|
// to match the `firebase init` cli setup
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-files.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/application/lib/create-files.ts"],"names":[],"mappings":";;;AAAA,uCAAmE;AAInE;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,IAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"create-files.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/application/lib/create-files.ts"],"names":[],"mappings":";;;AAAA,uCAAmE;AAInE;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,IAAU,EAAE,OAAyB;IAC/D,MAAM,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAA;IAEpD,wFAAwF;IACxF,kEAAkE;IAClE,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;IACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAA;IACjC,MAAM,UAAU,GAAG,IAAI;SACpB,WAAW,EAAE;SACb,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACb,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;SAClC,IAAI,CAAC,IAAI,CAAC,CAAA;IAEb,MAAM,aAAa,GAAG;QACpB,IAAI,EAAE,EAAE;QACR,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,iBAAiB;QACjB,UAAU,EAAE,UAAU;KACvB,CAAA;IAED,wFAAwF;IACxF,yCAAyC;IACzC,uGAAuG;IACvG,EAAE;IACF,sEAAsE;IACtE,qDAAqD;IACrD,wFAAwF;IACxF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,EAC3C,OAAO,CAAC,WAAW,EACnB,aAAa,CACd,CAAA;IAED,mGAAmG;IACnG,+HAA+H;IAC/H,IAAI,iBAAiB,KAAK,eAAe,EAAE;QACzC,wCAAwC;QACxC,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,IAAI,EAAE,gBAAgB,CAAC,EACpD,EAAE,EACF,aAAa,CACd,CAAA;KACF;SAAM;QACL,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,IAAI,EAAE,iBAAiB,CAAC,EACrD,EAAE,EAAE,kDAAkD;QACtD,aAAa,CACd,CAAA;KACF;IAED,kGAAkG;IAClG,sDAAsD;IACtD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;QAC/B,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,IAAI,EAAE,kBAAkB,CAAC,EACtD,EAAE,EACF,aAAa,CACd,CAAA;KACF;IACD,SAAS;IACT,iEAAiE;IACjE,IAAI;AACN,CAAC;AApED,kCAoEC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'
|
|
2
|
+
|
|
3
|
+
export interface Schema {
|
|
4
|
+
// standard @nx project generator options
|
|
3
5
|
name: string
|
|
4
6
|
directory?: string
|
|
5
7
|
tags?: string
|
|
8
|
+
projectNameAndRootFormat?: ProjectNameAndRootFormat
|
|
9
|
+
rootProject?: boolean
|
|
6
10
|
// extra options for @simondotm/nx-firebase:app generator
|
|
7
11
|
project?: string
|
|
8
12
|
// firebaseProject?: string
|
|
9
13
|
// firebaseConfig?: string
|
|
10
14
|
}
|
|
11
15
|
|
|
12
|
-
export interface
|
|
13
|
-
projectRoot: Path
|
|
16
|
+
export interface NormalizedSchema extends Schema {
|
|
14
17
|
projectName: string
|
|
18
|
+
projectRoot: string
|
|
19
|
+
parsedTags: string[]
|
|
15
20
|
firebaseConfigName: string
|
|
16
21
|
}
|