From f5a2f1dadcc90c2017bcca5a65e3eeb6ce63737a Mon Sep 17 00:00:00 2001 From: Victor Vlasenko Date: Wed, 5 Jul 2023 17:47:13 +0300 Subject: [PATCH] Fixes build --- modules/rest/server-ts/createRestAPI.ts | 56 ------------------------- modules/rest/server-ts/index.ts | 1 - modules/rest/server-ts/module.ts | 14 ------- modules/rest/server-ts/package.json | 8 ---- package.json | 9 ++-- packages/client-angular/package.json | 2 +- packages/client-vue/package.json | 2 +- packages/client/package.json | 11 ++++- packages/client/webpack.config.js | 8 +++- packages/common/package.json | 2 +- packages/mobile/package.json | 2 +- packages/server/package.json | 19 ++++++++- packages/server/src/modules.ts | 2 - 13 files changed, 43 insertions(+), 93 deletions(-) delete mode 100644 modules/rest/server-ts/createRestAPI.ts delete mode 100644 modules/rest/server-ts/index.ts delete mode 100644 modules/rest/server-ts/module.ts delete mode 100644 modules/rest/server-ts/package.json diff --git a/modules/rest/server-ts/createRestAPI.ts b/modules/rest/server-ts/createRestAPI.ts deleted file mode 100644 index d8c1d50a70..0000000000 --- a/modules/rest/server-ts/createRestAPI.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Express } from 'express'; -import { GraphQLSchema } from 'graphql'; -import bodyParser from 'body-parser'; - -import ServerModule from '@gqlapp/module-server-ts'; -import sofa, { OpenAPI } from '@hofstadter-io/sofa-api'; -import settings from '@gqlapp/config'; - -import swaggerUi from 'swagger-ui-express'; - -const createRestAPI = (app: Express, schema: GraphQLSchema, modules: ServerModule) => { - // need to enable explicitly - if (settings.rest.enabled) { - // setup the openApi objecct - const openApi = OpenAPI({ - schema, - info: { - title: settings.app.name, - version: '0.0.0', - }, - }); - - // need to parse json bodies for sofa (maybe others, content negotiation middleware anywhere?) - app.use(settings.rest.basePath, bodyParser.json()); - - // setups up sofa at basepath - app.use( - settings.rest.basePath, - sofa({ - schema, - onRoute: (info) => { - openApi.addRoute(info, { - basePath: settings.rest.basePath, - }); - }, - // construct the context, this shows up as the context parameter to resolvers - context: async ({ req, res }) => { - const ctx = await modules.createContext(req, res); - return { - req, - res, - ...ctx, - }; - }, - }) - ); - - // possibly setup a swagger interface - if (settings.rest.swaggerPath) { - const swaggerDocument = openApi.get(); - app.use(settings.rest.basePath + settings.rest.swaggerPath, swaggerUi.serve, swaggerUi.setup(swaggerDocument)); - } - } -}; - -export default createRestAPI; diff --git a/modules/rest/server-ts/index.ts b/modules/rest/server-ts/index.ts deleted file mode 100644 index 5669f047bc..0000000000 --- a/modules/rest/server-ts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export default __TEST__ ? {} : require('./module').default; diff --git a/modules/rest/server-ts/module.ts b/modules/rest/server-ts/module.ts deleted file mode 100644 index de66f4f9a2..0000000000 --- a/modules/rest/server-ts/module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import ServerModule from '@gqlapp/module-server-ts'; -import { createSchema } from '@gqlapp/core-server-ts'; -import { Express } from 'express'; - -import createRestAPI from './createRestAPI'; - -const ref: { modules: ServerModule } = { modules: null }; - -const middleware = (app: Express) => createRestAPI(app, createSchema(ref.modules), ref.modules); - -export default new ServerModule({ - onAppCreate: [async (modules: ServerModule) => (ref.modules = modules)], - middleware: [middleware], -}); diff --git a/modules/rest/server-ts/package.json b/modules/rest/server-ts/package.json deleted file mode 100644 index f36d5d44b9..0000000000 --- a/modules/rest/server-ts/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "@gqlapp/rest-server-ts", - "version": "0.1.0", - "private": true, - "devDependencies": { - "@types/swagger-ui-express": "^3.0.0" - } -} diff --git a/package.json b/package.json index 9964141bd5..2bf01f7914 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "eslint": "eslint --fix --ext .js,.jsx,.ts,.tsx,.json .", "heroku-postbuild": "yarn workspaces foreach -pv run heroku-postbuild", "precommit": "lint-staged", - "postinstall": "opencollective postinstall" + "postinstall": "opencollective" }, "lint-staged": { "*.{js,jsx,ts,tsx,json}": [ @@ -109,7 +109,7 @@ "@typescript-eslint/eslint-plugin": "^5.23.0", "@typescript-eslint/parser": "^5.23.0", "@webpack-cli/serve": "^1.6.1", - "autoprefixer": "10.4.5", + "autoprefixer": "9.8.6", "babel-core": "^7.0.0-0", "babel-jest": "^24.8.0", "babel-loader": "^8.0.6", @@ -183,6 +183,7 @@ "resolutions": { "card-validator": "8.1.1", "@react-native-picker/picker": "1.16.8", - "extract-files": "6.0.0" + "extract-files": "6.0.0", + "file-loader/loader-utils": "2.0.4" } -} +} \ No newline at end of file diff --git a/packages/client-angular/package.json b/packages/client-angular/package.json index 2ab35ba028..e2ab5af78c 100644 --- a/packages/client-angular/package.json +++ b/packages/client-angular/package.json @@ -96,4 +96,4 @@ "not ie < 11" ] } -} +} \ No newline at end of file diff --git a/packages/client-vue/package.json b/packages/client-vue/package.json index ee3ee7af1d..b76fd18810 100644 --- a/packages/client-vue/package.json +++ b/packages/client-vue/package.json @@ -108,4 +108,4 @@ "not ie < 11" ] } -} +} \ No newline at end of file diff --git a/packages/client/package.json b/packages/client/package.json index 9a20b85da1..60c2dce7fe 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -40,16 +40,25 @@ "@fortawesome/fontawesome-svg-core": "^1.2.17", "@fortawesome/free-brands-svg-icons": "^5.8.1", "@fortawesome/react-fontawesome": "^0.1.4", + "@gqlapp/authentication-client-react": "^0.1.0", "@gqlapp/chat-client-react": "^0.1.0", + "@gqlapp/contact-common": "^0.1.0", "@gqlapp/contact-client-react": "^0.1.0", "@gqlapp/core-client-react": "^0.1.0", "@gqlapp/counter-client-react": "^0.1.0", + "@gqlapp/favicon-common": "^0.1.0", "@gqlapp/forms-client-react": "^0.1.0", "@gqlapp/i18n-client-react": "^0.1.0", "@gqlapp/i18n-common-react": "^0.1.0", "@gqlapp/module-client-react": "^0.1.0", + "@gqlapp/page-not-found-client-react": "^0.1.0", + "@gqlapp/pagination-client-react": "^0.1.0", "@gqlapp/payments-client-react": "^0.1.0", + "@gqlapp/post-client-react": "^0.1.0", "@gqlapp/reports-client-react": "^0.1.0", + "@gqlapp/router-client-react": "^0.1.0", + "@gqlapp/upload-client-react": "^0.1.0", + "@gqlapp/user-client-react": "^0.1.0", "@gqlapp/validation-common-react": "^0.1.0", "@loadable/component": "^5.10.1", "antd": "^3.19.8", @@ -175,4 +184,4 @@ "not ie < 11" ] } -} +} \ No newline at end of file diff --git a/packages/client/webpack.config.js b/packages/client/webpack.config.js index 78390548d8..9ea3848d41 100644 --- a/packages/client/webpack.config.js +++ b/packages/client/webpack.config.js @@ -44,7 +44,13 @@ const config = { name: 'web', module: { rules: [ - { test: /\.mjs$/, include: /node_modules/, type: 'javascript/auto' }, + { + test: /\.m?js$/, + include: /node_modules/, + resolve: { + fullySpecified: false, + }, + }, { test: /\.(png|ico|jpg|gif|xml)$/, use: { loader: 'url-loader', options: { name: '[fullhash].[ext]', limit: 100000 } }, diff --git a/packages/common/package.json b/packages/common/package.json index 70732cc67e..14dfcf15bc 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -32,4 +32,4 @@ "eslint": "^8.15.0", "jest": "^26.2.2" } -} +} \ No newline at end of file diff --git a/packages/mobile/package.json b/packages/mobile/package.json index 7a590c33cd..33dd5e22bf 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -122,4 +122,4 @@ "rimraf": "^2.6.2", "ws": "^5.1.1" } -} +} \ No newline at end of file diff --git a/packages/server/package.json b/packages/server/package.json index 150eef49ca..f99ccc68ab 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -52,11 +52,26 @@ "dependencies": { "@babel/preset-env": "^7.0.0", "@babel/register": "^7.0.0", + "@gqlapp/authentication-server-ts": "^0.1.0", + "@gqlapp/config": "^0.1.0", + "@gqlapp/core-server-ts": "^0.1.0", + "@gqlapp/chat-server-ts": "^0.1.0", + "@gqlapp/contact-server-ts": "^0.1.0", + "@gqlapp/cookies-server-ts": "^0.1.0", + "@gqlapp/counter-server-ts": "^0.1.0", + "@gqlapp/graphql-types-server-ts": "^0.1.0", + "@gqlapp/post-server-ts": "^0.1.0", + "@gqlapp/upload-server-ts": "^0.1.0", + "@gqlapp/i18n-server-ts": "^0.1.0", "@gqlapp/core-common": "^0.1.0", "@gqlapp/database-server-ts": "^0.1.0", + "@gqlapp/payments-server-ts": "^0.1.0", + "@gqlapp/mailer-server-ts": "^0.1.0", + "@gqlapp/reports-server-ts": "^0.1.0", + "@gqlapp/debug-server-ts": "^0.1.0", "@gqlapp/module-server-ts": "^0.1.0", + "@gqlapp/user-server-ts": "^0.1.0", "@gqlapp/testing-server-ts": "^0.1.0", - "@hofstadter-io/sofa-api": "^0.3.1", "@loadable/component": "^5.10.1", "@loadable/server": "^5.9.0", "@types/compression": "^0.0.36", @@ -172,4 +187,4 @@ "rimraf": "^2.6.2", "ws": "^5.1.1" } -} +} \ No newline at end of file diff --git a/packages/server/src/modules.ts b/packages/server/src/modules.ts index dc47e79861..5b718e03f3 100644 --- a/packages/server/src/modules.ts +++ b/packages/server/src/modules.ts @@ -12,7 +12,6 @@ import mailer from '@gqlapp/mailer-server-ts'; import graphqlTypes from '@gqlapp/graphql-types-server-ts'; import authentication from '@gqlapp/authentication-server-ts'; import reports from '@gqlapp/reports-server-ts'; -import rest from '@gqlapp/rest-server-ts'; import '@gqlapp/debug-server-ts'; import ServerModule from '@gqlapp/module-server-ts'; @@ -32,7 +31,6 @@ const modules: ServerModule = new ServerModule( mailer, chat, reports, - rest, graphqlTypes, core );