@steedos/service-api 2.5.5 → 2.6.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +30 -3
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -13,6 +13,8 @@ const {
|
|
|
13
13
|
const SteedosRouter = require('@steedos/router');
|
|
14
14
|
const _ = require('lodash');
|
|
15
15
|
const ServiceObjectGraphql = require('@steedos/service-object-graphql')
|
|
16
|
+
const open = require('open');
|
|
17
|
+
|
|
16
18
|
const validator = require('validator');
|
|
17
19
|
const enablePlayground = validator.toBoolean(process.env.STEEDOS_GRAPHQL_ENABLE_CONSOLE || 'true', true)
|
|
18
20
|
|
|
@@ -92,6 +94,7 @@ const mixinOptions = {
|
|
|
92
94
|
*/
|
|
93
95
|
module.exports = {
|
|
94
96
|
name: "api",
|
|
97
|
+
projectStarted: false,
|
|
95
98
|
mixins: [ApiGateway,
|
|
96
99
|
// GraphQL Apollo Server
|
|
97
100
|
ApolloService(mixinOptions),
|
|
@@ -814,6 +817,30 @@ module.exports = {
|
|
|
814
817
|
created() {
|
|
815
818
|
this.app = SteedosRouter.staticRouter();
|
|
816
819
|
},
|
|
820
|
+
events:{
|
|
821
|
+
'service-ui.started': function(){
|
|
822
|
+
this.app.use("/", this.express());
|
|
823
|
+
},
|
|
824
|
+
"$packages.changed": function(){
|
|
825
|
+
if (!this.projectStarted) {
|
|
826
|
+
this.projectStarted = true
|
|
827
|
+
// 开发环境, 显示耗时
|
|
828
|
+
if(process.env.NODE_ENV == 'development' && global.__startDate){
|
|
829
|
+
console.log('耗时: ' + (new Date().getTime() - global.__startDate.getTime()) + ' ms');
|
|
830
|
+
}
|
|
831
|
+
console.log(`Project is running at ${process.env.ROOT_URL}`);
|
|
832
|
+
console.log('');
|
|
833
|
+
if (process.env.STEEDOS_AUTO_OPEN_BROWSER != 'false') { // 默认打开,如果不想打开,设置STEEDOS_AUTO_OPEN_BROWSER=false
|
|
834
|
+
try {
|
|
835
|
+
open(process.env.ROOT_URL);
|
|
836
|
+
} catch (error) {
|
|
837
|
+
console.error(error);
|
|
838
|
+
console.error('auto open browser failed.');
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
},
|
|
817
844
|
async started() {
|
|
818
845
|
|
|
819
846
|
this.broker.createService(require("@steedos/service-ui"));
|
|
@@ -830,9 +857,9 @@ module.exports = {
|
|
|
830
857
|
// });
|
|
831
858
|
// }
|
|
832
859
|
|
|
833
|
-
this.broker.waitForServices('~packages-@steedos/service-ui').then(() => {
|
|
834
|
-
|
|
835
|
-
})
|
|
860
|
+
// this.broker.waitForServices('~packages-@steedos/service-ui').then(() => {
|
|
861
|
+
// this.app.use("/", this.express());
|
|
862
|
+
// })
|
|
836
863
|
|
|
837
864
|
global.SteedosApi = {
|
|
838
865
|
express: this.express
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1-beta.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@steedos/auth": "2.
|
|
8
|
-
"@steedos/router": "2.
|
|
9
|
-
"@steedos/service-object-graphql": "2.
|
|
10
|
-
"@steedos/service-ui": "2.
|
|
7
|
+
"@steedos/auth": "2.6.1-beta.1",
|
|
8
|
+
"@steedos/router": "2.6.1-beta.1",
|
|
9
|
+
"@steedos/service-object-graphql": "2.6.1-beta.1",
|
|
10
|
+
"@steedos/service-ui": "2.6.1-beta.1",
|
|
11
11
|
"graphql": "^15.8.0",
|
|
12
12
|
"graphql-iso-date": "^3.6.1",
|
|
13
13
|
"graphql-type-json": "^0.3.2",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "4cfca8ba76cca0b2ee1c7ad5997b97ba89f05aac"
|
|
24
24
|
}
|