build: 服务发现。
This commit is contained in:
parent
c5ca8819e7
commit
3a6822bcec
23
.cracorc.js
Normal file
23
.cracorc.js
Normal 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
2
.vscode/launch.json
vendored
@ -9,7 +9,7 @@
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"reAttach": true,
|
||||
"url": "http://admin.blog.localhost/",
|
||||
"url": "http://admin.blog.localhost:7070/",
|
||||
"webRoot": "${workspaceFolder}",
|
||||
"userDataDir": "/Users/ivan/Projects/.chrome"
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
module.exports = {
|
||||
client: {
|
||||
service: {
|
||||
name: 'blog-be',
|
||||
url: 'http://api.blog.localhost/graphql'
|
||||
}
|
||||
}
|
||||
name: "blog-be",
|
||||
url: "http://api.blog.localhost:7070/graphql",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
overwrite: true
|
||||
schema: "http://localhost:7132/graphql"
|
||||
schema: "http://api.blog.localhost:7070/graphql"
|
||||
# documents: "src/**/*.graphql"
|
||||
generates:
|
||||
src/generated/graphql.tsx:
|
||||
|
38364
package-lock.json
generated
38364
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@ -4,9 +4,11 @@
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.3.15",
|
||||
"@craco/craco": "^6.4.0",
|
||||
"@curi/react-dom": "^2.0.4",
|
||||
"@curi/router": "^2.1.2",
|
||||
"@date-io/date-fns": "^1.3.13",
|
||||
"@fennec/configuration": "^0.0.1",
|
||||
"@hickory/browser": "^2.1.0",
|
||||
"@material-ui/core": "^4.11.3",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
@ -21,9 +23,11 @@
|
||||
"@types/react": "^17.0.3",
|
||||
"@types/react-dom": "^17.0.3",
|
||||
"apollo-link-scalars": "^2.1.3",
|
||||
"configuration": "^2.4.2",
|
||||
"date-fns": "^2.22.1",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"events": "^3.3.0",
|
||||
"find-free-ports": "^3.0.0",
|
||||
"fontsource-roboto": "^4.0.0",
|
||||
"formik": "^2.2.6",
|
||||
"formik-material-ui": "^3.0.1",
|
||||
@ -31,6 +35,7 @@
|
||||
"graphql": "^15.5.0",
|
||||
"graphql-scalars": "^1.10.0",
|
||||
"notistack": "^1.0.9",
|
||||
"npm": "^7.20.6",
|
||||
"ramda": "^0.27.1",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
@ -42,10 +47,9 @@
|
||||
"yup": "^0.32.9"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "PORT=7135 BROWSER=none react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject",
|
||||
"start": "craco start",
|
||||
"build": "craco build",
|
||||
"test": "craco test",
|
||||
"prestart": "npm run graphql",
|
||||
"graphql": "graphql-codegen --config codegen.yml"
|
||||
},
|
||||
|
@ -1571,7 +1571,20 @@
|
||||
{
|
||||
"name": "args",
|
||||
"description": null,
|
||||
"args": [],
|
||||
"args": [
|
||||
{
|
||||
"name": "includeDeprecated",
|
||||
"description": null,
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "Boolean",
|
||||
"ofType": null
|
||||
},
|
||||
"defaultValue": "false",
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
}
|
||||
],
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
|
Loading…
Reference in New Issue
Block a user