diff --git a/.prettierrc b/.prettierrc
index 544138be..299b9e14 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -1,3 +1,5 @@
{
- "singleQuote": true
+ "singleQuote": true,
+ "semi": false,
+ "trailingComma": "none"
}
diff --git a/README.md b/README.md
index 8957ed09..7c0c29c9 100644
--- a/README.md
+++ b/README.md
@@ -1,58 +1,30 @@
-# Nx-extend
+# NX-extend
-
-
-🔎 **Nx-extend is a set of Extensible Dev Tools for Monorepos.**
+🔎 **NX-extend is a set of tools to help your NX project.**
## Nx-extend adds the following capabilities to your workspace
-- [GCP Cloud Run](https://cloud.google.com/)
+- [GCP Cloud Run](./packages/gcp-cloud-run/README.md)
- `npm install --save-dev @nx-extend/gcp-cloud-run`
-- [GCP Deployment Manager](https://cloud.google.com/)
+- [GCP Deployment Manager](./packages/gcp-deployment-manager/README.md)
- `npm install --save-dev @nx-extend/gcp-deployment-manager`
-- [GCP Functions](https://cloud.google.com/)
+- [GCP Functions](./packages/gcp-functions/README.md)
- `npm install --save-dev @nx-extend/gcp-functions`
-- [GCP Secrets](https://cloud.google.com/)
+- [GCP Secrets](./packages/gcp-secrets/README.md)
- `npm install --save-dev @nx-extend/gcp-secrets`
-- [GCP Storage](https://cloud.google.com/)
+- [GCP Storage](./packages/gcp-storage/README.md)
- `npm install --save-dev @nx-extend/gcp-storage`
-- [Firebase Hosting](https://firebase.google.com/products/hosting)
+- [Firebase Hosting](./packages/firebase-hosting/README.md)
- `npm install --save-dev @nx-extend/firebase-hosting`
-- [Translations](#)
+- [Translations](./packages/translations/README.md)
- `npm install --save-dev @nx-extend/translations`
+- [Strapi](./packages/strapi/README.md)
+ - `npm install --save-dev @nx-extend/strapi`
+## [License](./LICENSE)
-## GCP Cloud Run
-> TODO
-
-Build and deploy your application to Cloud Run.
-
-## GCP Deployment Manager
-> TODO
-
-Manage your Google Cloud resources create, update and delete them.
-
-## GCP Functions
-> TODO
-
-Build and deploy Google Cloud Functions, includes a runner generator to run http / pub-sub functions locally.
-
-## GCP Secrets
-> TODO
-
-Manage your Google Cloud secrets through easy to use JSON files, you can encrypt, decrypt and deploy secrets.
-
-## GCP Storage
-> TODO
-
-Upload your app / files to Google Cloud Storage
-
-## Firebase Hosting
-> TODO
-
-Upload your app to Firebase Hosting.
+Conventional Changelog Action is [MIT licensed](./LICENSE).
-## Translations
-> TODO
+## Collaboration
-Translate your apps, extracts translations and uploads them (Transifex and Traduora supported).
+If you have questions or [issues](https://github.com/TriPSs/nx-extend/issues), please [open an issue](https://github.com/TriPSs/nx-extend/issues/new)!
diff --git a/packages/firebase-hosting/README.md b/packages/firebase-hosting/README.md
index bfeb9274..eb74806a 100644
--- a/packages/firebase-hosting/README.md
+++ b/packages/firebase-hosting/README.md
@@ -1,3 +1,60 @@
-# NX - Firebase Hosting
+# @nx-extend/firebase-hosting
-Upload your project to Firebase Hosting
+
+
+
+
+**Nx plugin for deploy your app to [Firebase Hosting](https://firebase.google.com/products/hosting)**.
+
+## Setup
+
+### Install
+
+```sh
+npm install -D @nx-extend/firebase-hosting
+nx g @nx-extend/firebase-hosting:add
+```
+
+This will add the following to the target:
+
+```json
+{
+ ...other targets
+ "deploy": {
+ "executor": "@nx-extend/firebase-hosting:deploy",
+ "options": {
+ "site": ""
+ }
+ }
+}
+```
+
+And create a `.firebase.json` file if it does not exist already, if it exists it will
+add this target to the hosting section:
+
+```json
+{
+ ...other firebase config
+ "hosting": [
+ {
+ "target": "",
+ "public": "",
+ "ignore": [
+ "firebase.json",
+ "**/.*",
+ "**/node_modules/**"
+ ]
+ }
+ ]
+}
+```
+
+## Usage
+
+### Deploy
+
+#### Available options:
+
+| name | type | default | description |
+| ------------ | -------- | ------- | ---------------------------------------------------- |
+| **`--site`** | `string` | `null` | specify the site to deploy from the `.firebase.json` |
diff --git a/packages/firebase-hosting/src/executors/deploy/deploy.impl.ts b/packages/firebase-hosting/src/executors/deploy/deploy.impl.ts
index 77cbd7ff..2e258ad9 100644
--- a/packages/firebase-hosting/src/executors/deploy/deploy.impl.ts
+++ b/packages/firebase-hosting/src/executors/deploy/deploy.impl.ts
@@ -3,13 +3,14 @@ import { ExecutorSchema } from './schema'
export default async function runExecutor(options: ExecutorSchema) {
// Make sure the deployment target is defined
- await execCommand(buildCommand([
- 'npx firebase target:apply',
- `hosting ${options.site} ${options.site}`
- ]))
+ execCommand(
+ buildCommand([
+ 'npx firebase target:apply',
+ `hosting ${options.site} ${options.site}`
+ ])
+ )
- return execCommand(buildCommand([
- 'npx firebase deploy',
- `--only=hosting:${options.site}`
- ]))
+ execCommand(
+ buildCommand(['npx firebase deploy', `--only=hosting:${options.site}`])
+ )
}
diff --git a/packages/firebase-hosting/src/executors/deploy/schema.json b/packages/firebase-hosting/src/executors/deploy/schema.json
index 48a7bd81..4d4d6d2e 100644
--- a/packages/firebase-hosting/src/executors/deploy/schema.json
+++ b/packages/firebase-hosting/src/executors/deploy/schema.json
@@ -1,12 +1,11 @@
{
"$schema": "http://json-schema.org/schema",
"cli": "nx",
- "title": "Deploy executor",
- "description": "",
"type": "object",
"properties": {
"site": {
- "type": "string"
+ "type": "string",
+ "description": "Site name in Firebase Hosting"
}
}
}
diff --git a/packages/firebase-hosting/src/generators/add/add.impl.ts b/packages/firebase-hosting/src/generators/add/add.impl.ts
index 4a02fb6c..743bf87c 100644
--- a/packages/firebase-hosting/src/generators/add/add.impl.ts
+++ b/packages/firebase-hosting/src/generators/add/add.impl.ts
@@ -1,4 +1,10 @@
-import { readProjectConfiguration, updateProjectConfiguration, Tree } from '@nrwl/devkit'
+import {
+ readProjectConfiguration,
+ updateProjectConfiguration,
+ writeJsonFile,
+ readJsonFile,
+ Tree
+} from '@nrwl/devkit'
import { ProjectConfiguration } from '@nrwl/tao/src/shared/workspace'
import { FirebaseHostingGeneratorSchema } from './schema'
@@ -9,6 +15,12 @@ export default async function (
) {
const app = readProjectConfiguration(host, options.target)
+ if (!app) {
+ return {
+ success: false
+ }
+ }
+
addToFirebaseJson(host, app, options.site)
updateProjectConfiguration(host, options.target, {
@@ -25,23 +37,25 @@ export default async function (
})
}
-export function addToFirebaseJson(host: Tree, app: ProjectConfiguration, site: string) {
+export function addToFirebaseJson(
+ host: Tree,
+ app: ProjectConfiguration,
+ site: string
+) {
const firebaseJsonLocation = 'firebase.json'
let firebaseJson = {
- hosting: [{
- target: site,
- public: app?.targets?.build?.options?.outputPath || null,
- ignore: [
- 'firebase.json',
- '**/.*',
- '**/node_modules/**'
- ]
- }]
+ hosting: [
+ {
+ target: site,
+ public: app?.targets?.build?.options?.outputPath || null,
+ ignore: ['firebase.json', '**/.*', '**/node_modules/**']
+ }
+ ]
}
if (host.exists(firebaseJsonLocation)) {
- const existingFirebaseJson = JSON.parse(host.read(firebaseJsonLocation).toString('utf8'))
+ const existingFirebaseJson = readJsonFile(firebaseJsonLocation)
firebaseJson = {
...existingFirebaseJson,
@@ -54,7 +68,6 @@ export function addToFirebaseJson(host: Tree, app: ProjectConfiguration, site: s
...existingFirebaseJson.hosting,
...firebaseJson.hosting
]
-
} else {
firebaseJson.hosting = [
existingFirebaseJson.hosting,
@@ -64,8 +77,5 @@ export function addToFirebaseJson(host: Tree, app: ProjectConfiguration, site: s
}
}
- host.write(
- firebaseJsonLocation,
- Buffer.from(JSON.stringify(firebaseJson, null, 2))
- )
+ writeJsonFile(firebaseJsonLocation, firebaseJson)
}
diff --git a/packages/firebase-hosting/src/generators/add/schema.json b/packages/firebase-hosting/src/generators/add/schema.json
index 4549b60a..597e91ca 100644
--- a/packages/firebase-hosting/src/generators/add/schema.json
+++ b/packages/firebase-hosting/src/generators/add/schema.json
@@ -7,16 +7,16 @@
"properties": {
"target": {
"type": "string",
- "description": "",
+ "description": "Target to add Firebase Hosting to",
"$default": {
"$source": "argv",
"index": 0
},
- "x-prompt": "To what app would you like to add Firebase hosting?"
+ "x-prompt": "To what target would you like to add Firebase hosting?"
},
"site": {
"type": "string",
- "description": "",
+ "description": "Site name in Firebase Hosting",
"$default": {
"$source": "argv",
"index": 1
@@ -24,8 +24,5 @@
"x-prompt": "What is the Firebase site name?"
}
},
- "required": [
- "target",
- "site"
- ]
+ "required": ["target", "site"]
}