From dbb151e86e577defe13339aba97873e292154ecb Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Wed, 19 Feb 2020 13:26:45 +0000 Subject: [PATCH 1/3] template app - includes MD by default --- .../commands/new/appPackageTemplate/package.json | 3 ++- .../commands/new/appPackageTemplate/pages.json | 14 -------------- .../new/appPackageTemplate/pages/main/page.json | 2 +- .../pages/unauthenticated/page.json | 2 +- packages/materialdesign-components/package.json | 2 +- .../scripts/publishDev.js | 15 +++++++++++---- 6 files changed, 16 insertions(+), 22 deletions(-) delete mode 100644 packages/cli/src/commands/new/appPackageTemplate/pages.json diff --git a/packages/cli/src/commands/new/appPackageTemplate/package.json b/packages/cli/src/commands/new/appPackageTemplate/package.json index a0f58b7239..53db27f272 100644 --- a/packages/cli/src/commands/new/appPackageTemplate/package.json +++ b/packages/cli/src/commands/new/appPackageTemplate/package.json @@ -8,6 +8,7 @@ "author": "", "license": "ISC", "dependencies": { - "@budibase/standard-components": "^0.0.3" + "@budibase/standard-components": "^0.0.3", + "@budibase/materialdesign-components": "^0.0.16" } } diff --git a/packages/cli/src/commands/new/appPackageTemplate/pages.json b/packages/cli/src/commands/new/appPackageTemplate/pages.json deleted file mode 100644 index 5c0076fe4b..0000000000 --- a/packages/cli/src/commands/new/appPackageTemplate/pages.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "main": { - "index": {}, - "appBody": "" - }, - "unauthenticated": { - "index": {}, - "appBody": "" - }, - "componentLibraries": [ - "@budibase/standard-components" - ], - "stylesheets": [] -} diff --git a/packages/cli/src/commands/new/appPackageTemplate/pages/main/page.json b/packages/cli/src/commands/new/appPackageTemplate/pages/main/page.json index c725d5bdf6..89a23a78e5 100644 --- a/packages/cli/src/commands/new/appPackageTemplate/pages/main/page.json +++ b/packages/cli/src/commands/new/appPackageTemplate/pages/main/page.json @@ -2,7 +2,7 @@ "title": "Test App", "favicon": "./_shared/favicon.png", "stylesheets": [], - "componentLibraries": ["@budibase/standard-components"], + "componentLibraries": ["@budibase/standard-components", "@budibase/materialdesign-components"], "props" : { "_component": "@budibase/standard-components/container", "_children": [], diff --git a/packages/cli/src/commands/new/appPackageTemplate/pages/unauthenticated/page.json b/packages/cli/src/commands/new/appPackageTemplate/pages/unauthenticated/page.json index 7023bf9af7..14d0301c24 100644 --- a/packages/cli/src/commands/new/appPackageTemplate/pages/unauthenticated/page.json +++ b/packages/cli/src/commands/new/appPackageTemplate/pages/unauthenticated/page.json @@ -2,7 +2,7 @@ "title": "Test App", "favicon": "./_shared/favicon.png", "stylesheets": [], - "componentLibraries": ["@budibase/standard-components"], + "componentLibraries": ["@budibase/standard-components", "@budibase/materialdesign-components"], "props" : { "_component": "@budibase/standard-components/container", "_children": [], diff --git a/packages/materialdesign-components/package.json b/packages/materialdesign-components/package.json index a469e85754..a93b5602a7 100644 --- a/packages/materialdesign-components/package.json +++ b/packages/materialdesign-components/package.json @@ -36,7 +36,7 @@ "keywords": [ "svelte" ], - "version": "0.0.15", + "version": "0.0.16", "license": "MIT", "gitHead": "115189f72a850bfb52b65ec61d932531bf327072", "dependencies": { diff --git a/packages/materialdesign-components/scripts/publishDev.js b/packages/materialdesign-components/scripts/publishDev.js index bdc85aacc5..a199b51226 100644 --- a/packages/materialdesign-components/scripts/publishDev.js +++ b/packages/materialdesign-components/scripts/publishDev.js @@ -26,7 +26,7 @@ const publicMain = appName => "lib", "node_modules", "@budibase", - "standard-components" + "materialdesign-components" ) const publicUnauth = appName => join( @@ -37,7 +37,7 @@ const publicUnauth = appName => "lib", "node_modules", "@budibase", - "standard-components" + "materialdesign-components" ) const nodeModulesDist = appName => join( @@ -45,11 +45,18 @@ const nodeModulesDist = appName => appName, "node_modules", "@budibase", - "standard-components", + "materialdesign-components", "dist" ) + const nodeModules = appName => - join(appPackages, appName, "node_modules", "@budibase", "standard-components") + join( + appPackages, + appName, + "node_modules", + "@budibase", + "materialdesign-components" + ) ;(async () => { const apps = await readdir(appPackages) From 5d0f9b788c59cb209ecea670e93e65bcac8e1aeb Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Wed, 19 Feb 2020 13:58:06 +0000 Subject: [PATCH 2/3] bugfix: component libraries loaded incorrectly --- .../src/builderStore/loadComponentLibraries.js | 17 +++++++++++++++-- packages/builder/src/builderStore/store.js | 2 -- .../src/userInterface/SettingsView.svelte | 6 +++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/builderStore/loadComponentLibraries.js b/packages/builder/src/builderStore/loadComponentLibraries.js index ed720ad6c0..1bd30a5582 100644 --- a/packages/builder/src/builderStore/loadComponentLibraries.js +++ b/packages/builder/src/builderStore/loadComponentLibraries.js @@ -1,6 +1,11 @@ +import { flatten, values, uniq, map } from "lodash/fp" +import { pipe } from "../common/core" + export const loadLibs = async (appName, appPackage) => { const allLibraries = {} - for (let lib of appPackage.pages.componentLibraries) { + + for (let lib of libsFromPages(appPackage.pages)) { + const libModule = await import(makeLibraryUrl(appName, lib)) allLibraries[lib] = libModule } @@ -10,7 +15,7 @@ export const loadLibs = async (appName, appPackage) => { export const loadLibUrls = (appName, appPackage) => { const allLibraries = [] - for (let lib of appPackage.pages.componentLibraries) { + for (let lib of libsFromPages(appPackage.pages)) { const libUrl = makeLibraryUrl(appName, lib) allLibraries.push({ libName: lib, importPath: libUrl }) } @@ -25,3 +30,11 @@ export const loadLib = async (appName, lib, allLibs) => { export const makeLibraryUrl = (appName, lib) => `/_builder/${appName}/componentlibrary?lib=${encodeURI(lib)}` + +export const libsFromPages = pages => pipe(pages, [ + values, + map(p => p.componentLibraries), + flatten, + uniq +]) + diff --git a/packages/builder/src/builderStore/store.js b/packages/builder/src/builderStore/store.js index 70207314ac..9245e2c9b5 100644 --- a/packages/builder/src/builderStore/store.js +++ b/packages/builder/src/builderStore/store.js @@ -140,8 +140,6 @@ const initialise = (store, initial) => async () => { ]) pkg.pages = { - componentLibraries: ["@budibase/standard-components"], - stylesheets: [], main: { ...pkg.pages.main, _screens: Object.values(main_screens), diff --git a/packages/builder/src/userInterface/SettingsView.svelte b/packages/builder/src/userInterface/SettingsView.svelte index 13f970a63c..bc7441561d 100644 --- a/packages/builder/src/userInterface/SettingsView.svelte +++ b/packages/builder/src/userInterface/SettingsView.svelte @@ -5,7 +5,7 @@ import IconButton from "../common/IconButton.svelte" import { libraryDependencies } from "./pagesParsing/findDependencies" import UIkit from "uikit" - + import { libsFromPages } from "../builderStore/loadComponentLibraries" let addNewLib = "" let addNewStylesheet = "" let modalElement @@ -61,7 +61,7 @@

- {#each $store.pages.componentLibraries as lib} + {#each $store.pages[$store.currentPageName].componentLibraries as lib}
{lib} removeLibrary(lib)} /> @@ -79,7 +79,7 @@

- {#each $store.pages.stylesheets as stylesheet} + {#each $store.pages[$store.currentPageName].stylesheets as stylesheet}
{stylesheet} Date: Wed, 19 Feb 2020 14:12:24 +0000 Subject: [PATCH 3/3] bad layout of component actions, on everything but firefox --- .../ComponentsHierarchyChildren.svelte | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/builder/src/userInterface/ComponentsHierarchyChildren.svelte b/packages/builder/src/userInterface/ComponentsHierarchyChildren.svelte index 6e1de3db6f..b15ecc341d 100644 --- a/packages/builder/src/userInterface/ComponentsHierarchyChildren.svelte +++ b/packages/builder/src/userInterface/ComponentsHierarchyChildren.svelte @@ -38,7 +38,7 @@ class="item" class:selected={currentComponent === component} style="padding-left: {level * 20 + 67}px"> - {get_capitalised_name(component._component)} +
{get_capitalised_name(component._component)}
{#if index > 0}