breaking tests
This commit is contained in:
parent
fc651a10a1
commit
614e9dbfdd
|
@ -0,0 +1 @@
|
||||||
|
dist/
|
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
window['##BUDIBASE_APPDEFINITION##'] = {"hierarchy":{"name":"root","type":"root","children":[{"name":"customer","type":"record","fields":[{"name":"name","type":"string","typeOptions":{"maxLength":1000,"values":null,"allowDeclaredValuesOnly":false},"label":"name","getInitialValue":"default","getUndefinedValue":"default"}],"children":[{"name":"invoiceyooo","type":"record","fields":[{"name":"amount","type":"number","typeOptions":{"minValue":99999999999,"maxValue":99999999999,"decimalPlaces":2},"label":"amount","getInitialValue":"default","getUndefinedValue":"default"}],"children":[],"validationRules":[],"nodeId":2,"indexes":[],"allidsShardFactor":1,"collectionName":"invoices","isSingle":false}],"validationRules":[],"nodeId":1,"indexes":[],"allidsShardFactor":64,"collectionName":"customers","isSingle":false}],"pathMaps":[],"indexes":[],"nodeId":0},"componentLibraries":["./customComponents","./moreCustomComponents","budibase-standard-components"],"appRootPath":"","props":{"_component":"some_component"}}
|
window['##BUDIBASE_APPDEFINITION##'] = {"hierarchy":{"name":"root","type":"root","children":[{"name":"customer","type":"record","fields":[{"name":"name","type":"string","typeOptions":{"maxLength":1000,"values":null,"allowDeclaredValuesOnly":false},"label":"name","getInitialValue":"default","getUndefinedValue":"default"}],"children":[{"name":"invoiceyooo","type":"record","fields":[{"name":"amount","type":"number","typeOptions":{"minValue":99999999999,"maxValue":99999999999,"decimalPlaces":2},"label":"amount","getInitialValue":"default","getUndefinedValue":"default"}],"children":[],"validationRules":[],"nodeId":2,"indexes":[],"allidsShardFactor":1,"collectionName":"invoices","isSingle":false}],"validationRules":[],"nodeId":1,"indexes":[],"allidsShardFactor":64,"collectionName":"customers","isSingle":false}],"pathMaps":[],"indexes":[],"nodeId":0},"componentLibraries":["./customComponents","./moreCustomComponents","@budibase/standard-components"],"appRootPath":"","props":{"_component":"some_component"}}
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
window['##BUDIBASE_APPDEFINITION##'] = {"hierarchy":{"name":"root","type":"root","children":[{"name":"customer","type":"record","fields":[{"name":"name","type":"string","typeOptions":{"maxLength":1000,"values":null,"allowDeclaredValuesOnly":false},"label":"name","getInitialValue":"default","getUndefinedValue":"default"}],"children":[{"name":"invoiceyooo","type":"record","fields":[{"name":"amount","type":"number","typeOptions":{"minValue":99999999999,"maxValue":99999999999,"decimalPlaces":2},"label":"amount","getInitialValue":"default","getUndefinedValue":"default"}],"children":[],"validationRules":[],"nodeId":2,"indexes":[],"allidsShardFactor":1,"collectionName":"invoices","isSingle":false}],"validationRules":[],"nodeId":1,"indexes":[],"allidsShardFactor":64,"collectionName":"customers","isSingle":false}],"pathMaps":[],"indexes":[],"nodeId":0},"componentLibraries":["./customComponents","./moreCustomComponents","budibase-standard-components"],"appRootPath":"","props":{"_component":"some_other_component"}}
|
window['##BUDIBASE_APPDEFINITION##'] = {"hierarchy":{"name":"root","type":"root","children":[{"name":"customer","type":"record","fields":[{"name":"name","type":"string","typeOptions":{"maxLength":1000,"values":null,"allowDeclaredValuesOnly":false},"label":"name","getInitialValue":"default","getUndefinedValue":"default"}],"children":[{"name":"invoiceyooo","type":"record","fields":[{"name":"amount","type":"number","typeOptions":{"minValue":99999999999,"maxValue":99999999999,"decimalPlaces":2},"label":"amount","getInitialValue":"default","getUndefinedValue":"default"}],"children":[],"validationRules":[],"nodeId":2,"indexes":[],"allidsShardFactor":1,"collectionName":"invoices","isSingle":false}],"validationRules":[],"nodeId":1,"indexes":[],"allidsShardFactor":64,"collectionName":"customers","isSingle":false}],"pathMaps":[],"indexes":[],"nodeId":0},"componentLibraries":["./customComponents","./moreCustomComponents","@budibase/standard-components"],"appRootPath":"","props":{"_component":"some_other_component"}}
|
|
@ -154,8 +154,8 @@ it("/savePackage should prepare all necessary client files", async () => {
|
||||||
expect(await pathExists(publicFolderMain("/lib/moreCustomComponents/index.js"))).toBe(true);
|
expect(await pathExists(publicFolderMain("/lib/moreCustomComponents/index.js"))).toBe(true);
|
||||||
expect(await pathExists(publicFolderUnauth("/lib/moreCustomComponents/index.js"))).toBe(true);
|
expect(await pathExists(publicFolderUnauth("/lib/moreCustomComponents/index.js"))).toBe(true);
|
||||||
|
|
||||||
expect(await pathExists(publicFolderMain("/lib/node_modules/budibase-standard-components/index.js"))).toBe(true);
|
expect(await pathExists(publicFolderMain("/lib/node_modules/@budibase/standard-components/dist/index.js"))).toBe(true);
|
||||||
expect(await pathExists(publicFolderUnauth("/lib/node_modules/budibase-standard-components/index.js"))).toBe(true);
|
expect(await pathExists(publicFolderUnauth("/lib/node_modules/@budibase/standard-components/dist/index.js"))).toBe(true);
|
||||||
|
|
||||||
expect(await pathExists(publicFolderUnauth("/budibase-client.js"))).toBe(true);
|
expect(await pathExists(publicFolderUnauth("/budibase-client.js"))).toBe(true);
|
||||||
expect(await pathExists(publicFolderUnauth("/clientAppDefinition.js"))).toBe(true);
|
expect(await pathExists(publicFolderUnauth("/clientAppDefinition.js"))).toBe(true);
|
||||||
|
|
|
@ -38,6 +38,7 @@ module.exports = (app) => {
|
||||||
|
|
||||||
let version1Key = "";
|
let version1Key = "";
|
||||||
it("should be able to upload new version including package files", async () => {
|
it("should be able to upload new version including package files", async () => {
|
||||||
|
jest.setTimeout(30000);
|
||||||
const master = await getmaster();
|
const master = await getmaster();
|
||||||
const version1 = master.recordApi
|
const version1 = master.recordApi
|
||||||
.getNew(`${newAppKey}/versions`, "version");
|
.getNew(`${newAppKey}/versions`, "version");
|
||||||
|
|
|
@ -35,11 +35,11 @@ module.exports = (app) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should serve specified files when authenticated", async () => {
|
it("should serve specified files when authenticated", async () => {
|
||||||
const response = await app.get("/testApp/app.js")
|
const response = await app.get("/testApp/budibase-client.js")
|
||||||
.set("cookie", app.credentials.testAppUser1.cookie)
|
.set("cookie", app.credentials.testAppUser1.cookie)
|
||||||
.expect(statusCodes.OK);
|
.expect(statusCodes.OK);
|
||||||
|
|
||||||
const expectedFile = await readFile("appPackages/testApp/public/main/app.js", "utf8");
|
const expectedFile = await readFile("appPackages/testApp/public/main/budibase-client.js", "utf8");
|
||||||
|
|
||||||
expect(response.text).toBe(expectedFile);
|
expect(response.text).toBe(expectedFile);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ const {
|
||||||
constants, copyFile, writeFile,
|
constants, copyFile, writeFile,
|
||||||
readFile
|
readFile
|
||||||
} = require("fs-extra");
|
} = require("fs-extra");
|
||||||
const { join, resolve } = require("path");
|
const { join, resolve, dirname } = require("path");
|
||||||
const sqrl = require('squirrelly');
|
const sqrl = require('squirrelly');
|
||||||
|
|
||||||
module.exports = async (config, appname, pages, appdefinition) => {
|
module.exports = async (config, appname, pages, appdefinition) => {
|
||||||
|
@ -41,7 +41,7 @@ const publicPath = (appPath, pageName) => join(appPath, "public", pageName);
|
||||||
const rootPath = (config, appname) => config.useAppRootPath ? `/${appname}` : "";
|
const rootPath = (config, appname) => config.useAppRootPath ? `/${appname}` : "";
|
||||||
|
|
||||||
const copyClientLib = async (appPath, pageName) => {
|
const copyClientLib = async (appPath, pageName) => {
|
||||||
var sourcepath = require.resolve("budibase-client",{
|
var sourcepath = require.resolve("@budibase/client",{
|
||||||
paths: [appPath]
|
paths: [appPath]
|
||||||
});
|
});
|
||||||
var destPath = join(publicPath(appPath, pageName), "budibase-client.js");
|
var destPath = join(publicPath(appPath, pageName), "budibase-client.js");
|
||||||
|
@ -95,16 +95,12 @@ const buildClientAppDefinition = async (config, appname, appdefinition, appPath,
|
||||||
for(let lib of pages.componentLibraries) {
|
for(let lib of pages.componentLibraries) {
|
||||||
const info = await componentLibraryInfo(appPath, lib);
|
const info = await componentLibraryInfo(appPath, lib);
|
||||||
const libFile = info.components._lib || "index.js";
|
const libFile = info.components._lib || "index.js";
|
||||||
let source;
|
const source = join(info.libDir, libFile);
|
||||||
try {
|
const moduleDir = join(appPublicPath, "lib", info.libDir.replace(appPath, ""));
|
||||||
source = join(info.libDir, libFile);
|
const destPath = join(moduleDir, libFile);
|
||||||
} catch(e) {
|
|
||||||
console.log(e);
|
await ensureDir(dirname(destPath));
|
||||||
}
|
|
||||||
const destDir = join(appPublicPath, "lib", info.libDir.replace(appPath, ""));
|
|
||||||
await ensureDir(destDir);
|
|
||||||
|
|
||||||
const destPath = join(destDir, libFile);
|
|
||||||
componentLibraries.push(destPath);
|
componentLibraries.push(destPath);
|
||||||
|
|
||||||
let shouldCopy = !(await pathExists(destPath));
|
let shouldCopy = !(await pathExists(destPath));
|
||||||
|
|
|
@ -43,7 +43,7 @@ module.exports.getPackageForBuilder = async (config, appname) => {
|
||||||
|
|
||||||
derivedComponents: keyBy("name")(
|
derivedComponents: keyBy("name")(
|
||||||
await fetchDerivedComponents(appPath))
|
await fetchDerivedComponents(appPath))
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,11 @@ module.exports.createTarGzPackage = async (config, appName) => {
|
||||||
await unlink(packagePath);
|
await unlink(packagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
await compress(appPath, packagePath);
|
await compress(appPath, packagePath);
|
||||||
|
}catch(e){
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
const size = (await stat(packagePath)).size;
|
const size = (await stat(packagePath)).size;
|
||||||
return {size, path:packagePath};
|
return {size, path:packagePath};
|
||||||
}
|
}
|
||||||
|
@ -48,7 +52,7 @@ const compress = (src, dest) => new Promise((resolve, reject) => {
|
||||||
|
|
||||||
// ensure opts
|
// ensure opts
|
||||||
opts = {src, dest};
|
opts = {src, dest};
|
||||||
opts.tar = {ignore: name => dirname(name).split(sep).pop() === "dist"};
|
opts.tar = {ignore: name => dirname(name).split(sep).pop() === "dist" || dirname(name).split(sep).pop() === "node_modules"};
|
||||||
opts.gz = opts.gz || {};
|
opts.gz = opts.gz || {};
|
||||||
|
|
||||||
// default gzip config
|
// default gzip config
|
||||||
|
|
Loading…
Reference in New Issue