diff --git a/.gitignore b/.gitignore index dcb1d822f0..24c031d958 100644 --- a/.gitignore +++ b/.gitignore @@ -38,7 +38,7 @@ bower_components build/Release # Dependency directories -node_modules/ +/node_modules/ jspm_packages/ # TypeScript v1 declaration files diff --git a/packages/builder/.gitignore b/packages/builder/.gitignore index 328f7f0f3c..6e90239f92 100644 --- a/packages/builder/.gitignore +++ b/packages/builder/.gitignore @@ -1,5 +1,5 @@ .DS_Store -node_modules +/node_modules/ node_modules_win package-lock.json yarn.lock diff --git a/packages/builder/package.json b/packages/builder/package.json index 9f4003cb8c..8d9c07c204 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -5,10 +5,11 @@ "private": true, "scripts": { "build": "rollup -c", - "start": "rollup -c -w", + "start": "routify -c rollup", "test": "jest", "test:watch": "jest --watchAll", - "dev:builder": "rollup -c -w" + "dev:builder": "routify -c rollup", + "rollup": "rollup -c -w" }, "jest": { "globals": { @@ -19,7 +20,9 @@ "testURL": "http://jest-breaks-if-this-does-not-exist", "moduleNameMapper": { "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/internals/mocks/fileMock.js", - "\\.(css|less|sass|scss)$": "identity-obj-proxy" + "\\.(css|less|sass|scss)$": "identity-obj-proxy", + "components(.*)$": "/src/components$1", + "builderStore(.*)$": "/src/builderStore$1" }, "moduleFileExtensions": [ "js" @@ -54,6 +57,8 @@ "@babel/plugin-transform-runtime": "^7.5.5", "@babel/preset-env": "^7.5.5", "@babel/runtime": "^7.5.5", + "@rollup/plugin-alias": "^3.0.1", + "@sveltech/routify": "1.5.0-beta.16", "babel-jest": "^24.8.0", "browser-sync": "^2.26.7", "http-proxy-middleware": "^0.19.1", @@ -75,4 +80,4 @@ "svelte": "^3.0.0" }, "gitHead": "115189f72a850bfb52b65ec61d932531bf327072" -} +} \ No newline at end of file diff --git a/packages/builder/rollup.config.js b/packages/builder/rollup.config.js index 9986e39fd5..518482b645 100644 --- a/packages/builder/rollup.config.js +++ b/packages/builder/rollup.config.js @@ -1,3 +1,4 @@ +import alias from "@rollup/plugin-alias" import svelte from "rollup-plugin-svelte" import resolve from "rollup-plugin-node-resolve" import commonjs from "rollup-plugin-commonjs" @@ -11,6 +12,8 @@ import browsersync from "rollup-plugin-browsersync" import proxy from "http-proxy-middleware" import replace from "rollup-plugin-replace" +import path from "path" + const target = "http://localhost:4001" const _builderProxy = proxy("/_builder", { target: "http://localhost:3000", @@ -142,6 +145,11 @@ const coreExternal = [ "@nx-js/compiler-util", ] +const customResolver = resolve({ + extensions: [".mjs", ".js", ".jsx", ".json", ".sass", ".scss", ".svelte"] +}) +const projectRootDir = path.resolve(__dirname) + export default { input: "src/main.js", output: { @@ -151,9 +159,16 @@ export default { file: `${outputpath}/bundle.js`, }, plugins: [ + alias({ + entries: [ + { find: "components", replacement: path.resolve(projectRootDir, 'src/components') }, + { find: "builderStore", replacement: path.resolve(projectRootDir, 'src/builderStore') } + ], + customResolver + }), copy({ targets: [ - { src: "src/index.html", dest: outputpath }, + { src: "src/index.html", dest: outputpath, rename: "__app.html" }, { src: "src/favicon.png", dest: outputpath }, { src: "src/assets", dest: outputpath }, { @@ -216,10 +231,10 @@ export default { // browser on changes when not in production !production && livereload(outputpath), !production && - browsersync({ - server: outputpath, - middleware: [apiProxy, _builderProxy], - }), + browsersync({ + server: outputpath, + middleware: [apiProxy, _builderProxy], + }), // If we're building for production (npm run build // instead of npm run dev), minify @@ -229,3 +244,20 @@ export default { clearScreen: false, }, } + +function serve() { + let started = false + + return { + writeBundle() { + if (!started) { + started = true + + require("child_process").spawn("npm", ["run", "start"], { + stdio: ["ignore", "inherit", "inherit"], + shell: true, + }) + } + }, + } +} \ No newline at end of file diff --git a/packages/builder/src/App.svelte b/packages/builder/src/App.svelte index 870d057ace..424c7b9a1e 100644 --- a/packages/builder/src/App.svelte +++ b/packages/builder/src/App.svelte @@ -2,11 +2,13 @@ import NoPackage from "./NoPackage.svelte" import PackageRoot from "./PackageRoot.svelte" import Settings from "./Settings.svelte" - import { store, initialise } from "./builderStore" + import { store, initialise } from "builderStore" import { onMount } from "svelte" - import IconButton from "./common/IconButton.svelte" - import Spinner from "./common/Spinner.svelte" - import AppNotification, { showAppNotification } from "./common/AppNotification.svelte" + import IconButton from "components/common/IconButton.svelte" + import Spinner from "components/common/Spinner.svelte" + import AppNotification, { + showAppNotification, + } from "components/common/AppNotification.svelte" let init = initialise() diff --git a/packages/builder/src/BackendRoot.svelte b/packages/builder/src/BackendRoot.svelte index d37e774a96..48b612790b 100644 --- a/packages/builder/src/BackendRoot.svelte +++ b/packages/builder/src/BackendRoot.svelte @@ -1,13 +1,13 @@
diff --git a/packages/builder/src/NoPackage.svelte b/packages/builder/src/NoPackage.svelte index f3cfe6a857..c15df26036 100644 --- a/packages/builder/src/NoPackage.svelte +++ b/packages/builder/src/NoPackage.svelte @@ -1,6 +1,6 @@ diff --git a/packages/builder/src/PackageRoot.svelte b/packages/builder/src/PackageRoot.svelte index f7a134ed9a..71660ec2e8 100644 --- a/packages/builder/src/PackageRoot.svelte +++ b/packages/builder/src/PackageRoot.svelte @@ -1,10 +1,10 @@ diff --git a/packages/builder/src/builderStore/createPackage.js b/packages/builder/src/builderStore/createPackage.js index c67585af68..d4f4a9e54b 100644 --- a/packages/builder/src/builderStore/createPackage.js +++ b/packages/builder/src/builderStore/createPackage.js @@ -1,4 +1,4 @@ -import { createNewHierarchy } from "../common/core" +import { createNewHierarchy } from "components/common/core" export const createPackage = (packageInfo, store) => { packageInfo.createNewPackage("") diff --git a/packages/builder/src/builderStore/generate_css.js b/packages/builder/src/builderStore/generate_css.js index 19148ce9b0..0f776a5255 100644 --- a/packages/builder/src/builderStore/generate_css.js +++ b/packages/builder/src/builderStore/generate_css.js @@ -1,5 +1,5 @@ import { filter, map, reduce, toPairs } from "lodash/fp" -import { pipe } from "../common/core" +import { pipe } from "components/common/core" const self = n => n const join_with = delimiter => a => a.join(delimiter) diff --git a/packages/builder/src/builderStore/loadComponentLibraries.js b/packages/builder/src/builderStore/loadComponentLibraries.js index 5a142f2798..8534bcf177 100644 --- a/packages/builder/src/builderStore/loadComponentLibraries.js +++ b/packages/builder/src/builderStore/loadComponentLibraries.js @@ -1,5 +1,5 @@ import { flatten, values, uniq, map } from "lodash/fp" -import { pipe } from "../common/core" +import { pipe } from "components/common/core" export const loadLibs = async (appName, appPackage) => { const allLibraries = {} diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 9f6eb25d63..b4a10fec13 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -10,7 +10,7 @@ import { isIndex, canDeleteIndex, canDeleteRecord, -} from "../../common/core" +} from "components/common/core" export const getBackendUiStore = () => { const INITIAL_BACKEND_UI_STATE = { @@ -100,9 +100,9 @@ export const saveBackend = async state => { const instances_currentFirst = state.selectedDatabase ? [ - state.appInstances.find(i => i.id === state.selectedDatabase.id), - ...state.appInstances.filter(i => i.id !== state.selectedDatabase.id), - ] + state.appInstances.find(i => i.id === state.selectedDatabase.id), + ...state.appInstances.filter(i => i.id !== state.selectedDatabase.id), + ] : state.appInstances for (let instance of instances_currentFirst) { diff --git a/packages/builder/src/builderStore/store/index.js b/packages/builder/src/builderStore/store/index.js index 41230bcaf4..76cdc5a7c3 100644 --- a/packages/builder/src/builderStore/store/index.js +++ b/packages/builder/src/builderStore/store/index.js @@ -1,18 +1,18 @@ import { filter, cloneDeep, last, concat, isEmpty, values } from "lodash/fp" -import { pipe, getNode, constructHierarchy } from "../../common/core" +import { pipe, getNode, constructHierarchy } from "components/common/core" import * as backendStoreActions from "./backend" import { writable } from "svelte/store" -import { defaultPagesObject } from "../../userInterface/pagesParsing/defaultPagesObject" +import { defaultPagesObject } from "components/userInterface/pagesParsing/defaultPagesObject" import api from "../api" -import { getExactComponent } from "../../userInterface/pagesParsing/searchComponents" -import { rename } from "../../userInterface/pagesParsing/renameScreen" +import { getExactComponent } from "components/userInterface/pagesParsing/searchComponents" +import { rename } from "components/userInterface/pagesParsing/renameScreen" import { getNewScreen, createProps, makePropsSafe, getBuiltin, -} from "../../userInterface/pagesParsing/createProps" -import { expandComponentDefinition } from "../../userInterface/pagesParsing/types" +} from "components/userInterface/pagesParsing/createProps" +import { expandComponentDefinition } from "components/userInterface/pagesParsing/types" import { loadLibs, libUrlsForPreview } from "../loadComponentLibraries" import { buildCodeForScreens } from "../buildCodeForScreens" import { generate_screen_css } from "../generate_css" diff --git a/packages/builder/src/accessLevels/AccessLevelView.svelte b/packages/builder/src/components/accessLevels/AccessLevelView.svelte similarity index 100% rename from packages/builder/src/accessLevels/AccessLevelView.svelte rename to packages/builder/src/components/accessLevels/AccessLevelView.svelte diff --git a/packages/builder/src/accessLevels/AccessLevelsRoot.svelte b/packages/builder/src/components/accessLevels/AccessLevelsRoot.svelte similarity index 85% rename from packages/builder/src/accessLevels/AccessLevelsRoot.svelte rename to packages/builder/src/components/accessLevels/AccessLevelsRoot.svelte index 8d57d83f2b..f53afae5f6 100644 --- a/packages/builder/src/accessLevels/AccessLevelsRoot.svelte +++ b/packages/builder/src/components/accessLevels/AccessLevelsRoot.svelte @@ -1,12 +1,15 @@ + +
+ +
diff --git a/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte similarity index 88% rename from packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte rename to packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte index 25837db018..99c7e78116 100644 --- a/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte @@ -1,18 +1,18 @@
diff --git a/packages/builder/src/nav/DatabasesList.svelte b/packages/builder/src/components/nav/DatabasesList.svelte similarity index 93% rename from packages/builder/src/nav/DatabasesList.svelte rename to packages/builder/src/components/nav/DatabasesList.svelte index c6607d2844..702e433c9a 100644 --- a/packages/builder/src/nav/DatabasesList.svelte +++ b/packages/builder/src/components/nav/DatabasesList.svelte @@ -1,7 +1,7 @@ diff --git a/packages/builder/src/nav/HierarchyRow.svelte b/packages/builder/src/components/nav/HierarchyRow.svelte similarity index 95% rename from packages/builder/src/nav/HierarchyRow.svelte rename to packages/builder/src/components/nav/HierarchyRow.svelte index fe80186ff2..247c626d1b 100644 --- a/packages/builder/src/nav/HierarchyRow.svelte +++ b/packages/builder/src/components/nav/HierarchyRow.svelte @@ -1,6 +1,6 @@ - -
- -
diff --git a/packages/builder/src/pages/_[application]/_layout.svelte b/packages/builder/src/pages/_[application]/_layout.svelte new file mode 100644 index 0000000000..a6df5958ed --- /dev/null +++ b/packages/builder/src/pages/_[application]/_layout.svelte @@ -0,0 +1,159 @@ + + +
+ +
+
+ + + + {#each list as { path, prettyName, children, meta }} + $goto($url(path))}> + {prettyName} + + {/each} + +
+
+ $goto(`${component.parent.path}/settings`)}> + + + console.log}> + + +
+
+ + + +
+ + diff --git a/packages/builder/src/pages/_[application]/backend/_layout.svelte b/packages/builder/src/pages/_[application]/backend/_layout.svelte new file mode 100644 index 0000000000..58452ee636 --- /dev/null +++ b/packages/builder/src/pages/_[application]/backend/_layout.svelte @@ -0,0 +1,48 @@ + + +
+ +
+ + +
+ +
+ + diff --git a/packages/builder/src/pages/_[application]/backend/actions/index.svelte b/packages/builder/src/pages/_[application]/backend/actions/index.svelte new file mode 100644 index 0000000000..b527bb251a --- /dev/null +++ b/packages/builder/src/pages/_[application]/backend/actions/index.svelte @@ -0,0 +1,134 @@ + + +
+
+ + + Create New Action + + + Create New Trigger + + +
+ +
+ + + +
+ +
+ + diff --git a/packages/builder/src/pages/_[application]/backend/database/index.svelte b/packages/builder/src/pages/_[application]/backend/database/index.svelte new file mode 100644 index 0000000000..2724e8045a --- /dev/null +++ b/packages/builder/src/pages/_[application]/backend/database/index.svelte @@ -0,0 +1,96 @@ + + + + {#if recordOpen} + + {/if} + {#if modelOpen} + + {/if} + {#if viewOpen} + + {/if} + {#if databaseOpen} + + {/if} + {#if deleteRecordOpen} + + {/if} + {#if userOpen} + + {/if} + + +
+
+
+
{breadcrumbs}
+ {#if $backendUiStore.selectedDatabase.id} + { + selectedRecord = null + backendUiStore.actions.modals.show('RECORD') + }}> + Create new record + + {/if} +
+ {#if $backendUiStore.selectedDatabase.id} + + {:else}Please select a database{/if} +
+
+ + diff --git a/packages/builder/src/pages/_[application]/backend/index.svelte b/packages/builder/src/pages/_[application]/backend/index.svelte new file mode 100644 index 0000000000..09345bc127 --- /dev/null +++ b/packages/builder/src/pages/_[application]/backend/index.svelte @@ -0,0 +1,6 @@ + + + diff --git a/packages/builder/src/pages/_[application]/frontend/_layout.svelte b/packages/builder/src/pages/_[application]/frontend/_layout.svelte new file mode 100644 index 0000000000..0385342cef --- /dev/null +++ b/packages/builder/src/pages/_[application]/frontend/_layout.svelte @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/builder/src/pages/_[application]/frontend/index.svelte b/packages/builder/src/pages/_[application]/frontend/index.svelte new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/builder/src/pages/_[application]/index.svelte b/packages/builder/src/pages/_[application]/index.svelte new file mode 100644 index 0000000000..25636f83f1 --- /dev/null +++ b/packages/builder/src/pages/_[application]/index.svelte @@ -0,0 +1,6 @@ + + + diff --git a/packages/builder/src/pages/_[application]/settings/_layout.svelte b/packages/builder/src/pages/_[application]/settings/_layout.svelte new file mode 100644 index 0000000000..43a188a476 --- /dev/null +++ b/packages/builder/src/pages/_[application]/settings/_layout.svelte @@ -0,0 +1,2 @@ + + diff --git a/packages/builder/src/pages/_[application]/settings/index.svelte b/packages/builder/src/pages/_[application]/settings/index.svelte new file mode 100644 index 0000000000..163d304af4 --- /dev/null +++ b/packages/builder/src/pages/_[application]/settings/index.svelte @@ -0,0 +1 @@ +Settings diff --git a/packages/builder/src/pages/index.svelte b/packages/builder/src/pages/index.svelte new file mode 100644 index 0000000000..004280071b --- /dev/null +++ b/packages/builder/src/pages/index.svelte @@ -0,0 +1,68 @@ + + +
+ + {#await promise} +
+ +
+ {:then result} + + {:catch err} +

{err}

+ {/await} + + +
+ + diff --git a/packages/builder/tests/componentDependencies.spec.js b/packages/builder/tests/componentDependencies.spec.js index 267f395b2a..45cd891699 100644 --- a/packages/builder/tests/componentDependencies.spec.js +++ b/packages/builder/tests/componentDependencies.spec.js @@ -1,4 +1,4 @@ -import { componentDependencies } from "../src/userInterface/pagesParsing/findDependencies" +import { componentDependencies } from "../src/components/userInterface/pagesParsing/findDependencies" import { componentsAndScreens } from "./testData" import { some, find } from "lodash/fp" diff --git a/packages/builder/tests/createProps.spec.js b/packages/builder/tests/createProps.spec.js index 7acfa38b48..7ef13e5062 100644 --- a/packages/builder/tests/createProps.spec.js +++ b/packages/builder/tests/createProps.spec.js @@ -1,4 +1,4 @@ -import { createProps } from "../src/userInterface/pagesParsing/createProps" +import { createProps } from "../src/components/userInterface/pagesParsing/createProps" import { keys, some } from "lodash/fp" import { BB_STATE_BINDINGPATH } from "@budibase/client/src/state/parseBinding" import { stripStandardProps } from "./testData" diff --git a/packages/builder/tests/expandPropDef.spec.js b/packages/builder/tests/expandPropDef.spec.js index 08c3eb3327..a46aa368e1 100644 --- a/packages/builder/tests/expandPropDef.spec.js +++ b/packages/builder/tests/expandPropDef.spec.js @@ -1,4 +1,4 @@ -import { expandComponentDefinition } from "../src/userInterface/pagesParsing/types" +import { expandComponentDefinition } from "../src/components/userInterface/pagesParsing/types" const componentDef = () => ({ name: "comp", diff --git a/packages/builder/tests/getNewScreen.spec.js b/packages/builder/tests/getNewScreen.spec.js index 04f58c2c0c..6614753eab 100644 --- a/packages/builder/tests/getNewScreen.spec.js +++ b/packages/builder/tests/getNewScreen.spec.js @@ -1,4 +1,4 @@ -import { getNewScreen } from "../src/userInterface/pagesParsing/createProps" +import { getNewScreen } from "../src/components/userInterface/pagesParsing/createProps" import { componentsAndScreens, stripStandardProps } from "./testData" describe("geNewScreen", () => { diff --git a/packages/builder/tests/renameScreen.spec.js b/packages/builder/tests/renameScreen.spec.js index 8f5aea2109..9091c029ce 100644 --- a/packages/builder/tests/renameScreen.spec.js +++ b/packages/builder/tests/renameScreen.spec.js @@ -1,5 +1,5 @@ -import { getExactComponent } from "../src/userInterface/pagesParsing/searchComponents" -import { rename } from "../src/userInterface/pagesParsing/renameScreen" +import { getExactComponent } from "../src/components/userInterface/pagesParsing/searchComponents" +import { rename } from "../src/components/userInterface/pagesParsing/renameScreen" import { componentsAndScreens } from "./testData" describe("rename component", () => { diff --git a/packages/builder/tests/searchComponentsProps.spec.js b/packages/builder/tests/searchComponentsProps.spec.js index e81d1c2533..65f05b064e 100644 --- a/packages/builder/tests/searchComponentsProps.spec.js +++ b/packages/builder/tests/searchComponentsProps.spec.js @@ -2,7 +2,7 @@ import { searchAllComponents, getExactComponent, getAncestorProps, -} from "../src/userInterface/pagesParsing/searchComponents" +} from "../src/components/userInterface/pagesParsing/searchComponents" import { componentsAndScreens } from "./testData" describe("searchAllComponents", () => { diff --git a/packages/builder/tests/validatePages.spec.js b/packages/builder/tests/validatePages.spec.js index deb86d84ad..695ee51259 100644 --- a/packages/builder/tests/validatePages.spec.js +++ b/packages/builder/tests/validatePages.spec.js @@ -1,7 +1,7 @@ import { validatePages, validatePage, -} from "../src/userInterface/pagesParsing/validatePages" +} from "../src/components/userInterface/pagesParsing/validatePages" const validPages = () => ({ main: { diff --git a/packages/cli/.gitignore b/packages/cli/.gitignore index 76507387b6..d0c97ab594 100644 --- a/packages/cli/.gitignore +++ b/packages/cli/.gitignore @@ -1 +1,2 @@ -sandbox/ \ No newline at end of file +sandbox/ +node_modules/ \ No newline at end of file diff --git a/packages/datastores/.gitignore b/packages/datastores/.gitignore new file mode 100644 index 0000000000..096746c148 --- /dev/null +++ b/packages/datastores/.gitignore @@ -0,0 +1 @@ +/node_modules/ \ No newline at end of file diff --git a/packages/server/.gitignore b/packages/server/.gitignore index 4e5f6256f0..cf08d58354 100644 --- a/packages/server/.gitignore +++ b/packages/server/.gitignore @@ -1,3 +1,4 @@ +node_modules/ myapps/ config.js /builder/*