diff --git a/server/.flowconfig b/server/.flowconfig index d3fc7cd98..a4e1028c7 100644 --- a/server/.flowconfig +++ b/server/.flowconfig @@ -1,40 +1,41 @@ [ignore] /dist /node_modules/google-gax/node_modules/grpc/node_modules/protobufjs/src/bower.json .*/node_modules/protobufjs/src/bower.json .*/web/flow-typed [include] +../landing ../lib ../web [libs] ../lib/flow-typed [options] module.file_ext=.js module.file_ext=.cjs module.file_ext=.json esproposal.optional_chaining=enable esproposal.nullish_coalescing=enable [lints] sketchy-null-number=warn sketchy-null-mixed=warn sketchy-number=warn untyped-type-import=warn nonstrict-import=warn deprecated-type=warn unsafe-getters-setters=warn unnecessary-invariant=warn signature-verification-failure=warn deprecated-utility=error [strict] deprecated-type nonstrict-import sketchy-null unclear-type unsafe-getters-setters untyped-import untyped-type-import diff --git a/server/loader.mjs b/server/loader.mjs index 8d1d0fb0b..418bbac0e 100644 --- a/server/loader.mjs +++ b/server/loader.mjs @@ -1,16 +1,18 @@ +const localPackages = ['landing', 'lib', 'web']; + async function resolve(specifier, context, defaultResolve) { const defaultResult = defaultResolve(specifier, context, defaultResolve); // Special hack to use Babel-transpiled lib and web - if (specifier.startsWith('lib/') || specifier.startsWith('web/')) { + if (localPackages.some(pkg => specifier.startsWith(`${pkg}/`))) { const url = defaultResult.url.replace( specifier, `server/dist/${specifier}`, ); return { url }; } return defaultResult; } export { resolve }; diff --git a/server/package.json b/server/package.json index dbb86184b..d44469312 100644 --- a/server/package.json +++ b/server/package.json @@ -1,95 +1,96 @@ { "name": "server", "version": "0.0.1", "type": "module", "private": true, "license": "BSD-3-Clause", "main": "dist/server", "scripts": { "clean": "rm -rf dist/ && rm -rf node_modules/ && mkdir dist", - "babel-build": "yarn --silent babel src/ --out-dir dist/ --config-file ./babel.config.cjs --verbose --ignore 'src/lib/flow-typed','src/lib/node_modules','src/lib/package.json','src/web/flow-typed','src/web/node_modules','src/web/package.json','src/web/dist','src/web/webpack.config.js','src/web/account-bar.react.js','src/web/app.react.js','src/web/calendar','src/web/chat','src/web/flow','src/web/loading-indicator.react.js','src/web/modals','src/web/root.js','src/web/router-history.js','src/web/script.js','src/web/selectors/chat-selectors.js','src/web/selectors/entry-selectors.js','src/web/splash','src/web/vector-utils.js','src/web/vectors.react.js'", + "babel-build": "yarn --silent babel src/ --out-dir dist/ --config-file ./babel.config.cjs --verbose --ignore 'src/landing/flow-typed','src/landing/node_modules','src/landing/package.json','src/lib/flow-typed','src/lib/node_modules','src/lib/package.json','src/web/flow-typed','src/web/node_modules','src/web/package.json','src/web/dist','src/web/webpack.config.js','src/web/account-bar.react.js','src/web/app.react.js','src/web/calendar','src/web/chat','src/web/flow','src/web/loading-indicator.react.js','src/web/modals','src/web/root.js','src/web/router-history.js','src/web/script.js','src/web/selectors/chat-selectors.js','src/web/selectors/entry-selectors.js','src/web/splash','src/web/vector-utils.js','src/web/vectors.react.js'", "rsync": "rsync -rLpmuv --exclude '*/package.json' --exclude '*/node_modules/*' --include '*.json' --include '*.cjs' --exclude '*.*' src/ dist/", "prod-build": "yarn babel-build && yarn rsync && yarn update-geoip", "update-geoip": "yarn script dist/scripts/update-geoip.js", "prod": "node --trace-warnings --experimental-json-modules --loader=./loader.mjs --experimental-specifier-resolution=node dist/server", "dev-rsync": "yarn --silent chokidar --initial --silent -s 'src/**/*.json' 'src/**/*.cjs' -c 'yarn rsync > /dev/null 2>&1'", "dev": "yarn concurrently --names=\"BABEL,RSYNC,NODEM\" -c \"bgBlue.bold,bgMagenta.bold,bgGreen.bold\" \"yarn babel-build --watch\" \"yarn dev-rsync\" \". bash/source-nvm.sh && NODE_ENV=dev nodemon -e js,json,cjs --watch dist --experimental-json-modules --loader=./loader.mjs --experimental-specifier-resolution=node dist/server\"", "script": ". bash/source-nvm.sh && node --experimental-json-modules --loader=./loader.mjs --experimental-specifier-resolution=node", "test": "jest" }, "devDependencies": { "@babel/cli": "^7.13.14", "@babel/core": "^7.13.14", "@babel/node": "^7.13.13", "@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", "@babel/plugin-proposal-object-rest-spread": "^7.13.8", "@babel/plugin-proposal-optional-chaining": "^7.13.12", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.13.10", "@babel/preset-env": "^7.13.12", "@babel/preset-flow": "^7.13.13", "@babel/preset-react": "^7.13.13", "babel-jest": "^26.6.3", "chokidar-cli": "^2.1.0", "concurrently": "^5.3.0", "flow-bin": "^0.122.0", "flow-typed": "^3.2.1", "jest": "^26.6.3", "nodemon": "^2.0.4" }, "dependencies": { "@babel/runtime": "^7.13.10", "@parse/node-apn": "^3.2.0", "@vingle/bmp-js": "^0.2.5", "JSONStream": "^1.3.5", "common-tags": "^1.7.2", "cookie-parser": "^1.4.3", "dateformat": "^3.0.3", "express": "^4.17.1", "express-ws": "^4.0.0", "firebase-admin": "^9.2.0", "geoip-lite": "^1.4.0", "invariant": "^2.2.4", + "landing": "0.0.1", "lib": "0.0.1", "lodash": "^4.17.19", "multer": "^1.4.1", "mysql2": "^1.5.1", "node-schedule": "^1.3.0", "nodemailer": "^6.3.0", "react": "16.13.1", "react-dom": "16.13.1", "react-html-email": "^3.0.0", "react-redux": "^7.1.1", "react-router": "^5.1.2", "redis": "^2.8.0", "redux": "^4.0.4", "replacestream": "^4.0.3", "rereadable-stream": "^1.4.5", "sharp": "^0.25.2", "sql-template-strings": "^2.2.2", "stream-combiner": "^0.2.2", "tcomb": "^3.2.24", "twin-bcrypt": "^2.1.1", "uuid": "^3.3.3", "web": "0.0.1" }, "optionalDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "nodemonConfig": { "delay": "200" }, "jest": { "roots": [ "/src" ], "transform": { "\\.js$": "babel-jest" }, "transformIgnorePatterns": [ "/node_modules/(?!@babel\/runtime)" ] } } diff --git a/server/src/landing b/server/src/landing new file mode 120000 index 000000000..ee38d8265 --- /dev/null +++ b/server/src/landing @@ -0,0 +1 @@ +../../landing \ No newline at end of file