Skip to content

Commit

Permalink
Merge pull request #19 from przemekhernik/feature/prettier-setup
Browse files Browse the repository at this point in the history
feature/prettier setup
  • Loading branch information
przemekhernik committed Apr 9, 2024
2 parents 196745f + 9386386 commit 9506790
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 63 deletions.
3 changes: 2 additions & 1 deletion wp-content/themes/footmate/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
vendor
vendor
node_modules
2 changes: 2 additions & 0 deletions wp-content/themes/footmate/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.lock
*-lock.json
3 changes: 3 additions & 0 deletions wp-content/themes/footmate/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
23 changes: 10 additions & 13 deletions wp-content/themes/footmate/.vite/copy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import crypto from 'crypto';
import{ globSync } from 'glob';
import { globSync } from 'glob';

class Plugin {
constructor() {
Expand All @@ -23,8 +23,8 @@ class Plugin {

if (config.targets) {
this.targets = config.targets
.filter(item => item.src)
.map(item => {
.filter((item) => item.src)
.map((item) => {
return {
src: item.src,
rename: item.rename || this.rename,
Expand Down Expand Up @@ -73,14 +73,14 @@ class Plugin {
}

write() {
if (! this.manifest || ! this.entries.length) {
if (!this.manifest || !this.entries.length) {
return;
}

const manifest = JSON.parse(fs.readFileSync(this.manifest, 'utf-8'));

for (const entry of this.entries) {
if (! manifest[entry.source]) {
if (!manifest[entry.source]) {
manifest[entry.source] = entry;
}
}
Expand All @@ -89,7 +89,7 @@ class Plugin {
}
}

export default function(params) {
export default function (params) {
const plugin = new Plugin();

return {
Expand All @@ -101,11 +101,8 @@ export default function(params) {
dest: build.outDir || 'dist',
rename: build.rollupOptions.output.assetFileNames || '[name]-[hash].[ext]',
targets: params.targets || [],
manifest: typeof build.manifest === 'string'
? build.manifest
: build.manifest === true
? '.vite/manifest.json'
: '',
manifest:
typeof build.manifest === 'string' ? build.manifest : build.manifest === true ? '.vite/manifest.json' : '',
});
},

Expand All @@ -120,5 +117,5 @@ export default function(params) {
closeBundle() {
plugin.write();
},
}
}
};
}
12 changes: 12 additions & 0 deletions wp-content/themes/footmate/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

#### Guiding Principles

- Changelogs are for humans, not machines.
- There should be an entry for every single version.
- The same types of changes should be grouped.
- The latest version comes first.
- The release date of each version is displayed.

#### Types of changes

- `Added` for new features.
- `Changed` for changes in existing functionality.
- `Deprecated` for soon-to-be removed features.
Expand All @@ -19,7 +21,9 @@ All notable changes to this project will be documented in this file. The format
- `BVM Changes` for changes in BVM theme/plugin.

## [Unreleased]

### Added

- Core: `DocHooks` module - https://tentyp.dev/blog/wordpress/dochooks-sugar-syntax-for-hooking-system/
- Core: Add `Config` facade with default values.
- App: Add `Filesystem` object to app facade - https://tentyp.dev/blog/wordpress/introducing-laravel-blade/
Expand All @@ -28,16 +32,24 @@ All notable changes to this project will be documented in this file. The format
- Integrations: Static assets handling in the backend code - https://tentyp.dev/blog/wordpress/vite-2/
- Development: Add .editorconfig - https://tentyp.dev/blog/environment/editorconfig/
- Development: Add php-code-sniffer - https://tentyp.dev/blog/php/phpcodesniffer/
- Development: Prettier - https://tentyp.test/blog/environment/prettier/

### Changed

- App: Use `DocHooks` for handling hooks in the modules - https://tentyp.dev/blog/wordpress/dochooks-sugar-syntax-for-hooking-system/
- App: Remove `Core` facade for separated objects for core submodules.

## [0.1.1] 27.06.2023

### Added

- Core: Widgets module
- Code: Singleton to app facade

## [0.1.0] 09.06.2023

### Added

- Teams: Module facade
- Posts: Module facade
- Teams: CPT
Expand Down
50 changes: 25 additions & 25 deletions wp-content/themes/footmate/composer.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"name": "tentypdev/footmate",
"description": "FootMATE Theme",
"license": "GPLv3",
"autoload": {
"psr-4": {
"FM\\": "app/"
}
},
"authors": [
{
"name": "tentyp.dev",
"email": "tentypdev@gmail.com"
}
],
"require": {
"php": "^8.1",
"illuminate/view": "^10.15",
"illuminate/support": "^10.15"
},
"scripts": {
"lint": "phpcs app",
"format": "phpcbf app"
},
"require-dev": {
"squizlabs/php_codesniffer": "*"
"name": "tentypdev/footmate",
"description": "FootMATE Theme",
"license": "GPLv3",
"autoload": {
"psr-4": {
"FM\\": "app/"
}
},
"authors": [
{
"name": "tentyp.dev",
"email": "tentypdev@gmail.com"
}
],
"require": {
"php": "^8.1",
"illuminate/view": "^10.15",
"illuminate/support": "^10.15"
},
"scripts": {
"lint": "phpcs app",
"format": "phpcbf app"
},
"require-dev": {
"squizlabs/php_codesniffer": "*"
}
}
8 changes: 7 additions & 1 deletion wp-content/themes/footmate/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"engines": {
"node": ">=20.0.0"
},
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
"dev": "vite",
"lint": "prettier . --check",
"format": "prettier . --write"
},
"browserslist": [
"last 2 versions",
Expand All @@ -13,6 +18,7 @@
},
"devDependencies": {
"glob": "^10.3.10",
"prettier": "3.2.5",
"sass": "^1.68.0",
"vite": "^5.0.11"
},
Expand Down
8 changes: 4 additions & 4 deletions wp-content/themes/footmate/resources/scripts/blocks.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Cookies from 'js-cookie';

class Test {
log() {
console.log('blocks');
}
log() {
console.log('blocks');
}
}

const test = new Test();

test.log();
console.log(Cookies.get('wp-settings-time-1'));
console.log(Cookies.get('wp-settings-time-1'));
8 changes: 4 additions & 4 deletions wp-content/themes/footmate/resources/scripts/scripts.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Cookies from 'js-cookie';

class Test {
log() {
console.log('scripts');
}
log() {
console.log('scripts');
}
}

const test = new Test();

test.log();
console.log(Cookies.get('wp-settings-time-1'));
console.log(Cookies.get('wp-settings-time-1'));
17 changes: 10 additions & 7 deletions wp-content/themes/footmate/resources/styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,29 @@
font-style: normal;
font-weight: 300;
font-display: swap;
src: url('../fonts/Montserrat-Light.woff2') format('woff2'),
url('../fonts/Montserrat-Light.woff') format('woff');
src:
url('../fonts/Montserrat-Light.woff2') format('woff2'),
url('../fonts/Montserrat-Light.woff') format('woff');
}

@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('../fonts/Montserrat-Regular.woff2') format('woff2'),
url('../fonts/Montserrat-Regular.woff') format('woff');
src:
url('../fonts/Montserrat-Regular.woff2') format('woff2'),
url('../fonts/Montserrat-Regular.woff') format('woff');
}

@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('../fonts/Montserrat-Bold.woff2') format('woff2'),
url('../fonts/Montserrat-Bold.woff') format('woff');
src:
url('../fonts/Montserrat-Bold.woff2') format('woff2'),
url('../fonts/Montserrat-Bold.woff') format('woff');
}

html {
Expand Down Expand Up @@ -86,4 +89,4 @@ ul {
max-width: 30%;
padding: 0 20px;
}
}
}
2 changes: 1 addition & 1 deletion wp-content/themes/footmate/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
* Requires PHP: 8.1
* Requires at least: 6.2
*/
*/
10 changes: 3 additions & 7 deletions wp-content/themes/footmate/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path';
import { defineConfig } from 'vite';
import copy from './.vite/copy';

const ROOT = path.resolve('../../../')
const ROOT = path.resolve('../../../');
const BASE = __dirname.replace(ROOT, '');

export default defineConfig({
Expand All @@ -13,11 +13,7 @@ export default defineConfig({
outDir: `dist`,
emptyOutDir: true,
rollupOptions: {
input: [
'resources/scripts/scripts.js',
'resources/styles/styles.scss',
'resources/scripts/blocks.js',
],
input: ['resources/scripts/scripts.js', 'resources/styles/styles.scss', 'resources/scripts/blocks.js'],
output: {
entryFileNames: '[hash].js',
assetFileNames: '[hash].[ext]',
Expand All @@ -42,4 +38,4 @@ export default defineConfig({
},
},
],
});
});
5 changes: 5 additions & 0 deletions wp-content/themes/footmate/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,11 @@ postcss@^8.4.32:
picocolors "^1.0.0"
source-map-js "^1.0.2"

prettier@3.2.5:
version "3.2.5"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368"
integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==

readdirp@~3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7"
Expand Down

0 comments on commit 9506790

Please sign in to comment.