diff --git a/lerna.json b/lerna.json index 91817f6b3e..6b8eaa45b2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index f6cb47bc8b..627cd16f8c 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,11 +20,12 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "1.3.15-alpha.5", + "@budibase/types": "1.3.15-alpha.7", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", + "bcryptjs": "2.4.3", "dotenv": "16.0.1", "emitter-listener": "1.1.2", "ioredis": "4.28.0", diff --git a/packages/backend-core/src/environment.ts b/packages/backend-core/src/environment.ts index 04d09d2eb7..b979635fcc 100644 --- a/packages/backend-core/src/environment.ts +++ b/packages/backend-core/src/environment.ts @@ -19,6 +19,7 @@ if (!LOADED && isDev() && !isTest()) { const env = { isTest, isDev, + JS_BCRYPT: process.env.JS_BCRYPT, JWT_SECRET: process.env.JWT_SECRET, COUCH_DB_URL: process.env.COUCH_DB_URL || "http://localhost:4005", COUCH_DB_USERNAME: process.env.COUCH_DB_USER, diff --git a/packages/backend-core/src/hashing.js b/packages/backend-core/src/hashing.js index 45abe2f9bd..7524e66043 100644 --- a/packages/backend-core/src/hashing.js +++ b/packages/backend-core/src/hashing.js @@ -1,5 +1,5 @@ -const bcrypt = require("bcrypt") const env = require("./environment") +const bcrypt = env.JS_BCRYPT ? require("bcryptjs") : require("bcrypt") const { v4 } = require("uuid") const SALT_ROUNDS = env.SALT_ROUNDS || 10 diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 3d09ad9ba0..da52ae0084 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "1.3.15-alpha.5", + "@budibase/string-templates": "1.3.15-alpha.7", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 0110889593..33ad9c46a8 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "1.3.15-alpha.5", - "@budibase/client": "1.3.15-alpha.5", - "@budibase/frontend-core": "1.3.15-alpha.5", - "@budibase/string-templates": "1.3.15-alpha.5", + "@budibase/bbui": "1.3.15-alpha.7", + "@budibase/client": "1.3.15-alpha.7", + "@budibase/frontend-core": "1.3.15-alpha.7", + "@budibase/string-templates": "1.3.15-alpha.7", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 06fc5181a8..341cc8604a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "1.3.15-alpha.5", - "@budibase/string-templates": "1.3.15-alpha.5", - "@budibase/types": "1.3.15-alpha.5", + "@budibase/backend-core": "1.3.15-alpha.7", + "@budibase/string-templates": "1.3.15-alpha.7", + "@budibase/types": "1.3.15-alpha.7", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/cli/src/environment.js b/packages/cli/src/environment.js index a42eceb07e..c8c8fe87e9 100644 --- a/packages/cli/src/environment.js +++ b/packages/cli/src/environment.js @@ -1 +1,2 @@ process.env.NO_JS = "1" +process.env.JS_BCRYPT = "1" diff --git a/packages/cli/src/plugins/index.js b/packages/cli/src/plugins/index.js index 714187df56..d184c6e70a 100644 --- a/packages/cli/src/plugins/index.js +++ b/packages/cli/src/plugins/index.js @@ -7,7 +7,7 @@ const { PLUGIN_TYPE_ARR } = require("@budibase/types") const { validate } = require("@budibase/backend-core/plugins") const { runPkgCommand } = require("../exec") const { join } = require("path") -const { success, error, info } = require("../utils") +const { success, error, info, moveDirectory } = require("../utils") function checkInPlugin() { if (!fs.existsSync("package.json")) { @@ -22,6 +22,24 @@ function checkInPlugin() { } } +async function askAboutTopLevel(name) { + const files = fs.readdirSync(process.cwd()) + // we are in an empty git repo, don't ask + if (files.find(file => file === ".git")) { + return false + } else { + console.log( + info(`By default the plugin will be created in the directory "${name}"`) + ) + console.log( + info( + "if you are already in an empty directory, such as a new Git repo, you can disable this functionality." + ) + ) + return questions.confirmation("Create top level directory?") + } +} + async function init(opts) { const type = opts["init"] || opts if (!type || !PLUGIN_TYPE_ARR.includes(type)) { @@ -45,13 +63,20 @@ async function init(opts) { `An amazing Budibase ${type}!` ) const version = await questions.string("Version", "1.0.0") + const topLevel = await askAboutTopLevel(name) // get the skeleton console.log(info("Retrieving project...")) await getSkeleton(type, name) await fleshOutSkeleton(type, name, desc, version) console.log(info("Installing dependencies...")) await runPkgCommand("install", join(process.cwd(), name)) - console.log(info(`Plugin created in directory "${name}"`)) + // if no parent directory desired move to cwd + if (!topLevel) { + moveDirectory(name, process.cwd()) + console.log(info(`Plugin created in current directory.`)) + } else { + console.log(info(`Plugin created in directory "${name}"`)) + } } async function verify() { diff --git a/packages/cli/src/prebuilds.js b/packages/cli/src/prebuilds.js index b582b090e7..0decdc6c63 100644 --- a/packages/cli/src/prebuilds.js +++ b/packages/cli/src/prebuilds.js @@ -27,7 +27,10 @@ function checkForBinaries() { } function cleanup(evt) { - if (evt && evt.errno) { + if (!isNaN(evt)) { + return + } + if (evt) { console.error( error( "Failed to run CLI command - please report with the following message:" diff --git a/packages/cli/src/utils.js b/packages/cli/src/utils.js index 818153ef02..91f3263cc1 100644 --- a/packages/cli/src/utils.js +++ b/packages/cli/src/utils.js @@ -3,6 +3,7 @@ const fs = require("fs") const axios = require("axios") const path = require("path") const progress = require("cli-progress") +const { join } = require("path") exports.downloadFile = async (url, filePath) => { filePath = path.resolve(filePath) @@ -67,3 +68,19 @@ exports.progressBar = total => { exports.checkSlashesInUrl = url => { return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2") } + +exports.moveDirectory = (oldPath, newPath) => { + const files = fs.readdirSync(oldPath) + // check any file exists already + for (let file of files) { + if (fs.existsSync(join(newPath, file))) { + throw new Error( + "Unable to remove top level directory - some skeleton files already exist." + ) + } + } + for (let file of files) { + fs.renameSync(join(oldPath, file), join(newPath, file)) + } + fs.rmdirSync(oldPath) +} diff --git a/packages/client/package.json b/packages/client/package.json index b98db72be4..dad087808b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "1.3.15-alpha.5", - "@budibase/frontend-core": "1.3.15-alpha.5", - "@budibase/string-templates": "1.3.15-alpha.5", + "@budibase/bbui": "1.3.15-alpha.7", + "@budibase/frontend-core": "1.3.15-alpha.7", + "@budibase/string-templates": "1.3.15-alpha.7", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 703faeda4f..c51dc4dc05 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "1.3.15-alpha.5", + "@budibase/bbui": "1.3.15-alpha.7", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 83cee17797..fbda6c9649 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "1.3.15-alpha.5", - "@budibase/client": "1.3.15-alpha.5", - "@budibase/pro": "1.3.15-alpha.5", - "@budibase/string-templates": "1.3.15-alpha.5", - "@budibase/types": "1.3.15-alpha.5", + "@budibase/backend-core": "1.3.15-alpha.7", + "@budibase/client": "1.3.15-alpha.7", + "@budibase/pro": "1.3.15-alpha.7", + "@budibase/string-templates": "1.3.15-alpha.7", + "@budibase/types": "1.3.15-alpha.7", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 6775646a4e..180833b456 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,16 +1094,17 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.3.15-alpha.5": - version "1.3.15-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.15-alpha.5.tgz#667233d65d6e2811ef97b77608770bd8def53670" - integrity sha512-bPt1wFQDbrcsrMsUPXqwNoe8mNgwZqnD4eDUmnKocUIy6EZJDiGoQ6qHz+y1NGZR/SORrP/QdFCsBPw1oixGfA== +"@budibase/backend-core@1.3.15-alpha.7": + version "1.3.15-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.15-alpha.7.tgz#322e842c9371c807f89b71ee2aed4ab4479b6d27" + integrity sha512-eymmLjHhEzBQEztmVRqLpAw4YzZ4xDBAtA1lnJ50AZs/ZlHE+W4BR6LX2jGvIhYK2QDGbNQtXDzkut+0Sacj0w== dependencies: - "@budibase/types" "1.3.15-alpha.5" + "@budibase/types" "1.3.15-alpha.7" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" + bcryptjs "2.4.3" dotenv "16.0.1" emitter-listener "1.1.2" ioredis "4.28.0" @@ -1179,13 +1180,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.3.15-alpha.5": - version "1.3.15-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.15-alpha.5.tgz#6faad4cead27c65bfb52cbf9cda3bc55618e8c66" - integrity sha512-czMMfxM8p+toG18C++2qu2V1qiluwYGvij/v3gJFPu/HMEM3pD/eng84M2AgPCQTJunkknCFoi0fy/N9nIa4KQ== +"@budibase/pro@1.3.15-alpha.7": + version "1.3.15-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.15-alpha.7.tgz#3743a26fb99d58070c8ab2741ee912a4d973baf7" + integrity sha512-RerlV0A6wSU3mSOtY5ET4WR5Qaga1WNfUeG8Lqzx3z09vC23YuB0qvpadpKoUKUanzCyprrU4zBrLED8973stQ== dependencies: - "@budibase/backend-core" "1.3.15-alpha.5" - "@budibase/types" "1.3.15-alpha.5" + "@budibase/backend-core" "1.3.15-alpha.7" + "@budibase/types" "1.3.15-alpha.7" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1208,10 +1209,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.3.15-alpha.5": - version "1.3.15-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.15-alpha.5.tgz#fa5da711f8b026e1dd4edcc38e0d40e2d4a76352" - integrity sha512-H8JCIKIGS/ybrogPuZtu49vhI/oMZ8dqRIBoRx1evxtehV7BEkHeDSSduHsX/qsUtpfw1ZyPb6aWO6RHLbRSFg== +"@budibase/types@1.3.15-alpha.7": + version "1.3.15-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.15-alpha.7.tgz#c69a38194786ea66a2c6137aa961292902472ee9" + integrity sha512-9XW5Qr0FxXRO5rC1SlwS8dcDDPYGEG5+tJcrQ0gzk+5uzQfYIB/crhB0z++9vAwkBEm09XKbjBvdf4w5haEi2w== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 5638428f37..b294b95d8a 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 28189ce35e..0b195ba541 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index de305f7a33..1d5967b14e 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.3.15-alpha.5", + "version": "1.3.15-alpha.7", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "1.3.15-alpha.5", - "@budibase/pro": "1.3.15-alpha.5", - "@budibase/string-templates": "1.3.15-alpha.5", - "@budibase/types": "1.3.15-alpha.5", + "@budibase/backend-core": "1.3.15-alpha.7", + "@budibase/pro": "1.3.15-alpha.7", + "@budibase/string-templates": "1.3.15-alpha.7", + "@budibase/types": "1.3.15-alpha.7", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index e203e05b19..dc60272795 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,16 +291,17 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.3.15-alpha.5": - version "1.3.15-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.15-alpha.5.tgz#667233d65d6e2811ef97b77608770bd8def53670" - integrity sha512-bPt1wFQDbrcsrMsUPXqwNoe8mNgwZqnD4eDUmnKocUIy6EZJDiGoQ6qHz+y1NGZR/SORrP/QdFCsBPw1oixGfA== +"@budibase/backend-core@1.3.15-alpha.7": + version "1.3.15-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.15-alpha.7.tgz#322e842c9371c807f89b71ee2aed4ab4479b6d27" + integrity sha512-eymmLjHhEzBQEztmVRqLpAw4YzZ4xDBAtA1lnJ50AZs/ZlHE+W4BR6LX2jGvIhYK2QDGbNQtXDzkut+0Sacj0w== dependencies: - "@budibase/types" "1.3.15-alpha.5" + "@budibase/types" "1.3.15-alpha.7" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" + bcryptjs "2.4.3" dotenv "16.0.1" emitter-listener "1.1.2" ioredis "4.28.0" @@ -326,21 +327,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.3.15-alpha.5": - version "1.3.15-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.15-alpha.5.tgz#6faad4cead27c65bfb52cbf9cda3bc55618e8c66" - integrity sha512-czMMfxM8p+toG18C++2qu2V1qiluwYGvij/v3gJFPu/HMEM3pD/eng84M2AgPCQTJunkknCFoi0fy/N9nIa4KQ== +"@budibase/pro@1.3.15-alpha.7": + version "1.3.15-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.15-alpha.7.tgz#3743a26fb99d58070c8ab2741ee912a4d973baf7" + integrity sha512-RerlV0A6wSU3mSOtY5ET4WR5Qaga1WNfUeG8Lqzx3z09vC23YuB0qvpadpKoUKUanzCyprrU4zBrLED8973stQ== dependencies: - "@budibase/backend-core" "1.3.15-alpha.5" - "@budibase/types" "1.3.15-alpha.5" + "@budibase/backend-core" "1.3.15-alpha.7" + "@budibase/types" "1.3.15-alpha.7" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.3.15-alpha.5": - version "1.3.15-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.15-alpha.5.tgz#fa5da711f8b026e1dd4edcc38e0d40e2d4a76352" - integrity sha512-H8JCIKIGS/ybrogPuZtu49vhI/oMZ8dqRIBoRx1evxtehV7BEkHeDSSduHsX/qsUtpfw1ZyPb6aWO6RHLbRSFg== +"@budibase/types@1.3.15-alpha.7": + version "1.3.15-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.15-alpha.7.tgz#c69a38194786ea66a2c6137aa961292902472ee9" + integrity sha512-9XW5Qr0FxXRO5rC1SlwS8dcDDPYGEG5+tJcrQ0gzk+5uzQfYIB/crhB0z++9vAwkBEm09XKbjBvdf4w5haEi2w== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0"