lint ✨
This commit is contained in:
parent
be8311aba2
commit
c953fa679a
|
@ -36,7 +36,7 @@
|
|||
class={determineClassName(type)}
|
||||
bind:value
|
||||
class:uk-form-danger={errors.length > 0}>
|
||||
<option></option>
|
||||
<option />
|
||||
{#each options as opt}
|
||||
<option value={opt}>{opt}</option>
|
||||
{/each}
|
||||
|
|
|
@ -59,7 +59,9 @@
|
|||
if (field.name.startsWith("_")) {
|
||||
errors.push(`field '${field.name}' - name cannot begin with '_''`)
|
||||
} else if (restrictedFieldNames.includes(field.name)) {
|
||||
errors.push(`field '${field.name}' - is a restricted name, please rename`)
|
||||
errors.push(
|
||||
`field '${field.name}' - is a restricted name, please rename`
|
||||
)
|
||||
} else if (!field.name || !field.name.trim()) {
|
||||
errors.push("field name cannot be blank")
|
||||
}
|
||||
|
@ -75,9 +77,7 @@
|
|||
async function saveModel() {
|
||||
const errors = validate()
|
||||
if (errors.length > 0) {
|
||||
notifier.danger(
|
||||
errors.join("/n")
|
||||
)
|
||||
notifier.danger(errors.join("/n"))
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -25,69 +25,69 @@
|
|||
name: "Screen Placeholder",
|
||||
route: "*",
|
||||
props: {
|
||||
"_id": "49c3d0a2-7028-46f0-b004-7eddf62ad01c",
|
||||
"_component": "@budibase/standard-components/container",
|
||||
"_styles": {
|
||||
"normal": {
|
||||
"padding": "0px",
|
||||
_id: "49c3d0a2-7028-46f0-b004-7eddf62ad01c",
|
||||
_component: "@budibase/standard-components/container",
|
||||
_styles: {
|
||||
normal: {
|
||||
padding: "0px",
|
||||
"font-family": "Roboto",
|
||||
"border-width": "0",
|
||||
"border-style": "None",
|
||||
"text-align": "center"
|
||||
"text-align": "center",
|
||||
},
|
||||
"hover": {},
|
||||
"active": {},
|
||||
"selected": {}
|
||||
hover: {},
|
||||
active: {},
|
||||
selected: {},
|
||||
},
|
||||
"_code": "",
|
||||
"className": "",
|
||||
"onLoad": [],
|
||||
"type": "div",
|
||||
"_children": [
|
||||
_code: "",
|
||||
className: "",
|
||||
onLoad: [],
|
||||
type: "div",
|
||||
_children: [
|
||||
{
|
||||
"_id": "335428f7-f9ca-4acd-9e76-71bc8ad27324",
|
||||
"_component": "@budibase/standard-components/container",
|
||||
"_styles": {
|
||||
"normal": {
|
||||
"padding": "16px",
|
||||
_id: "335428f7-f9ca-4acd-9e76-71bc8ad27324",
|
||||
_component: "@budibase/standard-components/container",
|
||||
_styles: {
|
||||
normal: {
|
||||
padding: "16px",
|
||||
"border-style": "Dashed",
|
||||
"border-width": "2px",
|
||||
"border-color": "#8a8989fa"
|
||||
"border-color": "#8a8989fa",
|
||||
},
|
||||
"hover": {},
|
||||
"active": {},
|
||||
"selected": {}
|
||||
hover: {},
|
||||
active: {},
|
||||
selected: {},
|
||||
},
|
||||
"_code": "",
|
||||
"className": "",
|
||||
"onLoad": [],
|
||||
"type": "div",
|
||||
"_instanceId": "inst_b3b4e95_ab0df02dda3f4d8eb4b35eea2968bad3",
|
||||
"_instanceName": "Container",
|
||||
"_children": [
|
||||
_code: "",
|
||||
className: "",
|
||||
onLoad: [],
|
||||
type: "div",
|
||||
_instanceId: "inst_b3b4e95_ab0df02dda3f4d8eb4b35eea2968bad3",
|
||||
_instanceName: "Container",
|
||||
_children: [
|
||||
{
|
||||
"_id": "ddb6a225-33ba-4ba8-91da-bc6a2697ebf9",
|
||||
"_component": "@budibase/standard-components/heading",
|
||||
"_styles": {
|
||||
"normal": {
|
||||
"font-family": "Roboto"
|
||||
_id: "ddb6a225-33ba-4ba8-91da-bc6a2697ebf9",
|
||||
_component: "@budibase/standard-components/heading",
|
||||
_styles: {
|
||||
normal: {
|
||||
"font-family": "Roboto",
|
||||
},
|
||||
"hover": {},
|
||||
"active": {},
|
||||
"selected": {}
|
||||
hover: {},
|
||||
active: {},
|
||||
selected: {},
|
||||
},
|
||||
_code: "",
|
||||
className: "",
|
||||
text: "Your screens go here",
|
||||
type: "h1",
|
||||
_instanceId: "inst_b3b4e95_ab0df02dda3f4d8eb4b35eea2968bad3",
|
||||
_instanceName: "Heading",
|
||||
_children: [],
|
||||
},
|
||||
"_code": "",
|
||||
"className": "",
|
||||
"text": "Your screens go here",
|
||||
"type": "h1",
|
||||
"_instanceId": "inst_b3b4e95_ab0df02dda3f4d8eb4b35eea2968bad3",
|
||||
"_instanceName": "Heading",
|
||||
"_children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"_instanceName": "Content Placeholder"
|
||||
},
|
||||
],
|
||||
_instanceName: "Content Placeholder",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,6 @@
|
|||
$: border = v > 90 && s < 5 ? "1px dashed #dedada" : ""
|
||||
$: selectedColorStyle = buildStyle({ background: value, border })
|
||||
$: hasSwatches = swatches.length > 0
|
||||
|
||||
</script>
|
||||
|
||||
<Portal>
|
||||
|
|
|
@ -8,7 +8,14 @@
|
|||
const dispatch = createEventDispatcher()
|
||||
</script>
|
||||
|
||||
<div class="flatbutton" tabindex="0" use:keyevents={{"Enter": () => dispatch("click")}} class:selected on:click>{text}</div>
|
||||
<div
|
||||
class="flatbutton"
|
||||
tabindex="0"
|
||||
use:keyevents={{ Enter: () => dispatch('click') }}
|
||||
class:selected
|
||||
on:click>
|
||||
{text}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.flatbutton {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
let percentageClick = (clickPosition / sliderWidth).toFixed(2)
|
||||
|
||||
if (percentageClick >= 0 && percentageClick <= 1) {
|
||||
|
||||
let value = type === "hue" ? 360 * percentageClick : percentageClick
|
||||
dispatch("change", { color: value, isDrag })
|
||||
}
|
||||
|
@ -40,7 +39,6 @@
|
|||
if (isWithinLimit(v)) {
|
||||
value = v
|
||||
dispatch("change", { color: value })
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
animation: false,
|
||||
})
|
||||
$: dropdown && UIkit.util.on(dropdown, "shown", () => (hidden = false))
|
||||
$: noChildrenAllowed = !component ||
|
||||
$: noChildrenAllowed =
|
||||
!component ||
|
||||
getComponentDefinition($store, component._component).children === false
|
||||
$: noPaste = !$store.componentToPaste
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<Button secondary medium on:click={deployApp}>
|
||||
Deploy App
|
||||
{#if loading}
|
||||
<Spinner ratio={"0.5"} />
|
||||
<Spinner ratio={'0.5'} />
|
||||
{/if}
|
||||
</Button>
|
||||
{/if}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
// Get the correct screen children.
|
||||
const screenChildren = $store.pages[$params.page]._screens.find(
|
||||
screen =>
|
||||
(screen.props._instanceName === $params.screen
|
||||
|| screen.props._instanceName === decodeURIComponent($params.screen))
|
||||
screen.props._instanceName === $params.screen ||
|
||||
screen.props._instanceName === decodeURIComponent($params.screen)
|
||||
).props._children
|
||||
findComponent(componentIds, screenChildren)
|
||||
}
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
const fs = require("fs")
|
||||
const AWS = require("aws-sdk")
|
||||
const fetch = require("node-fetch")
|
||||
const {
|
||||
budibaseAppsDir,
|
||||
} = require("../../../utilities/budibaseDir")
|
||||
const { budibaseAppsDir } = require("../../../utilities/budibaseDir")
|
||||
|
||||
async function invalidateCDN(cfDistribution, appId) {
|
||||
const cf = new AWS.CloudFront({})
|
||||
|
||||
return cf.createInvalidation({
|
||||
return cf
|
||||
.createInvalidation({
|
||||
DistributionId: cfDistribution,
|
||||
InvalidationBatch: {
|
||||
CallerReference: appId,
|
||||
Paths: {
|
||||
Quantity: 1,
|
||||
Items: [
|
||||
`/assets/${appId}/*`
|
||||
]
|
||||
}
|
||||
}
|
||||
}).promise()
|
||||
Items: [`/assets/${appId}/*`],
|
||||
},
|
||||
},
|
||||
})
|
||||
.promise()
|
||||
}
|
||||
|
||||
async function fetchTemporaryCredentials() {
|
||||
const response = await fetch(process.env.DEPLOYMENT_CREDENTIALS_URL, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
apiKey: process.env.BUDIBASE_API_KEY
|
||||
})
|
||||
apiKey: process.env.BUDIBASE_API_KEY,
|
||||
}),
|
||||
})
|
||||
|
||||
if (response.status !== 200) {
|
||||
throw new Error(`Error fetching temporary credentials for api key: ${BUDIBASE_API_KEY}`)
|
||||
throw new Error(
|
||||
`Error fetching temporary credentials for api key: ${process.env.BUDIBASE_API_KEY}`
|
||||
)
|
||||
}
|
||||
|
||||
const json = await response.json()
|
||||
|
@ -42,8 +42,8 @@ async function fetchTemporaryCredentials() {
|
|||
const CONTENT_TYPE_MAP = {
|
||||
html: "text/html",
|
||||
css: "text/css",
|
||||
js: "application/javascript"
|
||||
};
|
||||
js: "application/javascript",
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively walk a directory tree and execute a callback on all files.
|
||||
|
@ -74,13 +74,13 @@ exports.uploadAppAssets = async function ({ appId }) {
|
|||
AWS.config.update({
|
||||
accessKeyId: credentials.AccessKeyId,
|
||||
secretAccessKey: credentials.SecretAccessKey,
|
||||
sessionToken: credentials.SessionToken
|
||||
});
|
||||
sessionToken: credentials.SessionToken,
|
||||
})
|
||||
|
||||
const s3 = new AWS.S3({
|
||||
params: {
|
||||
Bucket: bucket
|
||||
}
|
||||
Bucket: bucket,
|
||||
},
|
||||
})
|
||||
|
||||
const appAssetsPath = `${budibaseAppsDir()}/${appId}/public`
|
||||
|
@ -94,14 +94,16 @@ exports.uploadAppAssets = async function ({ appId }) {
|
|||
const fileExtension = [...filePath.split(".")].pop()
|
||||
const fileBytes = fs.readFileSync(filePath)
|
||||
|
||||
const upload = s3.upload({
|
||||
const upload = s3
|
||||
.upload({
|
||||
Key: filePath.replace(appAssetsPath, `assets/${appId}`),
|
||||
Body: fileBytes,
|
||||
ContentType: CONTENT_TYPE_MAP[fileExtension],
|
||||
Metadata: {
|
||||
accountId
|
||||
}
|
||||
}).promise()
|
||||
accountId,
|
||||
},
|
||||
})
|
||||
.promise()
|
||||
|
||||
uploads.push(upload)
|
||||
})
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
const CouchDB = require("pouchdb")
|
||||
const PouchDB = require("../../../db")
|
||||
const {
|
||||
uploadAppAssets,
|
||||
} = require("./aws")
|
||||
const { uploadAppAssets } = require("./aws")
|
||||
|
||||
function replicate(local, remote) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
const replication = local.sync(remote);
|
||||
const replication = local.sync(remote)
|
||||
|
||||
replication.on("complete", () => resolve())
|
||||
replication.on("error", err => reject(err))
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
async function replicateCouch(instanceId, clientId) {
|
||||
|
||||
const databases = [
|
||||
`client_${clientId}`,
|
||||
"client_app_lookup",
|
||||
instanceId
|
||||
];
|
||||
const databases = [`client_${clientId}`, "client_app_lookup", instanceId]
|
||||
|
||||
const replications = databases.map(local => {
|
||||
const localDb = new PouchDB(local);
|
||||
const remoteDb = new CouchDB(`${process.env.DEPLOYMENT_COUCH_DB_URL}/${local}`)
|
||||
const localDb = new PouchDB(local)
|
||||
const remoteDb = new CouchDB(
|
||||
`${process.env.DEPLOYMENT_COUCH_DB_URL}/${local}`
|
||||
)
|
||||
|
||||
return replicate(localDb, remoteDb);
|
||||
});
|
||||
return replicate(localDb, remoteDb)
|
||||
})
|
||||
|
||||
await Promise.all(replications)
|
||||
}
|
||||
|
@ -37,21 +31,21 @@ exports.deployApp = async function(ctx) {
|
|||
const clientAppLookupDB = new PouchDB("client_app_lookup")
|
||||
const { clientId } = await clientAppLookupDB.get(ctx.user.appId)
|
||||
|
||||
ctx.log.info(`Uploading assets for appID ${ctx.user.appId} assets to s3..`);
|
||||
ctx.log.info(`Uploading assets for appID ${ctx.user.appId} assets to s3..`)
|
||||
await uploadAppAssets({
|
||||
clientId,
|
||||
appId: ctx.user.appId
|
||||
appId: ctx.user.appId,
|
||||
})
|
||||
|
||||
// replicate the DB to the couchDB cluster in prod
|
||||
ctx.log.info("Replicating local PouchDB to remote..");
|
||||
await replicateCouch(ctx.user.instanceId, clientId);
|
||||
ctx.log.info("Replicating local PouchDB to remote..")
|
||||
await replicateCouch(ctx.user.instanceId, clientId)
|
||||
|
||||
ctx.body = {
|
||||
status: "SUCCESS",
|
||||
completed: Date.now()
|
||||
completed: Date.now(),
|
||||
}
|
||||
} catch (err) {
|
||||
ctx.throw(err.status || 500, `Deployment Failed: ${err.message}`);
|
||||
ctx.throw(err.status || 500, `Deployment Failed: ${err.message}`)
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ exports.serveBuilder = async function(ctx) {
|
|||
}
|
||||
|
||||
exports.serveApp = async function(ctx) {
|
||||
const mainOrAuth = ctx.isAuthenticated ? "main" : "unauthenticated";
|
||||
const mainOrAuth = ctx.isAuthenticated ? "main" : "unauthenticated"
|
||||
|
||||
// default to homedir
|
||||
const appPath = resolve(
|
||||
|
@ -50,7 +50,8 @@ exports.serveApp = async function(ctx) {
|
|||
}
|
||||
|
||||
if (process.env.CLOUD) {
|
||||
const S3_URL = `https://${appId}.app.budi.live/assets/${appId}/${mainOrAuth}/${ctx.file || "index.production.html"}`
|
||||
const S3_URL = `https://${appId}.app.budi.live/assets/${appId}/${mainOrAuth}/${ctx.file ||
|
||||
"index.production.html"}`
|
||||
const response = await fetch(S3_URL)
|
||||
const body = await response.text()
|
||||
ctx.body = body
|
||||
|
@ -62,7 +63,7 @@ exports.serveApp = async function(ctx) {
|
|||
|
||||
exports.serveAppAsset = async function(ctx) {
|
||||
// default to homedir
|
||||
const mainOrAuth = ctx.isAuthenticated ? "main" : "unauthenticated";
|
||||
const mainOrAuth = ctx.isAuthenticated ? "main" : "unauthenticated"
|
||||
|
||||
const appPath = resolve(
|
||||
budibaseAppsDir(),
|
||||
|
@ -94,11 +95,13 @@ exports.serveComponentLibrary = async function(ctx) {
|
|||
|
||||
if (process.env.CLOUD) {
|
||||
const appId = ctx.user.appId
|
||||
const S3_URL = encodeURI(`https://${appId}.app.budi.live/assets/componentlibrary/${ctx.query.library}/dist/index.js`)
|
||||
const S3_URL = encodeURI(
|
||||
`https://${appId}.app.budi.live/assets/componentlibrary/${ctx.query.library}/dist/index.js`
|
||||
)
|
||||
const response = await fetch(S3_URL)
|
||||
const body = await response.text()
|
||||
ctx.type = 'application/javascript'
|
||||
ctx.body = body;
|
||||
ctx.type = "application/javascript"
|
||||
ctx.body = body
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ const staticRoutes = require("./static")
|
|||
const componentRoutes = require("./component")
|
||||
const workflowRoutes = require("./workflow")
|
||||
const accesslevelRoutes = require("./accesslevel")
|
||||
const deployRoutes = require("./deploy");
|
||||
const deployRoutes = require("./deploy")
|
||||
|
||||
module.exports = {
|
||||
deployRoutes,
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const { resolve, join } = require("path")
|
||||
const { homedir } = require("os")
|
||||
|
||||
const { resolve } = require("path")
|
||||
|
||||
async function runServer() {
|
||||
const budibaseDir = "~/.budibase"
|
||||
|
|
|
@ -70,7 +70,7 @@ const buildIndexHtml = async (config, appId, pageName, appPath, pkg) => {
|
|||
const indexHtml = sqrl.Render(indexHtmlTemplate, templateObj)
|
||||
const deployableHtml = sqrl.Render(indexHtmlTemplate, {
|
||||
...templateObj,
|
||||
production: true
|
||||
production: true,
|
||||
})
|
||||
|
||||
await writeFile(indexHtmlPath, indexHtml, { flag: "w+" })
|
||||
|
|
|
@ -32,5 +32,4 @@
|
|||
})
|
||||
</script>
|
||||
|
||||
<section bind:this={target}>
|
||||
</section>
|
||||
<section bind:this={target} />
|
||||
|
|
|
@ -48,5 +48,4 @@
|
|||
})
|
||||
</script>
|
||||
|
||||
<section bind:this={target}>
|
||||
</section>
|
||||
<section bind:this={target} />
|
||||
|
|
Loading…
Reference in New Issue