Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix prettier formatting #437

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions examples/admin-sdk-app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module.exports = {
parser: 'vue-eslint-parser',
parser: "vue-eslint-parser",
parserOptions: {
parser: '@typescript-eslint/parser',
parser: "@typescript-eslint/parser",
},
globals: {
EntitySchema: true,
},
extends: [
// add more generic rulesets here, such as:
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:vue/recommended'
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:vue/recommended",
],
rules: {
// override/add rules settings here, such as:
// 'vue/no-unused-vars': 'error'
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
}
}
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
},
};
7 changes: 5 additions & 2 deletions examples/admin-sdk-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"dev": "ts-node src/server.ts",
"lint:all": "npm run lint:eslint && vue-tsc --noEmit",
"lint:eslint": "eslint --ext .js,.ts,.vue src",
"lint:types": "vue-tsc --noEmit"
"lint:types": "vue-tsc --noEmit",
"format:check": "prettier . --check",
"format": "prettier --write ."
},
"dependencies": {
"@shopware-ag/entity-schema-types": "^5.8.6",
Expand All @@ -37,6 +39,7 @@
"nodemon": "^2.0.22",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"prettier": "3.4.2"
}
}
Original file line number Diff line number Diff line change
@@ -1,74 +1,66 @@
<template>
<div>
<h2>
Config!
</h2>
<h2>Config!</h2>

Video-Code: <input
v-model="dailyUrl"
type="text"
><br>
Video-Code: <input v-model="dailyUrl" type="text" /><br />
</div>
</template>

<script setup lang="ts">
import { onBeforeMount, ref, computed } from 'vue';
import { data } from '@shopware-ag/meteor-admin-sdk';
import EX_DAILYMOTION_CONSTANTS from './ex-dailymotion-constants';
import { onBeforeMount, ref, computed } from "vue";
import { data } from "@shopware-ag/meteor-admin-sdk";
import EX_DAILYMOTION_CONSTANTS from "./ex-dailymotion-constants";

const dailyUrlValue = ref('');
const dailyUrlSource = ref('static');
const dailyUrlValue = ref("");
const dailyUrlSource = ref("static");

const dataSelectors = [
'config.dailyUrl.value',
'config.dailyUrl.source',
];
const dataSelectors = ["config.dailyUrl.value", "config.dailyUrl.source"];

const dataId = computed(() => {
const params = new URLSearchParams(window.location.search);
const elementId = params.get('elementId');
const elementId = params.get("elementId");

if (!elementId) {
return EX_DAILYMOTION_CONSTANTS.PUBLISHING_KEY;
}

return EX_DAILYMOTION_CONSTANTS.PUBLISHING_KEY + '__' + elementId;
return EX_DAILYMOTION_CONSTANTS.PUBLISHING_KEY + "__" + elementId;
});

const dailyUrl = computed({
get(): string {
return dailyUrlValue.value || '';
return dailyUrlValue.value || "";
},

set(value: string): void {
dailyUrlValue.value = value;
dailyUrlValue.value = value;

data.update({
id: dataId.value,
data: {
config: {
dailyUrl: {
value: dailyUrlValue.value,
source: dailyUrlSource.value,
}
}
data.update({
id: dataId.value,
data: {
config: {
dailyUrl: {
value: dailyUrlValue.value,
source: dailyUrlSource.value,
},
});
}
},
},
});
},
});

onBeforeMount(async () => {
const value = await data.get({
const value = (await data.get({
id: dataId.value,
selectors: dataSelectors,
}) as {
'config.dailyUrl.value': string,
'config.dailyUrl.source': string,
})) as {
"config.dailyUrl.value": string;
"config.dailyUrl.source": string;
};

if (value) {
dailyUrlValue.value = value['config.dailyUrl.value'];
dailyUrlSource.value = value['config.dailyUrl.source'];
dailyUrlValue.value = value["config.dailyUrl.value"];
dailyUrlSource.value = value["config.dailyUrl.source"];
}
});
</script>
</script>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const CMS_DAILYMOTION_ELEMENT_NAME = 'ex-dailymotion';
const CMS_DAILYMOTION_ELEMENT_NAME = "ex-dailymotion";
export default {
CMS_DAILYMOTION_ELEMENT_NAME,
PUBLISHING_KEY: `${CMS_DAILYMOTION_ELEMENT_NAME}__config-element`,
};
CMS_DAILYMOTION_ELEMENT_NAME,
PUBLISHING_KEY: `${CMS_DAILYMOTION_ELEMENT_NAME}__config-element`,
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<template>
<div class="ex-dailymotion-element">
<h2>
Your dailymotion video stuff!
</h2>
<h2>Your dailymotion video stuff!</h2>

<div class="sw-cms-el-dailymotion">
<div class="sw-cms-el-dailymotion-iframe-wrapper">
Expand All @@ -19,69 +17,70 @@
</template>

<script setup lang="ts">
import { ref, computed, onBeforeMount } from 'vue';
import { data } from '@shopware-ag/meteor-admin-sdk';
import EX_DAILYMOTION_CONSTANTS from './ex-dailymotion-constants';
import { ref, computed, onBeforeMount } from "vue";
import { data } from "@shopware-ag/meteor-admin-sdk";
import EX_DAILYMOTION_CONSTANTS from "./ex-dailymotion-constants";

const dataSelectors = [
'config.dailyUrl.value',
'config.dailyUrl.source',
];
const dataSelectors = ["config.dailyUrl.value", "config.dailyUrl.source"];

const dailyUrlValue = ref<string|undefined>(undefined);
const dailyUrlSource = ref<string>('static');
const dailyUrlValue = ref<string | undefined>(undefined);
const dailyUrlSource = ref<string>("static");

const dailyUrl = computed(() => {
const dailymotionURL = dailyUrlValue.value || 'x8hc5d6';
const dailymotionURL = dailyUrlValue.value || "x8hc5d6";

return `https://www.dailymotion.com/embed/video/${dailymotionURL}`;
});

const dataId = computed(() => {
const params = new URLSearchParams(window.location.search);
const elementId = params.get('elementId');
const elementId = params.get("elementId");

if (!elementId) {
return EX_DAILYMOTION_CONSTANTS.PUBLISHING_KEY;
}

return EX_DAILYMOTION_CONSTANTS.PUBLISHING_KEY + '__' + elementId;
return EX_DAILYMOTION_CONSTANTS.PUBLISHING_KEY + "__" + elementId;
});

onBeforeMount(async () => {
const value = await data.get({
const value = (await data.get({
id: dataId.value,
selectors: dataSelectors,
}) as {
'config.dailyUrl.value': string,
'config.dailyUrl.source': string,
})) as {
"config.dailyUrl.value": string;
"config.dailyUrl.source": string;
};

if (value) {
dailyUrlValue.value = value['config.dailyUrl.value'];
dailyUrlSource.value = value['config.dailyUrl.source'];
dailyUrlValue.value = value["config.dailyUrl.value"];
dailyUrlSource.value = value["config.dailyUrl.source"];
}

data.subscribe(
dataId.value,
// @ts-expect-error
elementSubscriber,
{
selectors: dataSelectors,
});
{
selectors: dataSelectors,
},
);
});

function elementSubscriber(response: { data: {
'config.dailyUrl.value': string,
'config.dailyUrl.source': string,
}, id: string }): void {
dailyUrlSource.value = response.data['config.dailyUrl.source'];
dailyUrlValue.value = response.data['config.dailyUrl.value'];
function elementSubscriber(response: {
data: {
"config.dailyUrl.value": string;
"config.dailyUrl.source": string;
};
id: string;
}): void {
dailyUrlSource.value = response.data["config.dailyUrl.source"];
dailyUrlValue.value = response.data["config.dailyUrl.value"];
}
</script>

<style scoped>
.sw-cms-el-dailymotion-iframe-wrapper {
height: 500px;
}
</style>
</style>
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<template>
<h3>
Dailymotion Preview!
</h3>
<h3>Dailymotion Preview!</h3>
</template>
4 changes: 2 additions & 2 deletions examples/admin-sdk-app/src/frontend/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
declare module '*.vue';
declare module "*.vue";

import '@shopware-ag/entity-schema-types';
import "@shopware-ag/entity-schema-types";
24 changes: 12 additions & 12 deletions examples/admin-sdk-app/src/frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Meteor Admin SDK Example App</title>
</head>
<body>
<div id="app"></div>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Meteor Admin SDK Example App</title>
</head>
<body>
<div id="app"></div>

<script type="module" src="./main.ts"></script>
</body>
</html>
<script type="module" src="./main.ts"></script>
</body>
</html>
Loading
Loading