Skip to content

Commit

Permalink
style: 🎨 πŸ’„ update cs
Browse files Browse the repository at this point in the history
  • Loading branch information
woldtwerk committed Nov 20, 2023
1 parent 18be6e7 commit 948cab9
Show file tree
Hide file tree
Showing 23 changed files with 145 additions and 141 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages/tailwind/README.md
packages/vite-plugin-drupal/README.md
packages/vite-plugin-drupal/types/drupal.d.ts
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ jobs:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
job: ${{ toJson(job) }}
steps: ${{ toJson(steps) }}
overwrite: "{title: `Release uebertool ${github.ref}`}"
overwrite: '{title: `Release uebertool ${github.ref}`}'
10 changes: 5 additions & 5 deletions .github/workflows/subtree.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Subtree Split for composer packages
name: Subtree Split for composer packages

on:
push:
branches:
- 'main'
- main
tags:
- 'v*'
create:
Expand All @@ -26,7 +26,7 @@ jobs:

- uses: nxtlvlsoftware/git-subtree-action@1.1
with:
repo: 'ueberbit/subtree-uebertool-companion'
path: 'packages/uebertool-companion'
repo: ueberbit/subtree-uebertool-companion
path: packages/uebertool-companion
deploy_key: ${{ secrets.SUBTREE_SPLIT_PRIVATE_KEY }}
force: true
force: true
10 changes: 5 additions & 5 deletions packages/drupal-storybook/scripts/postInstall.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from 'path'
import path from 'node:path'
import process from 'node:process'
import fs from 'fs-extra'

const cwd = process.env.INIT_CWD || ''
Expand All @@ -8,15 +9,15 @@ const storybookDir = '.storybook'
if (cwd === process.cwd())
process.exit()

const copyLibs = async () => {
async function copyLibs() {
!fs.pathExistsSync(path.join(cwd, storybookDir))
&& await fs.copy(
path.join(base, 'src'),
path.join(cwd, '.storybook'),
)
}

const prepareJSON = async () => {
async function prepareJSON() {
const pkgJson = await fs.readJSON(path.join(cwd, 'package.json'))

const deps = [...Object.keys(pkgJson.dependencies), ...Object.keys(pkgJson.devDependencies)]
Expand All @@ -35,8 +36,7 @@ const prepareJSON = async () => {

await fs.writeJSON(path.join(cwd, 'package.json'), pkgJson, { spaces: 2 })
}

;(async () => {
(async () => {
await prepareJSON()
await copyLibs()
})()
2 changes: 1 addition & 1 deletion packages/drupal-storybook/src/namespaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Global namespaces
*/

const path = require('path')
const path = require('node:path')

module.exports = {
ueberbit: path.resolve(__dirname, '..', 'templates'),
Expand Down
1 change: 1 addition & 0 deletions packages/drupal-storybook/src/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { configure, initJsBehaviors } from '@wingsuit-designsystem/storybook'
import { TwingRenderer } from '@wingsuit-designsystem/pattern'
import { addParameters } from '@storybook/react'
import resolveConfig from 'tailwindcss/resolveConfig'

// import { TwingFunction } from 'twing'

import tailwindConfig from '../tailwind.config'
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-drupal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('node:fs')
* Check if project is Drupal.
* @returns {boolean} true if project is Drupal.
*/
const isDrupal = () => {
function isDrupal() {
let drupal = false

// Drupal Root.
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss/src/plugins/stripcolor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Strip away color function of current declaration.
*/
const plugin = () => {
function plugin() {
return {
postcssPlugin: 'postcss-strip-color',
Declaration(decl: any) {
Expand Down
4 changes: 2 additions & 2 deletions packages/tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwind/src/remCalc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @param {number} precision - Precision of decimal value.
* @returns {string} Pixel value relative to base.
*/
export const remCalc = (px: number, base = 16, precision = 3) => {
export function remCalc(px: number, base = 16, precision = 3) {
return `${(px / base)
.toFixed(precision)
.replace(/\.?0*$/, '')}rem`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ services:
uebertool_asset_renderer.js.collection_renderer:
class: Drupal\uebertool_asset_renderer\Asset\JsCollectionRendererDecorator
decorates: asset.js.collection_renderer
arguments: [ '@uebertool_asset_renderer.js.collection_renderer.inner' ]
arguments: ['@uebertool_asset_renderer.js.collection_renderer.inner']
uebertool_asset_renderer.css.collection_renderer:
class: Drupal\uebertool_asset_renderer\Asset\CssCollectionRendererDecorator
decorates: asset.css.collection_renderer
arguments: [ '@uebertool_asset_renderer.css.collection_renderer.inner' ]
arguments: ['@uebertool_asset_renderer.css.collection_renderer.inner']
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
field.formatter.third_party.uebertool_pswp:
type: mapping
label: 'Photoswipe'
label: Photoswipe
mapping:
pswp:
type: boolean
label: 'Enabled'
label: Enabled
pswp_style:
type: string
label: 'Style'
label: Style
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ services:
uebertool_twig.twig.extension:
class: Drupal\uebertool_twig\Twig\Extension\TwigExtrasExtension
tags:
- { name: twig.extension }
- {name: twig.extension}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ services:
- '@theme.manager'
- '@library.discovery'
tags:
- { name: twig.loader, priority: 300 }

- {name: twig.loader, priority: 300}
12 changes: 6 additions & 6 deletions packages/vite-plugin-drupal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./composables": {
"types": "./dist/composables.d.ts",
"require": "./dist/composables.cjs",
"import": "./dist/composables.mjs"
"import": "./dist/composables.mjs",
"require": "./dist/composables.cjs"
},
"./ApiCustomElements": {
"types": "./dist/ce/ApiCustomElements.d.ts",
"require": "./dist/ce/ApiCustomElements.cjs",
"import": "./dist/ce/ApiCustomElements.mjs"
"import": "./dist/ce/ApiCustomElements.mjs",
"require": "./dist/ce/ApiCustomElements.cjs"
}
},
"main": "dist/index.cjs",
Expand Down
6 changes: 2 additions & 4 deletions packages/vite-plugin-drupal/src/ce/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ export const supportsAdoptingStyleSheets = window.ShadowRoot && 'adoptedStyleShe
* @param styles The styles of the Element.
* @param __hmrId hmr id of vite used as an UUID.
*/
export const adoptStyles = (
renderRoot: ShadowRoot | Document,
export function adoptStyles(renderRoot: ShadowRoot | Document,
styles: string[] | CSSStyleSheet,
__hmrId: string | undefined,
) => {
__hmrId: string | undefined) {
// If passed a CSSStylesheet just apply it.
if (styles instanceof CSSStyleSheet) {
renderRoot.adoptedStyleSheets = [styles]
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin-drupal/src/ce/useHMR.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getCurrentInstance, onUpdated } from 'vue'
import { adoptStyles } from './styles'

export const useHMR = () => {
export function useHMR() {
onUpdated(() => {
const shadowRoot = getCurrentInstance()?.vnode?.el?.getRootNode()
const styles = Array.from((document.querySelectorAll('link[href*="tailwind"]')[0] as HTMLStyleElement).sheet?.cssRules || []).reduce((acc, curr: any) => acc + curr.cssText, '')
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin-drupal/src/ce/useStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { adoptStyles } from './styles'
* Mounting normal vue components inside a vue custom elements discards the css.
* To fix this the styles are applied to the renderRoot.
*/
export const useStyles = () => {
export function useStyles() {
onMounted(() => {
const instance = getCurrentInstance()

Expand Down
1 change: 1 addition & 0 deletions packages/vite-plugin-drupal/src/plugins/breakpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { Context } from './context'
* @param theme Breakpoint theme.
* @param group Breakpoint group.
* @param name Breakpoint name.
* @param multipliers Breakpoint multipliers.
* @param size Breakpoint size.
* @returns Drupal Breakpoint entry.
*/
Expand Down
1 change: 1 addition & 0 deletions packages/vite-plugin-drupal/src/plugins/custom-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default (ctx: Context): Plugin => {
lazy: lazyLoader,
}

// eslint-disable-next-line @typescript-eslint/ban-types
function cacheStringFunction(fn: Function) {
const cache = Object.create(null)
return (str: string) => {
Expand Down
9 changes: 5 additions & 4 deletions packages/vite-plugin-drupal/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import fs from 'node:fs'
import process from 'node:process'
import path from 'node:path'

export const getThemeName = (): string => {
export function getThemeName(): string {
let name = ''
try {
const files = fs.readdirSync(process.cwd())
Expand All @@ -14,15 +15,15 @@ export const getThemeName = (): string => {
return name
}

export const getThemeBasePath = (): string => {
export function getThemeBasePath(): string {
return process.cwd().split('/web').at(-1) || `/themes/custom/${getThemeName}`
}

export const getDistThemeName = (): string => {
export function getDistThemeName(): string {
return `${getThemeName()}_dist`
}

export const getNameSpace = (name: string) => {
export function getNameSpace(name: string) {
return {
...(name && { [name]: path.resolve(process.cwd(), 'templates') }),
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin-drupal/types/dom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ declare global {
}
}

export {}
export {}
Loading

0 comments on commit 948cab9

Please sign in to comment.