build: 服务发现。

This commit is contained in:
Ivan Li 2021-10-31 15:08:34 +08:00
parent c5ca8819e7
commit 3a6822bcec
7 changed files with 22872 additions and 15554 deletions

23
.cracorc.js Normal file
View File

@ -0,0 +1,23 @@
const { ServiceRegister } = require("@fennec/configuration");
const { findFreePorts } = require("find-free-ports");
module.exports = async function () {
return {
devServer: {
open: false,
port: await findFreePorts().then((ports) => ports[0]),
onListening(devServer) {
if (!devServer) {
throw new Error("webpack-dev-server is not defined");
}
const port = devServer.listeningApp.address().port;
const register = new ServiceRegister({
etcd: { hosts: ["http://rpi:2379"] },
});
register.register("admin.blog", `http://localhost:${port}/`);
console.log("Listening on port:", port);
},
},
};
};

2
.vscode/launch.json vendored
View File

@ -9,7 +9,7 @@
"type": "chrome", "type": "chrome",
"request": "launch", "request": "launch",
"reAttach": true, "reAttach": true,
"url": "http://admin.blog.localhost/", "url": "http://admin.blog.localhost:7070/",
"webRoot": "${workspaceFolder}", "webRoot": "${workspaceFolder}",
"userDataDir": "/Users/ivan/Projects/.chrome" "userDataDir": "/Users/ivan/Projects/.chrome"
} }

View File

@ -1,8 +1,8 @@
module.exports = { module.exports = {
client: { client: {
service: { service: {
name: 'blog-be', name: "blog-be",
url: 'http://api.blog.localhost/graphql' url: "http://api.blog.localhost:7070/graphql",
} },
} },
}; };

View File

@ -1,5 +1,5 @@
overwrite: true overwrite: true
schema: "http://localhost:7132/graphql" schema: "http://api.blog.localhost:7070/graphql"
# documents: "src/**/*.graphql" # documents: "src/**/*.graphql"
generates: generates:
src/generated/graphql.tsx: src/generated/graphql.tsx:

38312
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,9 +4,11 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.15", "@apollo/client": "^3.3.15",
"@craco/craco": "^6.4.0",
"@curi/react-dom": "^2.0.4", "@curi/react-dom": "^2.0.4",
"@curi/router": "^2.1.2", "@curi/router": "^2.1.2",
"@date-io/date-fns": "^1.3.13", "@date-io/date-fns": "^1.3.13",
"@fennec/configuration": "^0.0.1",
"@hickory/browser": "^2.1.0", "@hickory/browser": "^2.1.0",
"@material-ui/core": "^4.11.3", "@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2", "@material-ui/icons": "^4.11.2",
@ -21,9 +23,11 @@
"@types/react": "^17.0.3", "@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3", "@types/react-dom": "^17.0.3",
"apollo-link-scalars": "^2.1.3", "apollo-link-scalars": "^2.1.3",
"configuration": "^2.4.2",
"date-fns": "^2.22.1", "date-fns": "^2.22.1",
"eventemitter3": "^4.0.7", "eventemitter3": "^4.0.7",
"events": "^3.3.0", "events": "^3.3.0",
"find-free-ports": "^3.0.0",
"fontsource-roboto": "^4.0.0", "fontsource-roboto": "^4.0.0",
"formik": "^2.2.6", "formik": "^2.2.6",
"formik-material-ui": "^3.0.1", "formik-material-ui": "^3.0.1",
@ -31,6 +35,7 @@
"graphql": "^15.5.0", "graphql": "^15.5.0",
"graphql-scalars": "^1.10.0", "graphql-scalars": "^1.10.0",
"notistack": "^1.0.9", "notistack": "^1.0.9",
"npm": "^7.20.6",
"ramda": "^0.27.1", "ramda": "^0.27.1",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
@ -42,10 +47,9 @@
"yup": "^0.32.9" "yup": "^0.32.9"
}, },
"scripts": { "scripts": {
"start": "PORT=7135 BROWSER=none react-scripts start", "start": "craco start",
"build": "react-scripts build", "build": "craco build",
"test": "react-scripts test", "test": "craco test",
"eject": "react-scripts eject",
"prestart": "npm run graphql", "prestart": "npm run graphql",
"graphql": "graphql-codegen --config codegen.yml" "graphql": "graphql-codegen --config codegen.yml"
}, },

View File

@ -1571,7 +1571,20 @@
{ {
"name": "args", "name": "args",
"description": null, "description": null,
"args": [], "args": [
{
"name": "includeDeprecated",
"description": null,
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": "false",
"isDeprecated": false,
"deprecationReason": null
}
],
"type": { "type": {
"kind": "NON_NULL", "kind": "NON_NULL",
"name": null, "name": null,