diff --git a/lerna.json b/lerna.json index 93d75b8518..c228cfe62e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,7 @@ { - "version": "2.7.25-alpha.2", + "version": "2.7.25-alpha.7", "npmClient": "yarn", + "useNx": true, "packages": [ "packages/backend-core", "packages/bbui", @@ -16,7 +17,6 @@ "packages/worker", "packages/pro/packages/pro" ], - "useWorkspaces": true, "command": { "publish": { "ignoreChanges": [ diff --git a/package.json b/package.json index 56f015f8c0..03addbdab9 100644 --- a/package.json +++ b/package.json @@ -2,23 +2,22 @@ "name": "root", "private": true, "devDependencies": { - "@esbuild-plugins/node-resolve": "^0.2.2", "@esbuild-plugins/tsconfig-paths": "^0.1.2", "@nx/js": "16.2.1", "@rollup/plugin-json": "^4.0.2", "@typescript-eslint/parser": "5.45.0", "babel-eslint": "^10.0.3", "esbuild": "^0.17.18", + "esbuild-node-externals": "^1.7.0", "eslint": "^7.28.0", "eslint-plugin-cypress": "^2.11.3", "eslint-plugin-svelte3": "^3.2.0", "husky": "^8.0.3", "js-yaml": "^4.1.0", "kill-port": "^1.6.1", - "lerna": "7.0.0-alpha.0", + "lerna": "7.0.2", "madge": "^6.0.0", "minimist": "^1.2.8", - "nx": "^16.2.1", "prettier": "^2.3.1", "prettier-plugin-svelte": "^2.3.0", "rimraf": "^3.0.2", @@ -48,9 +47,9 @@ "kill-builder": "kill-port 3000", "kill-server": "kill-port 4001 4002", "kill-all": "yarn run kill-builder && yarn run kill-server", - "dev": "yarn run kill-all && lerna run --stream --parallel dev:builder --stream", - "dev:noserver": "yarn run kill-builder && lerna run --stream dev:stack:up && lerna run --stream --parallel dev:builder --ignore @budibase/backend-core --ignore @budibase/server --ignore @budibase/worker", - "dev:server": "yarn run kill-server && lerna run --stream --parallel dev:builder --scope @budibase/worker --scope @budibase/server", + "dev": "yarn run kill-all && lerna run --stream --parallel dev:builder --stream", + "dev:noserver": "yarn run kill-builder && lerna run --stream dev:stack:up && lerna run --stream --parallel dev:builder --ignore @budibase/backend-core --ignore @budibase/server --ignore @budibase/worker", + "dev:server": "yarn run kill-server && yarn build --projects=@budibase/client && lerna run --stream --parallel dev:builder --scope @budibase/worker --scope @budibase/server", "dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream --parallel dev:built", "dev:docker": "yarn build:docker:pre && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0", "test": "lerna run --stream test --stream", diff --git a/packages/backend-core/jest.config.ts b/packages/backend-core/jest.config.ts index 1e69797e71..8d64b24a2f 100644 --- a/packages/backend-core/jest.config.ts +++ b/packages/backend-core/jest.config.ts @@ -31,4 +31,6 @@ const config: Config.InitialOptions = { coverageReporters: ["lcov", "json", "clover"], } +process.env.DISABLE_PINO_LOGGER = "1" + export default config diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index f85687b007..4a1ed5c373 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -27,7 +27,7 @@ "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", "aws-sdk": "2.1030.0", - "bcrypt": "5.0.1", + "bcrypt": "5.1.0", "bcryptjs": "2.4.3", "bull": "4.10.1", "correlation-id": "4.0.0", diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index 9e055cd798..cf42668add 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -11,6 +11,7 @@ import TemplateCard from "components/common/TemplateCard.svelte" import createFromScratchScreen from "builderStore/store/screenTemplates/createFromScratchScreen" import { Roles } from "constants/backend" + import { lowercase } from "helpers" export let template @@ -19,6 +20,7 @@ const values = writable({ name: "", url: null }) const validation = createValidationStore() + const encryptionValidation = createValidationStore() $: { const { url } = $values @@ -27,8 +29,11 @@ ...$values, url: url?.[0] === "/" ? url.substring(1, url.length) : url, }) + encryptionValidation.check({ ...$values }) } + $: encryptedFile = $values.file?.name?.endsWith(".enc.tar.gz") + onMount(async () => { const lastChar = $auth.user?.firstName ? $auth.user?.firstName[$auth.user?.firstName.length - 1] @@ -87,6 +92,9 @@ appValidation.name(validation, { apps: applications }) appValidation.url(validation, { apps: applications }) appValidation.file(validation, { template }) + + encryptionValidation.addValidatorType("encryptionPassword", "text", true) + // init validation const { url } = $values validation.check({ @@ -110,6 +118,9 @@ data.append("templateName", template.name) data.append("templateKey", template.key) data.append("templateFile", $values.file) + if ($values.encryptionPassword?.trim()) { + data.append("encryptionPassword", $values.encryptionPassword.trim()) + } } // Create App @@ -143,67 +154,119 @@ $goto(`/builder/app/${createdApp.instance._id}`) } catch (error) { creating = false - console.error(error) - notifications.error("Error creating app") + throw error } } + + const Step = { CONFIG: "config", SET_PASSWORD: "set_password" } + let currentStep = Step.CONFIG + $: stepConfig = { + [Step.CONFIG]: { + title: "Create your app", + confirmText: template?.fromFile ? "Import app" : "Create app", + onConfirm: async () => { + if (encryptedFile) { + currentStep = Step.SET_PASSWORD + return false + } else { + try { + await createNewApp() + } catch (error) { + notifications.error("Error creating app") + } + } + }, + isValid: $validation.valid, + }, + [Step.SET_PASSWORD]: { + title: "Provide the export password", + confirmText: "Import app", + onConfirm: async () => { + try { + await createNewApp() + } catch (e) { + let message = "Error creating app" + if (e.message) { + message += `: ${lowercase(e.message)}` + } + notifications.error(message) + return false + } + }, + isValid: $encryptionValidation.valid, + }, + } - {#if template && !template?.fromFile} - - {/if} - {#if template?.fromFile} - { - $values.file = e.detail?.[0] - $validation.touched.file = true - }} - /> - {/if} - ($validation.touched.name = true)} - on:change={nameToUrl($values.name)} - label="Name" - placeholder={defaultAppName} - /> - - ($validation.touched.url = true)} - on:change={tidyUrl($values.url)} - label="URL" - placeholder={$values.url - ? $values.url - : `/${resolveAppUrl(template, $values.name)}`} - /> - {#if $values.url && $values.url !== "" && !$validation.errors.url} -
- {appUrl} -
+ {#if currentStep === Step.CONFIG} + {#if template && !template?.fromFile} + {/if} -
+ {#if template?.fromFile} + { + $values.file = e.detail?.[0] + $validation.touched.file = true + }} + /> + {/if} + ($validation.touched.name = true)} + on:change={nameToUrl($values.name)} + label="Name" + placeholder={defaultAppName} + /> + + ($validation.touched.url = true)} + on:change={tidyUrl($values.url)} + label="URL" + placeholder={$values.url + ? $values.url + : `/${resolveAppUrl(template, $values.name)}`} + /> + {#if $values.url && $values.url !== "" && !$validation.errors.url} +
+ {appUrl} +
+ {/if} +
+ {/if} + {#if currentStep === Step.SET_PASSWORD} + ($encryptionValidation.touched.encryptionPassword = true)} + error={$encryptionValidation.touched.encryptionPassword && + $encryptionValidation.errors.encryptionPassword} + /> + {/if}