Commit 3c1cfabf authored by ι™ˆεΈ…'s avatar ι™ˆεΈ…

Optimization: chnage firebase site script

parent e0db0d1d
{ {
"hosting": { "hosting": {
"public": "dist", "public": "dist",
"rewrites": [{ "source": "/api/**", "function": "api" }], "rewrites": [
{ "source": "/api/**", "function": "api" },
{
"source": "**",
"destination": "/index.html"
}
],
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"] "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
} }
} }
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
"name": "functions", "name": "functions",
"description": "Cloud Functions for Firebase", "description": "Cloud Functions for Firebase",
"scripts": { "scripts": {
"serve": "npm run mock && firebase serve --only functions", "serve": "firebase serve --only functions",
"shell": "firebase functions:shell", "shell": "firebase functions:shell",
"start": "npm run shell", "start": "npm run shell",
"deploy": "firebase deploy --only functions", "deploy": "firebase deploy --only functions",
"logs": "firebase functions:log", "logs": "firebase functions:log",
"mock": "cd .. && rollup -c" "mock": "cd ../scripts && rollup -c"
}, },
"dependencies": { "dependencies": {
"express": "^4.16.3", "express": "^4.16.3",
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"start": "cross-env ESLINT=none umi dev", "start": "cross-env ESLINT=none umi dev",
"start:no-mock": "cross-env MOCK=none ESLINT=none umi dev", "start:no-mock": "cross-env MOCK=none ESLINT=none umi dev",
"build": "cross-env ESLINT=none umi build", "build": "cross-env ESLINT=none umi build",
"site": "npm run presite && rollup -c && npm run build && firebase deploy", "site": "npm run presite && npm run build && firebase deploy",
"analyze": "cross-env ANALYZE=1 umi build", "analyze": "cross-env ANALYZE=1 umi build",
"lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint:style": "stylelint \"src/**/*.less\" --syntax less",
"lint": "eslint --ext .js src mock tests && npm run lint:style", "lint": "eslint --ext .js src mock tests && npm run lint:style",
......
import api from 'mock/api'; import api from '../mock/api';
import chart from 'mock/chart'; import chart from '../mock/chart';
import geographic from 'mock/geographic'; import geographic from '../mock/geographic';
import notices from 'mock/notices'; import notices from '../mock/notices';
import profile from 'mock/profile'; import profile from '../mock/profile';
import rule from 'mock/rule'; import rule from '../mock/rule';
import user from 'mock/user'; import user from '../mock/user';
export default { const data = {};
...api, Object.keys(api).forEach(key => {
...chart, data[key] = api[key];
...geographic, });
...notices, Object.keys(chart).forEach(key => {
...profile, data[key] = chart[key];
...rule, });
...user,
}; Object.keys(geographic).forEach(key => {
data[key] = geographic[key];
});
Object.keys(notices).forEach(key => {
data[key] = notices[key];
});
Object.keys(profile).forEach(key => {
data[key] = profile[key];
});
Object.keys(rule).forEach(key => {
data[key] = rule[key];
});
Object.keys(user).forEach(key => {
data[key] = user[key];
});
export default data;
...@@ -3,7 +3,7 @@ import json from 'rollup-plugin-json'; ...@@ -3,7 +3,7 @@ import json from 'rollup-plugin-json';
export default { export default {
input: './all_mock.js', input: './all_mock.js',
output: { output: {
file: './functions/mock/index.js', file: '../functions/mock/index.js',
format: 'umd', format: 'umd',
name: 'mock', name: 'mock',
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment