Isolate Netlify, Firebase and Helper functions + Import from absolute paths

This commit is contained in:
Liyas Thomas
2020-06-21 09:24:45 +05:30
parent 24315ab0e6
commit 5d94ac361e
56 changed files with 108 additions and 112 deletions

View File

@@ -43,14 +43,14 @@
</template> </template>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {
show: Boolean, show: Boolean,
}, },
components: { components: {
modal: () => import("../../components/ui/modal"), modal: () => import("~/components/ui/modal"),
}, },
data() { data() {
return { return {

View File

@@ -43,7 +43,7 @@
</template> </template>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {
@@ -52,7 +52,7 @@ export default {
collectionIndex: Number, collectionIndex: Number,
}, },
components: { components: {
modal: () => import("../../components/ui/modal"), modal: () => import("~/components/ui/modal"),
}, },
data() { data() {
return { return {

View File

@@ -87,7 +87,7 @@ ul li {
</style> </style>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
components: { components: {

View File

@@ -43,7 +43,7 @@
</template> </template>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {
@@ -52,7 +52,7 @@ export default {
editingCollectionIndex: Number, editingCollectionIndex: Number,
}, },
components: { components: {
modal: () => import("../../components/ui/modal"), modal: () => import("~/components/ui/modal"),
}, },
data() { data() {
return { return {

View File

@@ -38,7 +38,7 @@
</template> </template>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {
@@ -49,7 +49,7 @@ export default {
folderIndex: Number, folderIndex: Number,
}, },
components: { components: {
modal: () => import("../../components/ui/modal"), modal: () => import("~/components/ui/modal"),
}, },
data() { data() {
return { return {

View File

@@ -69,7 +69,7 @@
</template> </template>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {
@@ -80,7 +80,7 @@ export default {
requestIndex: Number, requestIndex: Number,
}, },
components: { components: {
modal: () => import("../../components/ui/modal"), modal: () => import("~/components/ui/modal"),
}, },
data() { data() {
return { return {

View File

@@ -70,7 +70,7 @@ ul li {
</style> </style>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {

View File

@@ -76,7 +76,7 @@
</template> </template>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
data() { data() {
@@ -88,7 +88,7 @@ export default {
show: Boolean, show: Boolean,
}, },
components: { components: {
modal: () => import("../../components/ui/modal"), modal: () => import("~/components/ui/modal"),
}, },
computed: { computed: {
collectionJson() { collectionJson() {

View File

@@ -103,7 +103,7 @@ ul {
<script> <script>
import collection from "./collection" import collection from "./collection"
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
components: { components: {

View File

@@ -42,7 +42,7 @@ ul li {
</style> </style>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {

View File

@@ -78,7 +78,7 @@
</template> </template>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {
@@ -86,7 +86,7 @@ export default {
editingRequest: Object, editingRequest: Object,
}, },
components: { components: {
modal: () => import("../../components/ui/modal"), modal: () => import("~/components/ui/modal"),
}, },
data() { data() {
return { return {

View File

@@ -43,14 +43,14 @@
</template> </template>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {
show: Boolean, show: Boolean,
}, },
components: { components: {
modal: () => import("../../components/ui/modal"), modal: () => import("~/components/ui/modal"),
}, },
data() { data() {
return { return {

View File

@@ -114,8 +114,8 @@
</template> </template>
<script> <script>
import textareaAutoHeight from "../../directives/textareaAutoHeight" import textareaAutoHeight from "~/directives/textareaAutoHeight"
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
directives: { directives: {
@@ -127,7 +127,7 @@ export default {
editingEnvironmentIndex: Number, editingEnvironmentIndex: Number,
}, },
components: { components: {
modal: () => import("../../components/ui/modal"), modal: () => import("~/components/ui/modal"),
}, },
data() { data() {
return { return {

View File

@@ -42,7 +42,7 @@ ul li {
</style> </style>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
props: { props: {

View File

@@ -76,7 +76,7 @@
</template> </template>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
data() { data() {
@@ -88,7 +88,7 @@ export default {
show: Boolean, show: Boolean,
}, },
components: { components: {
modal: () => import("../../components/ui/modal"), modal: () => import("~/components/ui/modal"),
}, },
computed: { computed: {
environmentJson() { environmentJson() {

View File

@@ -58,7 +58,7 @@ ul {
<script> <script>
import environment from "./environment" import environment from "./environment"
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
components: { components: {

View File

@@ -49,7 +49,7 @@ ol {
</style> </style>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
data() { data() {

View File

@@ -46,7 +46,7 @@ ol {
</style> </style>
<script> <script>
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
data() { data() {

View File

@@ -37,7 +37,7 @@
<script> <script>
import firebase from "firebase/app" import firebase from "firebase/app"
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
data() { data() {

View File

@@ -9,7 +9,7 @@
<script> <script>
import firebase from "firebase/app" import firebase from "firebase/app"
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
data() { data() {

View File

@@ -25,11 +25,11 @@ import ace from "ace-builds"
import "ace-builds/webpack-resolver" import "ace-builds/webpack-resolver"
import "ace-builds/src-noconflict/ext-language_tools" import "ace-builds/src-noconflict/ext-language_tools"
import "ace-builds/src-noconflict/mode-graphqlschema" import "ace-builds/src-noconflict/mode-graphqlschema"
import { defineGQLLanguageMode } from "~/functions/syntax/gqlQueryLangMode" import { defineGQLLanguageMode } from "~/helpers/syntax/gqlQueryLangMode"
import * as gql from "graphql" import * as gql from "graphql"
import { getAutocompleteSuggestions } from "graphql-language-service-interface" import { getAutocompleteSuggestions } from "graphql-language-service-interface"
import debounce from "../../functions/utils/debounce" import debounce from "~/helpers/utils/debounce"
export default { export default {
props: { props: {

View File

@@ -282,15 +282,15 @@
</style> </style>
<script> <script>
import intializePwa from "../../assets/js/pwa" import intializePwa from "~/assets/js/pwa"
import { import {
hasExtensionInstalled, hasExtensionInstalled,
hasChromeExtensionInstalled, hasChromeExtensionInstalled,
hasFirefoxExtensionInstalled, hasFirefoxExtensionInstalled,
} from "../../functions/strategies/ExtensionStrategy" } from "~/helpers/strategies/ExtensionStrategy"
import { getPlatformSpecialKey } from "../../functions/platformutils" import { getPlatformSpecialKey } from "~/helpers/platformutils"
import firebase from "firebase/app" import firebase from "firebase/app"
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
components: { components: {

View File

@@ -306,8 +306,8 @@ ol {
</style> </style>
<script> <script>
import { findStatusGroup } from "../../pages/index" import { findStatusGroup } from "~/pages/index"
import { fb } from "../../functions/fb" import { fb } from "~/helpers/fb"
const updateOnLocalStorage = (propertyName, property) => const updateOnLocalStorage = (propertyName, property) =>
window.localStorage.setItem(propertyName, JSON.stringify(property)) window.localStorage.setItem(propertyName, JSON.stringify(property))

View File

@@ -40,7 +40,7 @@ div.realtime-log {
</style> </style>
<script> <script>
import { getSourcePrefix } from "~/functions/utils/string" import { getSourcePrefix } from "~/helpers/utils/string"
export default { export default {
props: ["log", "title"], props: ["log", "title"],

View File

@@ -70,11 +70,11 @@
<script> <script>
import Paho from "paho-mqtt" import Paho from "paho-mqtt"
import { wsValid } from "~/functions/utils/valid" import { wsValid } from "~/helpers/utils/valid"
export default { export default {
components: { components: {
"pw-section": () => import("../../components/layout/section"), "pw-section": () => import("~/components/layout/section"),
realtimeLog: () => import("./log"), realtimeLog: () => import("./log"),
}, },
data: function () { data: function () {

View File

@@ -76,13 +76,13 @@
</template> </template>
<script> <script>
import { socketioValid } from "~/functions/utils/valid" import { socketioValid } from "~/helpers/utils/valid"
import io from "socket.io-client" import io from "socket.io-client"
import wildcard from "socketio-wildcard" import wildcard from "socketio-wildcard"
export default { export default {
components: { components: {
"pw-section": () => import("../../components/layout/section"), "pw-section": () => import("~/components/layout/section"),
realtimeLog: () => import("./log"), realtimeLog: () => import("./log"),
}, },
data() { data() {

View File

@@ -40,7 +40,7 @@
</template> </template>
<script> <script>
import { httpValid } from "~/functions/utils/valid" import { httpValid } from "~/helpers/utils/valid"
export default { export default {
components: { components: {

View File

@@ -66,7 +66,7 @@
</template> </template>
<script> <script>
import { wsValid } from "~/functions/utils/valid" import { wsValid } from "~/helpers/utils/valid"
export default { export default {
components: { components: {

View File

@@ -23,8 +23,8 @@ const DEFAULT_THEME = "twilight"
import ace from "ace-builds" import ace from "ace-builds"
import "ace-builds/webpack-resolver" import "ace-builds/webpack-resolver"
import jsonParse from "../../functions/jsonParse" import jsonParse from "~/helpers/jsonParse"
import debounce from "../../functions/utils/debounce" import debounce from "~/helpers/utils/debounce"
export default { export default {
props: { props: {

View File

@@ -16,9 +16,9 @@
<script> <script>
export default { export default {
components: { components: {
sidenav: () => import("../components/layout/sidenav"), sidenav: () => import("~/components/layout/sidenav"),
"pw-header": () => import("../components/layout/header"), "pw-header": () => import("~/components/layout/header"),
"pw-footer": () => import("../components/layout/footer"), "pw-footer": () => import("~/components/layout/footer"),
}, },
beforeMount() { beforeMount() {

View File

@@ -1,3 +1,3 @@
[build] [build]
command = "npm run generate" command = "npm run generate"
functions = "functions/" functions = "netlify/"

View File

@@ -303,11 +303,11 @@
</style> </style>
<script> <script>
import AceEditor from "../components/ui/ace-editor" import AceEditor from "~/components/ui/ace-editor"
export default { export default {
components: { components: {
"pw-section": () => import("../components/layout/section"), "pw-section": () => import("~/components/layout/section"),
Editor: AceEditor, Editor: AceEditor,
}, },

View File

@@ -339,26 +339,26 @@
<script> <script>
import axios from "axios" import axios from "axios"
import * as gql from "graphql" import * as gql from "graphql"
import textareaAutoHeight from "../directives/textareaAutoHeight" import textareaAutoHeight from "~/directives/textareaAutoHeight"
import { commonHeaders } from "../functions/headers" import { commonHeaders } from "~/helpers/headers"
import AceEditor from "../components/ui/ace-editor" import AceEditor from "~/components/ui/ace-editor"
import QueryEditor from "../components/graphql/queryeditor" import QueryEditor from "~/components/graphql/queryeditor"
import { getPlatformSpecialKey } from "~/functions/platformutils" import { getPlatformSpecialKey } from "~/helpers/platformutils"
import { sendNetworkRequest } from "../functions/network" import { sendNetworkRequest } from "~/helpers/network"
export default { export default {
directives: { directives: {
textareaAutoHeight, textareaAutoHeight,
}, },
components: { components: {
"pw-section": () => import("../components/layout/section"), "pw-section": () => import("~/components/layout/section"),
"gql-field": () => import("../components/graphql/field"), "gql-field": () => import("~/components/graphql/field"),
"gql-type": () => import("../components/graphql/type"), "gql-type": () => import("~/components/graphql/type"),
autocomplete: () => import("../components/ui/autocomplete"), autocomplete: () => import("~/components/ui/autocomplete"),
Editor: AceEditor, Editor: AceEditor,
QueryEditor: QueryEditor, QueryEditor: QueryEditor,
tabs: () => import("../components/ui/tabs"), tabs: () => import("~/components/ui/tabs"),
tab: () => import("../components/ui/tab"), tab: () => import("~/components/ui/tab"),
}, },
data() { data() {
return { return {

View File

@@ -1339,28 +1339,24 @@
</template> </template>
<script> <script>
import section from "../components/layout/section" import section from "~/components/layout/section"
import url from "url" import url from "url"
import querystring from "querystring" import querystring from "querystring"
import { commonHeaders } from "../functions/headers" import { commonHeaders } from "~/helpers/headers"
import textareaAutoHeight from "../directives/textareaAutoHeight" import textareaAutoHeight from "~/directives/textareaAutoHeight"
import parseCurlCommand from "../assets/js/curlparser.js" import parseCurlCommand from "~/assets/js/curlparser.js"
import getEnvironmentVariablesFromScript from "../functions/preRequest" import getEnvironmentVariablesFromScript from "~/helpers/preRequest"
import runTestScriptWithVariables from "../functions/postwomanTesting" import runTestScriptWithVariables from "~/helpers/postwomanTesting"
import parseTemplateString from "../functions/templating" import parseTemplateString from "~/helpers/templating"
import AceEditor from "../components/ui/ace-editor" import AceEditor from "~/components/ui/ace-editor"
import { tokenRequest, oauthRedirect } from "../assets/js/oauth" import { tokenRequest, oauthRedirect } from "~/assets/js/oauth"
import { cancelRunningRequest, sendNetworkRequest } from "../functions/network" import { cancelRunningRequest, sendNetworkRequest } from "~/helpers/network"
import { fb } from "../functions/fb" import { fb } from "~/helpers/fb"
import { getEditorLangForMimeType } from "~/functions/editorutils" import { getEditorLangForMimeType } from "~/helpers/editorutils"
import { import { hasPathParams, addPathParamsToVariables, getQueryParams } from "~/helpers/requestParams.js"
hasPathParams, import { parseUrlAndPath } from "~/helpers/utils/uri.js"
addPathParamsToVariables, import { httpValid } from "~/helpers/utils/valid"
getQueryParams, import { knownContentTypes, isJSONContentType } from "~/helpers/utils/contenttypes"
} from "../functions/requestParams.js"
import { parseUrlAndPath } from "../functions/utils/uri.js"
import { httpValid } from "../functions/utils/valid"
import { knownContentTypes, isJSONContentType } from "../functions/utils/contenttypes"
const statusCategories = [ const statusCategories = [
{ {
@@ -1417,19 +1413,19 @@ export default {
}, },
components: { components: {
"pw-section": section, "pw-section": section,
"pw-toggle": () => import("../components/ui/toggle"), "pw-toggle": () => import("~/components/ui/toggle"),
"pw-modal": () => import("../components/ui/modal"), "pw-modal": () => import("~/components/ui/modal"),
autocomplete: () => import("../components/ui/autocomplete"), autocomplete: () => import("~/components/ui/autocomplete"),
history: () => import("../components/layout/history"), history: () => import("~/components/layout/history"),
collections: () => import("../components/collections"), collections: () => import("~/components/collections"),
saveRequestAs: () => import("../components/collections/saveRequestAs"), saveRequestAs: () => import("~/components/collections/saveRequestAs"),
Editor: AceEditor, Editor: AceEditor,
environments: () => import("../components/environments"), environments: () => import("~/components/environments"),
inputform: () => import("../components/firebase/inputform"), inputform: () => import("~/components/firebase/inputform"),
notes: () => import("../components/firebase/feeds"), notes: () => import("~/components/firebase/feeds"),
login: () => import("../components/firebase/login"), login: () => import("~/components/firebase/login"),
tabs: () => import("../components/ui/tabs"), tabs: () => import("~/components/ui/tabs"),
tab: () => import("../components/ui/tab"), tab: () => import("~/components/ui/tab"),
}, },
data() { data() {
return { return {

View File

@@ -25,13 +25,13 @@
<script> <script>
export default { export default {
components: { components: {
"pw-section": () => import("../components/layout/section"), "pw-section": () => import("~/components/layout/section"),
tabs: () => import("../components/ui/tabs"), tabs: () => import("~/components/ui/tabs"),
tab: () => import("../components/ui/tab"), tab: () => import("~/components/ui/tab"),
websocket: () => import("../components/realtime/websocket"), websocket: () => import("~/components/realtime/websocket"),
sse: () => import("../components/realtime/sse"), sse: () => import("~/components/realtime/sse"),
socketio: () => import("../components/realtime/socketio"), socketio: () => import("~/components/realtime/socketio"),
mqtt: () => import("../components/realtime/mqtt"), mqtt: () => import("~/components/realtime/mqtt"),
}, },
} }
</script> </script>

View File

@@ -209,15 +209,15 @@
<script> <script>
import firebase from "firebase/app" import firebase from "firebase/app"
import { fb } from "../functions/fb" import { fb } from "~/helpers/fb"
export default { export default {
components: { components: {
"pw-section": () => import("../components/layout/section"), "pw-section": () => import("~/components/layout/section"),
"pw-toggle": () => import("../components/ui/toggle"), "pw-toggle": () => import("~/components/ui/toggle"),
swatch: () => import("../components/settings/swatch"), swatch: () => import("~/components/settings/swatch"),
login: () => import("../components/firebase/login"), login: () => import("~/components/firebase/login"),
logout: () => import("../components/firebase/logout"), logout: () => import("~/components/firebase/logout"),
}, },
data() { data() {

View File

@@ -13,7 +13,7 @@
describe("Proxy enabled - external request", () => { describe("Proxy enabled - external request", () => {
it("Enable proxy and make a GET request to Postwoman API", () => { it("Enable proxy and make a GET request to Postwoman API", () => {
cy.enableProxy("/?url=https://postwoman.io&path=/.netlify/functions/api") cy.enableProxy("/?url=https://postwoman.io&path=/.netlify/netlify/api")
.get("#send") .get("#send")
.click() .click()
.get("#response-details-wrapper", { timeout: 24000 }) .get("#response-details-wrapper", { timeout: 24000 })