Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
VirtualEstatePlanner committed Feb 22, 2022
1 parent e3d68c1 commit e76d4f5
Show file tree
Hide file tree
Showing 25 changed files with 129 additions and 132 deletions.
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"allowlist": {
"fs": {
"all": false,
"scope": [ "$DOWNLOAD/*" ],
"scope": ["$DOWNLOAD/*"],
"writeFile": true
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/functions/reducers/megaReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const megaReducer: React.Reducer<IMegaDockerState, IMegaDockerAction> = (
switch (
action.type // check which modification to make to state
) {
// starts the program with only core manikins selected
// starts the program with only core manikins selected
case `APPLICATION_START`:
return initialMegaDockerState

Expand Down
4 changes: 1 addition & 3 deletions src/functions/reducers/zipDockerSwarmTauri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ fi;
})
.then(async function (content: Blob) {
const zipContents: Uint8Array = new Uint8Array(await content.arrayBuffer())
await writeBinaryFile(
{ contents: zipContents, path: `${zipManikins[traefikIndex].memories[mobNameIndex].value}.zip` },
{ dir: 8 /* Downloads directory */ })
await writeBinaryFile({ contents: zipContents, path: `${zipManikins[traefikIndex].memories[mobNameIndex].value}.zip` }, { dir: 8 /* Downloads directory */ })
})
}
27 changes: 13 additions & 14 deletions src/functions/validators/stringYamlValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@
import YamlValidator from 'yaml-validator'

export const stringYamlValidator: Function = (stringToValidate: string): boolean => {

class YamlValidatorForTesting extends YamlValidator {
testValidation: Function = (yamlStrings: string[]): boolean => {
let validatePassed: boolean = false
try {
super.validate(yamlStrings)
validatePassed = true
} catch (error) {
validatePassed = false
class YamlValidatorForTesting extends YamlValidator {
testValidation: Function = (yamlStrings: string[]): boolean => {
let validatePassed: boolean = false
try {
super.validate(yamlStrings)
validatePassed = true
} catch (error) {
validatePassed = false
}
return validatePassed
}
return validatePassed
}
}

const validator: YamlValidatorForTesting = new YamlValidatorForTesting()
const validator: YamlValidatorForTesting = new YamlValidatorForTesting()

const isValidated = validator.testValidation([stringToValidate])
return isValidated
const isValidated = validator.testValidation([stringToValidate])
return isValidated
}
9 changes: 4 additions & 5 deletions src/interfaces/objectInterfaces/IDockerSecret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
* @workflowJson - the meat and bones of the wokflow from n8n.io
* @workflowIndex -
*/
export interface IDockerSecret {
secretName: string
secretValue: string
}

export interface IDockerSecret {
secretName: string
secretValue: string
}
2 changes: 1 addition & 1 deletion src/interfaces/objectInterfaces/IN8NWorkflow.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @format */

import { IDockerSecret } from "./IDockerSecret";
import { IDockerSecret } from './IDockerSecret'

// IN8NWorkflow.ts
// MEGADocker
Expand Down
2 changes: 1 addition & 1 deletion src/mobparts/manikins/traefik.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ export const traefikManikin: IManikin = {
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const memoriesToBeAdded: Array<IMemory> = [luaDNSAPIToken, luaDNSEmailAddress]
const memoriesToBeAdded: Array<IMemory> = [luaDNSAPIToken, luaDNSEmailAddress]
4 changes: 2 additions & 2 deletions src/scripts/utility/moveBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const getOperatingSystem: Function = (): string => {
throw new Error(`Unsupported platform: ${thisPlatform}`)
}
}

const getProcessorArchitecture: Function = (): string => {
const thisArchitecture: string = arch()
switch (thisArchitecture) {
Expand All @@ -34,4 +34,4 @@ const getProcessorArchitecture: Function = (): string => {
}

console.log(getOperatingSystem())
console.log(getProcessorArchitecture())
console.log(getProcessorArchitecture())
97 changes: 48 additions & 49 deletions src/scripts/utility/webzip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,57 @@
// Copyright © 2020 The MegaDocker Group. All rights reserved.

import fs from 'fs'
import JSZip from 'jszip';
import path from 'path';
import { version } from '../../../package.json';
import JSZip from 'jszip'
import path from 'path'
import { version } from '../../../package.json'

const getFilePathsRecursively = (directoryPath: string): string[] => {

// returns a flat array of absolute paths of all files recursively contained in the dir
let filePaths: string[] = [];
let directoryContents: string[] = fs.readdirSync(directoryPath);
let pendingFiles: number = directoryContents.length;
if (!pendingFiles) return filePaths;
for (let eachFile of directoryContents) {
eachFile = path.resolve(directoryPath, eachFile);
let stat = fs.lstatSync(eachFile);
if (stat && stat.isDirectory()) {
filePaths = filePaths.concat(getFilePathsRecursively(eachFile));
} else {
filePaths.push(eachFile);
}
if (!--pendingFiles) return filePaths;
// returns a flat array of absolute paths of all files recursively contained in the dir
let filePaths: string[] = []
let directoryContents: string[] = fs.readdirSync(directoryPath)
let pendingFiles: number = directoryContents.length
if (!pendingFiles) return filePaths
for (let eachFile of directoryContents) {
eachFile = path.resolve(directoryPath, eachFile)
let stat = fs.lstatSync(eachFile)
if (stat && stat.isDirectory()) {
filePaths = filePaths.concat(getFilePathsRecursively(eachFile))
} else {
filePaths.push(eachFile)
}
return filePaths;
};

const getZipOfFolder = (directory: string): JSZip => {
const allPaths: string[] = getFilePathsRecursively(directory);
let zip = new JSZip();
for (let filePath of allPaths) {

if (fs.lstatSync(filePath).isSymbolicLink()) {
zip.file(path.relative(path.join(directory, '..'), filePath), fs.readlinkSync(filePath), {
unixPermissions: parseInt('120755', 8),
dir: fs.lstatSync(filePath).isDirectory()
});
} else {
zip.file(path.relative(path.join(directory, '..'), filePath), fs.readFileSync(filePath), {
unixPermissions: fs.lstatSync(filePath).mode,
dir: fs.lstatSync(filePath).isDirectory()
});
}
}
zip.generateAsync({
compression: `DEFLATE`,
compressionOptions: { level: 9 },
platform: `UNIX`,
type: `nodebuffer`,
if (!--pendingFiles) return filePaths
}
return filePaths
}

const getZipOfFolder = (directory: string): JSZip => {
const allPaths: string[] = getFilePathsRecursively(directory)
let zip = new JSZip()
for (let filePath of allPaths) {
if (fs.lstatSync(filePath).isSymbolicLink()) {
zip.file(path.relative(path.join(directory, '..'), filePath), fs.readlinkSync(filePath), {
unixPermissions: parseInt('120755', 8),
dir: fs.lstatSync(filePath).isDirectory()
})
.then(function (content) {
fs.writeFileSync(`./binaries/web/MEGADocker-${version}-web.zip`, content)
} else {
zip.file(path.relative(path.join(directory, '..'), filePath), fs.readFileSync(filePath), {
unixPermissions: fs.lstatSync(filePath).mode,
dir: fs.lstatSync(filePath).isDirectory()
})

return zip;
};
}
}
zip
.generateAsync({
compression: `DEFLATE`,
compressionOptions: { level: 9 },
platform: `UNIX`,
type: `nodebuffer`
})
.then(function (content) {
fs.writeFileSync(`./binaries/MEGADocker-${version}-web.zip`, content)
})

return zip
}

getZipOfFolder(`build`)
getZipOfFolder(`build`)
2 changes: 1 addition & 1 deletion src/tests/components/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright © 2021 The MegaDocker Group. All rights reserved.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React, { Component } from "react"
import React, { Component } from 'react'
import { App } from '../../components/App'
import { render } from '@testing-library/react'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/components/ButtonSaveZipFile.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright © 2021 The MegaDocker Group. All rights reserved.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React, { Component } from "react"
import React, { Component } from 'react'
import { ButtonSaveZipFile } from '../../components/ButtonSaveZipFile'
import { render } from '@testing-library/react'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/components/ContainerButtonPane.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright © 2021 The MegaDocker Group. All rights reserved.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React, { Component } from "react"
import React, { Component } from 'react'
import { ContainerButtonPane } from '../../components/ContainerButtonPane'
import { render } from '@testing-library/react'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/components/ContainerMainArea.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright © 2021 The MegaDocker Group. All rights reserved.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React, { Component } from "react"
import React, { Component } from 'react'
import { ContainerMainArea } from '../../components/ContainerMainArea'
import { render } from '@testing-library/react'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/components/ContainerManikinPane.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright © 2021 The MegaDocker Group. All rights reserved.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React, { Component } from "react"
import React, { Component } from 'react'
import { ContainerManikinPane } from '../../components/ContainerManikinPane'
import { render } from '@testing-library/react'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/components/ContainerMemoryPane.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright © 2021 The MegaDocker Group. All rights reserved.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React, { Component } from "react"
import React, { Component } from 'react'
import { ContainerMemoryPane } from '../../components/ContainerMemoryPane'
import { render } from '@testing-library/react'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/components/ManikinTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright © 2021 The MegaDocker Group. All rights reserved.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React, { Component } from "react"
import React, { Component } from 'react'
import { ManikinTable } from '../../components/ManikinTable'
import { render } from '@testing-library/react'
import { MegaProvider } from '../../components/MegaContext'
Expand Down
2 changes: 1 addition & 1 deletion src/tests/components/MegaContext.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright © 2021 The MegaDocker Group. All rights reserved.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React, { Component } from "react"
import React, { Component } from 'react'
import { MegaProvider } from '../../components/MegaContext'
import { render } from '@testing-library/react'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/components/MemoryTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright © 2021 The MegaDocker Group. All rights reserved.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React, { Component } from "react"
import React, { Component } from 'react'
import { MemoryTable } from '../../components/MemoryTable'
import { render } from '@testing-library/react'
import { MegaProvider } from '../../components/MegaContext'
Expand Down
2 changes: 1 addition & 1 deletion src/tests/functions/reducers/toggleTheme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('tests the themeToggle function', () => {
expect(toggleTheme(OrbThemeLight)).toEqual(OrbThemeDark)
expect(toggleTheme(OrbThemeDark)).toEqual(OrbThemeLight)
expect(() => {
toggleTheme(createTheme({}))
toggleTheme(createTheme({}))
}).toThrowError(`toggleTheme error: passed non-standard theme to theme switch`)
})
})
2 changes: 1 addition & 1 deletion src/tests/functions/reducers/zipDockerSwarm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Copyright © 2021 The MegaDocker Group. All rights reserved.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { initialMegaDockerState } from "../../../globals/initialMegaDockerState"
import { initialMegaDockerState } from '../../../globals/initialMegaDockerState'
import { testMegaDockerAction } from '../../test-functions/testMegaDockerAction'
import { testMegaDockerState } from '../../test-functions/testMegaDockerState'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/globals/initialMegaDockerState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ import { testMegaDockerState } from '../test-functions/testMegaDockerState'

describe(`tests each possible MegaDockerState property`, () => {
testMegaDockerState(initialMegaDockerState)
})
})
58 changes: 29 additions & 29 deletions src/tests/globals/workingManikins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@ import { workingManikins } from '../../globals/workingManikins'

describe(`tests that all Manikins are present in the workingManikins array`, () => {
it(`has every optional Manikin that is complete`, () => {
expect(workingManikins.find(manikin => manikin.name === `Books`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Comics`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Drupal`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `ELK`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `E-mail`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `FileBrowser`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Ghost`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Grocy`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Heimdall`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Kanboard`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Ledger`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Mealie`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Movies`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Music`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Nextcloud`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Nginx`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `osPOS`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Pihole`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Portainer`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `RocketChat`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Styleguidist`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Syncthing`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `TV`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Visualizer`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `WordPress`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Books`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Comics`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Drupal`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `ELK`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `E-mail`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `FileBrowser`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Ghost`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Grocy`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Heimdall`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Kanboard`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Ledger`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Mealie`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Movies`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Music`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Nextcloud`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Nginx`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `osPOS`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Pihole`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Portainer`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `RocketChat`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Styleguidist`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Syncthing`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `TV`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Visualizer`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `WordPress`)).toBeTruthy()
})
it(`has every core Manikin that is complete`, () => {
expect(workingManikins.find(manikin => manikin.name === `LDAP`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Traefik`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `n8n`)).toBeTruthy()
expect(workingManikins.find(manikin => manikin.name === `Swarmpit`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `LDAP`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Traefik`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `n8n`)).toBeTruthy()
expect(workingManikins.find((manikin) => manikin.name === `Swarmpit`)).toBeTruthy()
})
})
Loading

0 comments on commit e76d4f5

Please sign in to comment.