From 08705c666d2e86a7db162d3668c901015e089d3d Mon Sep 17 00:00:00 2001 From: David Pradell Date: Wed, 23 Nov 2022 13:12:37 +0100 Subject: [PATCH 1/7] Create app.config --- .../parse-server-migration/.ebextensions/app.config | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 demos/parse-server-migration/.ebextensions/app.config diff --git a/demos/parse-server-migration/.ebextensions/app.config b/demos/parse-server-migration/.ebextensions/app.config new file mode 100644 index 0000000000..4db0cee658 --- /dev/null +++ b/demos/parse-server-migration/.ebextensions/app.config @@ -0,0 +1,13 @@ +option_settings: + aws:elasticbeanstalk:application:environment: + MORALIS_API_KEY: 'replace_me' + MASTER_KEY: 'replace_me' + APPLICATION_ID: 'replace_me' + SERVER_URL: 'http://myappname.elasticbeanstalk.com/server' + DATABASE_URI: 'mongodb://localhost:27017' + REDIS_CONNECTION_STRING: 'redis://127.0.0.1:6379' + RATE_LIMIT_TTL: 30 + RATE_LIMIT_AUTHENTICATED: 50 + RATE_LIMIT_ANONYMOUS: 20 + USE_STREAMS: true + STREAMS_WEBHOOK_URL: '/streams-webhook' \ No newline at end of file From 105422ba5703f6224d2f8673552db25dd17adcc7 Mon Sep 17 00:00:00 2001 From: dpradell <99496843+dpradell-moralis@users.noreply.github.com> Date: Wed, 23 Nov 2022 17:02:42 +0100 Subject: [PATCH 2/7] Update README.md --- demos/parse-server-migration/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/demos/parse-server-migration/README.md b/demos/parse-server-migration/README.md index 60bd6f4482..40cf35c02b 100644 --- a/demos/parse-server-migration/README.md +++ b/demos/parse-server-migration/README.md @@ -38,3 +38,7 @@ Make sure to set the `DATABASE_URI` in your `.env` file For rate-limiting, we are using a redis instance. In order for this to work, you will need to setup redis instance. For more information you can see https://redis.io/docs/getting-started/ For local development you will need to install redis on your local machine, and start the service. Make sure to set the `REDIS_CONNECTION_STRING` in your `.env` file + +## Remote deployment + + From 1f1ef1055dbc106c4f89174cd0ce66418486ecb2 Mon Sep 17 00:00:00 2001 From: David Pradell Date: Wed, 23 Nov 2022 18:24:49 +0100 Subject: [PATCH 3/7] not using streams --- demos/parse-server-migration/.ebextensions/app.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/parse-server-migration/.ebextensions/app.config b/demos/parse-server-migration/.ebextensions/app.config index 4db0cee658..1df2a02267 100644 --- a/demos/parse-server-migration/.ebextensions/app.config +++ b/demos/parse-server-migration/.ebextensions/app.config @@ -9,5 +9,5 @@ option_settings: RATE_LIMIT_TTL: 30 RATE_LIMIT_AUTHENTICATED: 50 RATE_LIMIT_ANONYMOUS: 20 - USE_STREAMS: true + USE_STREAMS: false STREAMS_WEBHOOK_URL: '/streams-webhook' \ No newline at end of file From e73cad7de3e9931d7386e3be0a36d20d4c7eb6fc Mon Sep 17 00:00:00 2001 From: dpradell <99496843+dpradell-moralis@users.noreply.github.com> Date: Wed, 23 Nov 2022 21:16:49 +0100 Subject: [PATCH 4/7] Update README.md --- demos/parse-server-migration/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/demos/parse-server-migration/README.md b/demos/parse-server-migration/README.md index 40cf35c02b..f622d3cd7b 100644 --- a/demos/parse-server-migration/README.md +++ b/demos/parse-server-migration/README.md @@ -41,4 +41,7 @@ For local development you will need to install redis on your local machine, and ## Remote deployment +### AWS Elastic Beanstalk +Follow the steps in the documentation: +https://docs.moralis.io/docs/deploy-to-production#aws-elastic-beanstalk From 3d798fd1ab65ce7d6d4b72c97d875b3daac1b1a9 Mon Sep 17 00:00:00 2001 From: Erno Date: Thu, 24 Nov 2022 17:23:57 +0700 Subject: [PATCH 5/7] ci: make full build of parse-migration demo --- scripts/buildDemoDocs.js | 50 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/scripts/buildDemoDocs.js b/scripts/buildDemoDocs.js index 8b4a59993f..71633eda6f 100644 --- a/scripts/buildDemoDocs.js +++ b/scripts/buildDemoDocs.js @@ -2,6 +2,8 @@ const fs = require('fs'); const path = require('path'); const fse = require('fs-extra'); const archiver = require('archiver'); +const util = require('util'); +const asyncExec = util.promisify(require('child_process').exec); // Url to hosted github pages const HOSTED_PAGES = 'https://moralisweb3.github.io/Moralis-JS-SDK'; @@ -26,11 +28,17 @@ const OUT_DIR_DOCS = 'docs'; // Reference to the folder names in the output folder const DEMOS_DIR = 'demos'; const CODE_DIR = 'code'; +const CODE_WITH_BUILD_DIR = 'code-build'; const demoFolderPath = path.join(__dirname, '..', DIR_DEMO); const outputCodePath = path.join(__dirname, '..', OUT_DIR_CODE, DEMOS_DIR); const outputDocsPath = path.join(__dirname, '..', OUT_DIR_DOCS); +// List of demos that require to upload a full build (node_modules and build artefacts) as well +const fullBuild = ['parse-server-migration']; + +const isFullBuild = (demoFolder) => fullBuild.includes(demoFolder); + const getAllFilesFromFolder = async (folderName) => require('glob-fs')({ dotfiles: true }).readdirSync(`demos/${folderName}/**/*`); @@ -63,6 +71,12 @@ const copyDemoToDocs = async (name, filePath) => { await fse.copySync(srcPath, outPath); + if (isFullBuild(name)) { + const fullBuildOutPath = path.join(outputCodePath, name, CODE_WITH_BUILD_DIR, subPath); + + await fse.copySync(srcPath, fullBuildOutPath); + } + return subPath; }; @@ -82,6 +96,20 @@ const copyAllDemosToDocs = async (demoFolders) => { return info; }; +/** + * Install and build for the demos that need a full build as well + */ +const createFullBuilds = async (demoFolders) => { + await Promise.all( + demoFolders.filter(isFullBuild).map(async (name) => { + const pathToDemo = path.join(outputCodePath, name, CODE_WITH_BUILD_DIR); + + await asyncExec('yarn install', { cwd: pathToDemo }); + await asyncExec('yarn build', { cwd: pathToDemo }); + }), + ); +}; + /** * Get all README content from the demos and store it in an object for lookup */ @@ -115,12 +143,14 @@ const getGithubUrl = (name) => `${GITHUB_DEMO_PATH}/${name}`; const getDownloadName = (name) => `${name}.zip`; const getDownloadPath = (name) => `${HOSTED_PAGES}/${DEMOS_DIR}/${name}/${getDownloadName(name)}`; const getCodePath = (name) => `${HOSTED_PAGES}/${DEMOS_DIR}/${name}/${CODE_DIR}`; +const getFullBuildCodePath = (name) => `${HOSTED_PAGES}/${DEMOS_DIR}/${name}/${CODE_WITH_BUILD_DIR}`; +const getFullbuildDownloadName = (name) => `${name}-build.zip`; /** * Creates a .zip file for a demo project */ -const createAchive = (folder) => { - const output = fs.createWriteStream(path.join(outputCodePath, folder, getDownloadName(folder))); +const createAchive = (folder, fileName, codePath) => { + const output = fs.createWriteStream(path.join(outputCodePath, folder, fileName)); const archive = archiver('zip', { zlib: { level: COMPRESSION_LEVEL }, }); @@ -150,7 +180,7 @@ const createAchive = (folder) => { archive.pipe(output); - archive.directory(path.join(outputCodePath, folder, CODE_DIR), false); + archive.directory(path.join(outputCodePath, folder, codePath), false); archive.finalize(); }; @@ -158,8 +188,16 @@ const createAchive = (folder) => { /** * Create archives for all demo projects */ -const createAllAchives = (demoFolders) => { - return Promise.all(demoFolders.map((folder) => createAchive(folder))); +const createAllAchives = async (demoFolders) => { + // Create archive for all demos + await Promise.all(demoFolders.map((folder) => createAchive(folder, getDownloadName(folder), CODE_DIR))); + + // Create archives for full build demos + await Promise.all( + demoFolders + .filter(isFullBuild) + .map((folder) => createAchive(folder, getFullbuildDownloadName(folder), CODE_WITH_BUILD_DIR)), + ); }; /** @@ -170,6 +208,7 @@ const createInfo = (name) => ({ github: getGithubUrl(name), download: getDownloadPath(name), code: getCodePath(name), + ...(isFullBuild(name) ? { fullBuildCode: getFullBuildCodePath(name) } : {}), }); /** @@ -260,6 +299,7 @@ const run = async () => { await ensureAllCleanOutputDir(demoFolders); await copyAllDemosToDocs(demoFolders); + await createFullBuilds(demoFolders); await createAllAchives(demoFolders); const readmeData = await getAllReadmeData(demoFolders); const demosData = createDemoData(demoFolders); From 4269c8ba7681066e75753e37608c837e47206227 Mon Sep 17 00:00:00 2001 From: Shalom Ogunshola Date: Thu, 24 Nov 2022 15:06:40 +0100 Subject: [PATCH 6/7] chore(client): hide firebase auth packages --- packages/client/firebaseAuthUtils/package.json | 2 +- packages/client/firebaseEvmAuth/package.json | 2 +- packages/client/firebaseSolAuth/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/firebaseAuthUtils/package.json b/packages/client/firebaseAuthUtils/package.json index eb603f7b38..ae5605330e 100644 --- a/packages/client/firebaseAuthUtils/package.json +++ b/packages/client/firebaseAuthUtils/package.json @@ -3,7 +3,7 @@ "author": "Moralis", "version": "2.7.4", "license": "MIT", - "private": false, + "private": true, "main": "./lib/index.js", "types": "./lib/index.d.ts", "sideEffects": false, diff --git a/packages/client/firebaseEvmAuth/package.json b/packages/client/firebaseEvmAuth/package.json index 2141dc8994..43a2a172c9 100644 --- a/packages/client/firebaseEvmAuth/package.json +++ b/packages/client/firebaseEvmAuth/package.json @@ -3,7 +3,7 @@ "author": "Moralis", "version": "2.7.4", "license": "MIT", - "private": false, + "private": true, "main": "./lib/index.js", "types": "./lib/index.d.ts", "sideEffects": false, diff --git a/packages/client/firebaseSolAuth/package.json b/packages/client/firebaseSolAuth/package.json index 03e77a9a17..6967d2bfcb 100644 --- a/packages/client/firebaseSolAuth/package.json +++ b/packages/client/firebaseSolAuth/package.json @@ -3,7 +3,7 @@ "author": "Moralis", "version": "2.7.4", "license": "MIT", - "private": false, + "private": true, "main": "./lib/index.js", "types": "./lib/index.d.ts", "sideEffects": false, From 47d768fa626809e5fb365baecde9edf7a88f8577 Mon Sep 17 00:00:00 2001 From: Shalom Ogunshola Date: Thu, 24 Nov 2022 15:44:25 +0100 Subject: [PATCH 7/7] hide new firebase packages --- packages/client/firebaseApiUtils/package.json | 2 +- packages/client/firebaseAuthUtils/package.json | 2 +- packages/client/firebaseEvmApi/package.json | 2 +- packages/client/firebaseEvmAuth/package.json | 2 +- packages/client/firebaseSolApi/package.json | 2 +- packages/client/firebaseSolAuth/package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/client/firebaseApiUtils/package.json b/packages/client/firebaseApiUtils/package.json index 420fbbca9e..ad5a6b1bcc 100644 --- a/packages/client/firebaseApiUtils/package.json +++ b/packages/client/firebaseApiUtils/package.json @@ -3,7 +3,7 @@ "author": "Moralis", "version": "2.7.4", "license": "MIT", - "private": false, + "private": true, "main": "./lib/index.js", "types": "./lib/index.d.ts", "sideEffects": false, diff --git a/packages/client/firebaseAuthUtils/package.json b/packages/client/firebaseAuthUtils/package.json index ae5605330e..eb603f7b38 100644 --- a/packages/client/firebaseAuthUtils/package.json +++ b/packages/client/firebaseAuthUtils/package.json @@ -3,7 +3,7 @@ "author": "Moralis", "version": "2.7.4", "license": "MIT", - "private": true, + "private": false, "main": "./lib/index.js", "types": "./lib/index.d.ts", "sideEffects": false, diff --git a/packages/client/firebaseEvmApi/package.json b/packages/client/firebaseEvmApi/package.json index abda612f64..8e62597954 100644 --- a/packages/client/firebaseEvmApi/package.json +++ b/packages/client/firebaseEvmApi/package.json @@ -3,7 +3,7 @@ "author": "Moralis", "version": "2.7.4", "license": "MIT", - "private": false, + "private": true, "main": "./lib/index.js", "types": "./lib/index.d.ts", "sideEffects": false, diff --git a/packages/client/firebaseEvmAuth/package.json b/packages/client/firebaseEvmAuth/package.json index 43a2a172c9..2141dc8994 100644 --- a/packages/client/firebaseEvmAuth/package.json +++ b/packages/client/firebaseEvmAuth/package.json @@ -3,7 +3,7 @@ "author": "Moralis", "version": "2.7.4", "license": "MIT", - "private": true, + "private": false, "main": "./lib/index.js", "types": "./lib/index.d.ts", "sideEffects": false, diff --git a/packages/client/firebaseSolApi/package.json b/packages/client/firebaseSolApi/package.json index f3482fd880..a7fbd24359 100644 --- a/packages/client/firebaseSolApi/package.json +++ b/packages/client/firebaseSolApi/package.json @@ -3,7 +3,7 @@ "author": "Moralis", "version": "2.7.4", "license": "MIT", - "private": false, + "private": true, "main": "./lib/index.js", "types": "./lib/index.d.ts", "sideEffects": false, diff --git a/packages/client/firebaseSolAuth/package.json b/packages/client/firebaseSolAuth/package.json index 6967d2bfcb..03e77a9a17 100644 --- a/packages/client/firebaseSolAuth/package.json +++ b/packages/client/firebaseSolAuth/package.json @@ -3,7 +3,7 @@ "author": "Moralis", "version": "2.7.4", "license": "MIT", - "private": true, + "private": false, "main": "./lib/index.js", "types": "./lib/index.d.ts", "sideEffects": false,