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

feature/prettier setup #19

Merged
merged 6 commits into from Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion wp-content/themes/footmate/.gitignore
@@ -1,2 +1,3 @@
dist
vendor
vendor
node_modules
2 changes: 2 additions & 0 deletions wp-content/themes/footmate/.prettierignore
@@ -0,0 +1,2 @@
*.lock
*-lock.json
3 changes: 3 additions & 0 deletions wp-content/themes/footmate/.prettierrc
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
23 changes: 10 additions & 13 deletions wp-content/themes/footmate/.vite/copy.js
@@ -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
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
@@ -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
@@ -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
@@ -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
@@ -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
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
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
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
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