Skip to content

Commit

Permalink
#9 added google functions app
Browse files Browse the repository at this point in the history
  • Loading branch information
timofeysie committed Sep 11, 2021
1 parent c15ec5e commit 919fe24
Show file tree
Hide file tree
Showing 22 changed files with 10,619 additions and 5,495 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ nx serve trendy // trendy frontend
nx run trendy:server --configuration=production
nx run trendy:build:SSR
nx run trendy:serve:SSR
nx run trendy:server-ssr
nx run trendy:build:prerender --configuration=production
nx run trendy:server:prerender --configuration=production
nx run trendy:firebase --cmd deploy // deploy to firebase
Expand Down
18 changes: 18 additions & 0 deletions apps/functions/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
15 changes: 15 additions & 0 deletions apps/functions/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
displayName: 'functions',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/apps/functions',
};
Empty file added apps/functions/src/app/.gitkeep
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions apps/functions/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
production: true,
};
3 changes: 3 additions & 0 deletions apps/functions/src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
production: false,
};
4 changes: 4 additions & 0 deletions apps/functions/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as functions from 'firebase-functions';
const universal = require(`${process.cwd()}/dist/apps/trendy/browser`).app();

export const ssr = functions.https.onRequest(universal);
10 changes: 10 additions & 0 deletions apps/functions/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["node"]
},
"exclude": ["**/*.spec.ts"],
"include": ["**/*.ts"]
}
13 changes: 13 additions & 0 deletions apps/functions/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
9 changes: 9 additions & 0 deletions apps/functions/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
6 changes: 5 additions & 1 deletion apps/trendy-ssr/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const app = express();
const PORT = process.env.PORT || 4000;
const DIST_FOLDER = join(process.cwd(), 'dist/apps/trendy');
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
import { AppServerModuleNgFactory, LAZY_MODULE_MAP } from '../../../dist/trendy/server/main';
const {
AppServerModuleNgFactory,
LAZY_MODULE_MAP,
} = require('../../../dist/trendy/server/main');
//'../../../dist/apps/trendy/browser/main.55651155b747d7fc81fc';
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
app.engine(
'html',
Expand Down
2 changes: 1 addition & 1 deletion apps/trendy/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { existsSync } from 'fs';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const distFolder = join(process.cwd(), 'dist/trendy/browser');
const distFolder = join(process.cwd(), 'dist/apps/trendy/browser');
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
? 'index.original.html'
: 'index';
Expand Down
11 changes: 10 additions & 1 deletion docs/trendy-seo.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ SEO test:

https://www.sureoak.com/seo-tools/page-analyzer?websiteId=-260

Here are the links collected.
More tools:

- [Google Search Console](https://search.google.com/search-console/about)
- [Page Speed Insights](https://developers.google.com/speed/pagespeed/insights/)
- [Facebook Sharing Debugger](https://developers.facebook.com/tools/debug/sharing/)
- [LinkedIn Post Inspector](https://www.linkedin.com/post-inspector/inspect/)

Here are the links collected from the initial notes:

https://yoast.com/image-seo/

Expand Down Expand Up @@ -296,3 +303,5 @@ This is getting old now. Try and test after deployment and come back here later
https://yoast.com/structured-data-schema-ultimate-guide/

robot.txt investigation.

*generate a sitemap.xml file that contains a list of every page on the site and register it in Google Search Console and robots.txt file.*
Loading

0 comments on commit 919fe24

Please sign in to comment.