Skip to content

Commit

Permalink
refactor: moved demo from packages to apps folder
Browse files Browse the repository at this point in the history
  • Loading branch information
dereekb committed Mar 24, 2022
1 parent 9eedf1f commit b4d4b6b
Show file tree
Hide file tree
Showing 210 changed files with 48 additions and 48 deletions.
16 changes: 8 additions & 8 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ Create an angular project using ng generate.

Example: `nx generate @nrwl/angular:app --name=demo`

The angular project is now setup properly. When built, its output will go to the `dist/packages/demo` folder.
The angular project is now setup properly. When built, its output will go to the `dist/apps/demo` folder.

### Configuring Firebase.json
We just need to update the folder firebase pulls from to instead pull from the webapp's dist folder. Update `firebase.json` by changing the `hosting` section's `public` value to be `dist/packages/demo`.
We just need to update the folder firebase pulls from to instead pull from the webapp's dist folder. Update `firebase.json` by changing the `hosting` section's `public` value to be `dist/apps/demo`.

It should look like this:

```
"hosting": {
"public": "dist/packages/demo",
"public": "dist/apps/demo",
"ignore": [
"firebase.json",
"**/.*",
Expand All @@ -70,7 +70,7 @@ Find `targets` in your `project.json`, and add the following targets:
}
```

This will deploy whatever content is configured for `public` in `firebase.json`, which we configured above to be `dist/packages/demo`.
This will deploy whatever content is configured for `public` in `firebase.json`, which we configured above to be `dist/apps/demo`.

Add the section below to add an action that calls build before calling deploy.

Expand Down Expand Up @@ -103,7 +103,7 @@ Create a NestJS project using the following:
Example: `nx generate @nrwl/nest:application demo-api`

### Setting Up NestJS for Firebase Functions Using onRequest()
Copy the contents of `packages/demo-api/src/main.ts`. This will instruct your app to direct all https requests to
Copy the contents of `apps/demo-api/src/main.ts`. This will instruct your app to direct all https requests to

More details here:
https://firebase.google.com/docs/functions/http-events
Expand Down Expand Up @@ -137,13 +137,13 @@ https://stackoverflow.com/questions/53307541/firebase-handle-cloud-events-within


### Configuring Firebase.json
We just need to update the folder firebase pulls from to instead pull from the webapp's dist folder. Update `firebase.json` by changing the `functions` section's `source` value to be `dist/packages/demo-api`. Also add `runtime` and set it to `nodejs16`.
We just need to update the folder firebase pulls from to instead pull from the webapp's dist folder. Update `firebase.json` by changing the `functions` section's `source` value to be `dist/apps/demo-api`. Also add `runtime` and set it to `nodejs16`.

It should look like this:

```
"functions": {
"source": "dist/packages/demo-api",
"source": "dist/apps/demo-api",
"runtime": "nodejs16",
"ignore": [
"firebase.json",
Expand All @@ -170,7 +170,7 @@ The first time the container runs, the firebase emulator function will download

Behind the scenes, `nx serve demo-api` runs two commands in parallel:
- Watching the demo-api folder for buildings.
- Running emulators. The functions emulator watches and pulls from the `dist/packages/demo-api` folder.
- Running emulators. The functions emulator watches and pulls from the `dist/apps/demo-api` folder.

Any changes made to the `demo-api` package will trigger. VS Code to build the project and update our dist, causing the functions emulator to update. This lets us develop in real time with an active emulated database.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ module.exports = {
'^.+\\.[tj]s$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/demo-api',
coverageDirectory: '../../coverage/apps/demo-api',
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/demo-e2e/cypress.json → apps/demo-e2e/cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"supportFile": "./src/support/index.ts",
"pluginsFile": false,
"video": true,
"videosFolder": "../../dist/cypress/packages/demo-e2e/videos",
"screenshotsFolder": "../../dist/cypress/packages/demo-e2e/screenshots",
"videosFolder": "../../dist/cypress/apps/demo-e2e/videos",
"screenshotsFolder": "../../dist/cypress/apps/demo-e2e/screenshots",
"chromeWebSecurity": false
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/demo/jest.config.js → apps/demo/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
coverageDirectory: '../../coverage/packages/demo',
coverageDirectory: '../../coverage/apps/demo',
transform: {
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClickableAnchor, ClickableAnchorLink, ClickableIconAnchorLink } from './../../../../../../dbx-core/src/lib/router/anchor/anchor';
import { ClickableAnchor, ClickableAnchorLink, ClickableIconAnchorLink } from '@dereekb/dbx-core';
import { Component } from '@angular/core';
import packageInfo from '../../../../../../../package.json';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"hosting": {
"public": "dist/packages/demo",
"public": "dist/apps/demo",
"ignore": [
"firebase.json",
"**/.*",
Expand All @@ -19,7 +19,7 @@
}]
},
"functions": {
"source": "dist/packages/demo-api",
"source": "dist/apps/demo-api",
"runtime": "nodejs16",
"ignore": [
"firebase.json",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

Since Nx executes this project from the root folder, our paths extend from the root folder.
*/
"@/shared/*": ["packages/demo/src/app/modules/shared/*"]
"@/shared/*": ["apps/demo/src/app/modules/shared/*"]
}
},
"exclude": ["node_modules", "tmp"]
Expand Down
64 changes: 32 additions & 32 deletions workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@
},
"demo": {
"projectType": "application",
"root": "packages/demo",
"sourceRoot": "packages/demo/src",
"root": "apps/demo",
"sourceRoot": "apps/demo/src",
"prefix": "app",
"targets": {
"build": {
Expand All @@ -476,16 +476,16 @@
"projects": "dependencies"
}],
"options": {
"outputPath": "dist/packages/demo",
"index": "packages/demo/src/index.html",
"main": "packages/demo/src/main.ts",
"polyfills": "packages/demo/src/polyfills.ts",
"tsConfig": "packages/demo/tsconfig.app.json",
"outputPath": "dist/apps/demo",
"index": "apps/demo/src/index.html",
"main": "apps/demo/src/main.ts",
"polyfills": "apps/demo/src/polyfills.ts",
"tsConfig": "apps/demo/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"packages/demo/src/favicon.ico",
"packages/demo/src/assets",
"packages/demo/src/lib"
"apps/demo/src/favicon.ico",
"apps/demo/src/assets",
"apps/demo/src/lib"
],
"allowedCommonJsDependencies": [
"validator",
Expand All @@ -497,7 +497,7 @@
]
},
"styles": [
"packages/demo/src/styles.scss"
"apps/demo/src/styles.scss"
],
"scripts": []
},
Expand All @@ -515,8 +515,8 @@
}
],
"fileReplacements": [{
"replace": "packages/demo/src/environments/environment.ts",
"with": "packages/demo/src/environments/environment.prod.ts"
"replace": "apps/demo/src/environments/environment.ts",
"with": "apps/demo/src/environments/environment.prod.ts"
}],
"outputHashing": "all"
},
Expand Down Expand Up @@ -555,16 +555,16 @@
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"packages/demo/src/**/*.ts",
"packages/demo/src/**/*.html"
"apps/demo/src/**/*.ts",
"apps/demo/src/**/*.html"
]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/packages/demo", "./.reports/jest/demo.junit.xml"],
"outputs": ["coverage/apps/demo", "./.reports/jest/demo.junit.xml"],
"options": {
"jestConfig": "packages/demo/jest.config.js",
"jestConfig": "apps/demo/jest.config.js",
"passWithNoTests": true
}
},
Expand Down Expand Up @@ -592,8 +592,8 @@
"tags": []
},
"demo-api": {
"root": "packages/demo-api",
"sourceRoot": "packages/demo-api/src",
"root": "apps/demo-api",
"sourceRoot": "apps/demo-api/src",
"projectType": "application",
"targets": {
"build": {
Expand All @@ -611,10 +611,10 @@
"projects": "dependencies"
}],
"options": {
"outputPath": "dist/packages/demo-api",
"main": "packages/demo-api/src/main.ts",
"tsConfig": "packages/demo-api/tsconfig.app.json",
"assets": ["packages/demo-api/src/assets"],
"outputPath": "dist/apps/demo-api",
"main": "apps/demo-api/src/main.ts",
"tsConfig": "apps/demo-api/tsconfig.app.json",
"assets": ["apps/demo-api/src/assets"],
"generatePackageJson": true
},
"configurations": {
Expand All @@ -623,8 +623,8 @@
"extractLicenses": true,
"inspect": false,
"fileReplacements": [{
"replace": "packages/demo-api/src/environments/environment.ts",
"with": "packages/demo-api/src/environments/environment.prod.ts"
"replace": "apps/demo-api/src/environments/environment.ts",
"with": "apps/demo-api/src/environments/environment.prod.ts"
}]
}
}
Expand Down Expand Up @@ -658,14 +658,14 @@
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/demo-api/**/*.ts"]
"lintFilePatterns": ["apps/demo-api/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/packages/demo-api", "./.reports/jest/demo-api.junit.xml"],
"outputs": ["coverage/apps/demo-api", "./.reports/jest/demo-api.junit.xml"],
"options": {
"jestConfig": "packages/demo-api/jest.config.js",
"jestConfig": "apps/demo-api/jest.config.js",
"passWithNoTests": true
}
},
Expand Down Expand Up @@ -693,14 +693,14 @@
"tags": []
},
"demo-e2e": {
"root": "packages/demo-e2e",
"sourceRoot": "packages/demo-e2e/src",
"root": "apps/demo-e2e",
"sourceRoot": "apps/demo-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "packages/demo-e2e/cypress.json",
"cypressConfig": "apps/demo-e2e/cypress.json",
"devServerTarget": "demo:serve:development"
},
"configurations": {
Expand All @@ -713,7 +713,7 @@
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/demo-e2e/**/*.{js,ts}"]
"lintFilePatterns": ["apps/demo-e2e/**/*.{js,ts}"]
}
}
},
Expand Down

0 comments on commit b4d4b6b

Please sign in to comment.