Skip to content

Commit d25f1ff

Browse files
committed
Clean up the demo project setup.
1 parent 619f55f commit d25f1ff

File tree

214 files changed

+1890
-1544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+1890
-1544
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"projects": {
3-
"default": "data-driven-forms"
3+
"default": "debug-functions"
44
}
55
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public/service-worker.js
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
{
2-
"hosting": {
3-
"public": "dist/public",
4-
"rewrites": [
5-
{
6-
"source": "**/**",
7-
"function": "next"
8-
}
9-
]
10-
},
11-
"functions": {
12-
"source": "dist/functions"
13-
}
14-
}
2+
"hosting": {
3+
"public": "public",
4+
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
5+
"rewrites": [
6+
{
7+
"source": "**",
8+
"function": "nextjsFunc"
9+
}
10+
]
11+
},
12+
"functions": {
13+
"source": ".",
14+
"predeploy": [
15+
"npm --prefix \"$PROJECT_DIR\" install",
16+
"npm --prefix \"$PROJECT_DIR\" run build"
17+
]
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
const path = require('path');
21
const functions = require('firebase-functions');
32
const next = require('next');
43
const { join } = require('path');
54
const { parse } = require('url');
65

7-
let dev = process.env.NODE_ENV !== 'production';
8-
let app = next({
9-
dev,
10-
conf: { distDir: `${path.relative(process.cwd(), __dirname)}/next` }
6+
const isDev = process.env.NODE_ENV !== 'production';
7+
const nextjsDistDir = join('src', require('./src/next.config.js').distDir);
8+
const nextjsServer = next({
9+
dev: isDev,
10+
conf: {
11+
distDir: nextjsDistDir
12+
}
1113
});
12-
let handle = app.getRequestHandler();
14+
const nextjsHandle = nextjsServer.getRequestHandler();
1315

14-
exports.next = functions.https.onRequest((req, res) => {
16+
exports.nextjsFunc = functions.https.onRequest((req, res) => {
1517
console.log('File: ' + req.originalUrl); // eslint-disable-line no-console
16-
return app.prepare().then(() => {
18+
return nextjsServer.prepare().then(() => {
1719
const parsedUrl = parse(req.url, true);
1820
const { pathname } = parsedUrl;
1921

2022
// handle GET request to /service-worker.js
2123
if (pathname === '/service-worker.js') {
2224
const filePath = join(__dirname, '.next', pathname);
2325

24-
app.serveStatic(req, res, filePath);
26+
nextjsServer.serveStatic(req, res, filePath);
2527
} else {
26-
handle(req, res, parsedUrl);
28+
nextjsHandle(req, res, parsedUrl);
2729
}
2830
});
2931
});
Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
{
2-
"name": "with-firebase-hosting",
3-
"version": "4.0.1",
4-
"description": "Host Next.js SSR app on Firebase Cloud Functions with Firebase Hosting redirects.",
2+
"name": "@data-driven-forms/react-renderer-demo",
3+
"version": "1.0.0",
4+
"main": "firebaseFunctions.js",
5+
"description": "Documentation pages for data driven forms.",
56
"engines": {
67
"node": "10"
78
},
89
"private": true,
910
"scripts": {
10-
"dev": "next \"src/app/\"",
11-
"preserve": "npm run build-public && npm run build-funcs && npm run build-app && npm run copy-deps && npm run install-deps",
11+
"dev": "next src/",
12+
"build": "next build src/",
13+
"start": "next start src/",
1214
"serve": "cross-env NODE_ENV=production firebase serve",
13-
"create-deploy-files": "yarn build-public && yarn build-funcs && yarn build-app && yarn copy-deps",
14-
"deploy": "NODE_ENV=production firebase deploy",
15-
"clean": "rimraf \"dist/functions/**\" && rimraf \"dist/public\"",
16-
"build-public": "cpx \"src/public/**/*.*\" \"dist/public\" -C",
17-
"build-funcs": "babel \"src/functions\" --out-dir \"dist/functions\"",
18-
"build-app": "next build \"src/app/\"",
19-
"copy-deps": "cpx \"*{package.json,package-lock.json,yarn.lock}\" \"dist/functions\" -C",
20-
"install-deps": "cd \"dist/functions\" && npm i"
15+
"shell": "npm run build && firebase functions:shell",
16+
"deploy": "NODE_ENV=production firebase deploy --only functions,hosting",
17+
"logs": "firebase functions:log",
18+
"analyze": "ANALYZE=true next build src/",
19+
"lint": "eslint ./src",
20+
"generate:examples": "node ./scripts/generate-component-examples && yarn lint --fix"
2121
},
2222
"dependencies": {
2323
"@babel/plugin-proposal-class-properties": "^7.2.3",
24+
"@data-driven-forms/form-builder": "0.0.10-rc4",
2425
"@data-driven-forms/mui-component-mapper": "*",
2526
"@data-driven-forms/react-form-renderer": "*",
2627
"@material-ui/core": "^4.9.14",
2728
"@material-ui/icons": "^4.9.1",
2829
"@material-ui/styles": "^4.9.14",
2930
"@mdx-js/loader": "^1.4.5",
3031
"@mdx-js/react": "^1.4.5",
32+
"@next/bundle-analyzer": "^9.1.2",
3133
"@next/mdx": "^9.3.3",
34+
"@stackblitz/sdk": "^1.4.0",
3235
"clsx": "^1.0.4",
3336
"codesandbox": "2.1.14",
34-
"firebase-admin": "^8.5.0",
37+
"docsearch.js": "^2.6.3",
38+
"firebase-admin": "^8.12.1",
3539
"firebase-functions": "^3.6.1",
3640
"markdown-to-jsx": "^6.10.3",
3741
"next": "9.3.3",
@@ -43,15 +47,15 @@
4347
"react-copy-to-clipboard": "^5.0.1",
4448
"react-dom": "^16.13.1",
4549
"react-github-buttons": "^0.4.0",
46-
"react-sticky-box": "^0.8.0"
50+
"react-sticky-box": "^0.8.0",
51+
"terser-webpack-plugin": "^3.0.1"
4752
},
4853
"devDependencies": {
4954
"@babel/cli": "^7.2.0",
50-
"@next/bundle-analyzer": "^9.1.2",
5155
"cpx": "^1.5.0",
5256
"cross-env": "^5.2.0",
57+
"firebase-functions-test": "^0.2.1",
5358
"firebase-tools": "^7.7.10",
54-
"rimraf": "^2.6.0",
55-
"terser-webpack-plugin": "^2.2.1"
59+
"rimraf": "^2.6.0"
5660
}
5761
}

packages/react-renderer-demo/public/200.html

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/react-renderer-demo/public/404.html

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)