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

Auto-format files with prettier, add vscode settings, fixes #281 #287

Merged
merged 5 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
run: npm ci
- name: Lint
run: npm run textlint
- name: Prettier
run: npx prettier --check .
- name: Install, build, and upload your site output
uses: withastro/action@v2
with:
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.vscode
# vscode project settings
.vscode/**/*
!/.vscode/settings.json
!/.vscode/extensions.json


# build output
dist/
Expand Down
6 changes: 3 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"semi": false,
"singleQuote": false,
"trailingComma": "es5"
"semi": false,
"singleQuote": false,
"trailingComma": "es5"
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"EditorConfig.EditorConfig",
"astro-build.astro-vscode"
]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ All commands are run from the root of the project, from a terminal:
| `npm run textlint` | Run textlint on content collections |
| `npm run textlint:fix` | Apply fixable updates to resolve textlint errors |



### Local Development Setup

#### DDEV setup
Expand All @@ -66,15 +64,15 @@ DDEV already has all the dependencies included.

To rebuild a static copy of the site, run `ddev npm run build`. The contents of the `dist/` folder are what gets [deployed to Cloudflare Pages](#build--deployment) and can be found at https://<projectname>.ddev.site. The dev server runs on a web_extra_daemons, it includes Vite HMR (hot module reloading) among other features and it can be found at https://<projectname>.ddev.site:4321.

Troubleshooting steps: Check `ddev logs`.
Troubleshooting steps: Check `ddev logs`.

#### Setup without DDEV

Check out the project in your favorite Node.js environment, ideally running [`nvm`](https://github.com/nvm-sh/nvm). We’ll install dependencies, add a GitHub API key, and run a local dev server with a hot-reloading browser URL.

1. Run `nvm use` to make sure you’re running an appropriate Node.js version.
2. Run `npm install` to set up the project’s dependencies.
3. Run `npm run dev` to start Astro’s dev server. If it fails then run `npm cache clean --force && npm install && npm run dev`.
3. Run `npm run dev` to start Astro’s dev server. If it fails then run `npm cache clean --force && npm install && npm run dev`.
4. Visit the URL displayed in your terminal. (Probably `http://localhost:4321/`.) The site will automatically refresh as you work on it, displaying errors in the relevant terminal or browser console.

To generate a static copy of the site, run `npm run build`. The contents of the `dist/` folder are exactly what get [deployed to Cloudflare Pages](#build--deployment). You can preview locally by running `npm run preview` or using a tool like [`serve`](https://www.npmjs.com/package/serve).
Expand All @@ -85,7 +83,7 @@ Make sure to delete your `node_modules/` directory and run `ddev npm install`. T

#### GitHub Token

This step is not required if you just want to contribute a blog post to ddev.com.
This step is not required if you just want to contribute a blog post to ddev.com.

Contributors, sponsors, releases and more data about DDEV is retrieved dynamically from the GitHub API. To test this, please follow these steps:

Expand Down Expand Up @@ -154,6 +152,23 @@ Textlint’s [default terminology](https://github.com/sapegin/textlint-rule-term

Run `npm run textlint` to check everything, and you can apply “fixable” changes using `npm run textlint:fix`. Be careful automating fixes to be sure they don’t have any unintended side effects!

### Prettier and EditorConfig

Prettier is used for auto-formatting files, see `.prettierrc`. EditorConfig is used for basic IDE settings, see `.editorconfig`. The EditorConfig configuration is [automatically parsed by Prettier](https://prettier.io/docs/en/configuration.html#editorconfig).

If you work with Visual Studio Code, please install these three extensions:

- https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
- https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig
- https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode

Auto-format on save is activated via `.vscode/settings.json` for Visual Studio Code.

General commands:

- Use `npx prettier --check .` to verify everything is properly formatted
- Use `npx prettier --write .` to auto-format all files

### Sponsor Management

The `src/featured-sponsors.json` file is used for manually curating prominent sponsors.
Expand Down Expand Up @@ -190,8 +205,8 @@ If you’re adding a new item to the array, choose whichever position it should

Any redirect can be added to ddev.com by editing `public/_redirects`. This can be useful to provide short redirects in a variety of contexts. Redirects can be to local URLs or to DDEV docs, for example.

* Most redirects should be listed as `301` for a permanent redirect.
* Short links can be prefixed with `/s` to imply their nature. For example, `/s/port-conflict`
- Most redirects should be listed as `301` for a permanent redirect.
- Short links can be prefixed with `/s` to imply their nature. For example, `/s/port-conflict`

## Build & Deployment

Expand Down
5 changes: 3 additions & 2 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { plainTextPlugin } from "@barnabask/astro-minisearch"
import { remarkReadingTime } from "./src/lib/remark-reading-time.mjs"
import prefetch from "@astrojs/prefetch"
import react from "@astrojs/react"
import rehypeAstroRelativeMarkdownLinks from "astro-rehype-relative-markdown-links";
import rehypeAstroRelativeMarkdownLinks from "astro-rehype-relative-markdown-links"
import robotsTxt from "astro-robots-txt"
import searchIndex from "./src/lib/search-index.js"
import sitemap from "@astrojs/sitemap"
Expand All @@ -16,7 +16,8 @@ export default defineConfig({
vite: {
server: {
host: true, // leave this unchanged for DDEV!
}},
},
},
integrations: [
tailwind(),
react(),
Expand Down
51 changes: 28 additions & 23 deletions src/const.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
export const SITE_TITLE = 'DDEV';
export const SITE_DESCRIPTION = 'Docker-based local PHP+Node.js web development environments.';
export const STORE_URL = 'https://ddev.threadless.com';
export const BLUESKY_URL = 'https://bsky.app/profile/ddev.bsky.social';
export const GITHUB_REPO = 'ddev/ddev';
export const GITHUB_URL = 'https://github.com/ddev/ddev';
export const GITHUB_URL_WEBSITE = 'https://github.com/ddev/ddev.com/tree/main/src/content/blog';
export const GITHUB_ISSUES_URL = 'https://github.com/ddev/ddev/issues';
export const DOCUMENTATION_URL = 'https://ddev.readthedocs.io/';
export const DISCORD_URL = 'https://discord.gg/5wjP76mBJD';
export const SITE_TITLE = "DDEV"
export const SITE_DESCRIPTION =
"Docker-based local PHP+Node.js web development environments."
export const STORE_URL = "https://ddev.threadless.com"
export const BLUESKY_URL = "https://bsky.app/profile/ddev.bsky.social"
export const GITHUB_REPO = "ddev/ddev"
export const GITHUB_URL = "https://github.com/ddev/ddev"
export const GITHUB_URL_WEBSITE =
"https://github.com/ddev/ddev.com/tree/main/src/content/blog"
export const GITHUB_ISSUES_URL = "https://github.com/ddev/ddev/issues"
export const DOCUMENTATION_URL = "https://ddev.readthedocs.io/"
export const DISCORD_URL = "https://discord.gg/5wjP76mBJD"
export const EMAIL_URL = "mailto:support%40ddev.com"
export const COPYRIGHT_HOLDER = 'DDEV Foundation'
export const MASTODON_URL = 'https://fosstodon.org/@ddev'
export const ORG_STREET = '848 Montclair Dr'
export const ORG_CITY = 'Palisade'
export const ORG_STATE = 'Colorado'
export const ORG_STATE_ABBR = 'CO'
export const ORG_POSTAL_CODE = '81526'
export const ORG_COUNTRY = 'US'
export const ORG_NAME = 'DDEV Foundation'
export const ORG_EMAIL = '[email protected]'
export const ORG_PHONE = '(970) 462-7450'
export const ORG_FOUNDED = '2021-09-02'
export const ORG_SAME_AS = ["https://github.com/ddev", "https://localdev.foundation"]
export const COPYRIGHT_HOLDER = "DDEV Foundation"
export const MASTODON_URL = "https://fosstodon.org/@ddev"
export const ORG_STREET = "848 Montclair Dr"
export const ORG_CITY = "Palisade"
export const ORG_STATE = "Colorado"
export const ORG_STATE_ABBR = "CO"
export const ORG_POSTAL_CODE = "81526"
export const ORG_COUNTRY = "US"
export const ORG_NAME = "DDEV Foundation"
export const ORG_EMAIL = "[email protected]"
export const ORG_PHONE = "(970) 462-7450"
export const ORG_FOUNDED = "2021-09-02"
export const ORG_SAME_AS = [
"https://github.com/ddev",
"https://localdev.foundation",
]
export const BLOG_DESCRIPTION = `Posts about DDEV, Docker, and local development.`
2 changes: 1 addition & 1 deletion src/content/authors/bernardo-martinez.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ firstName: Bernardo
avatarUrl: /img/avatar/bernardo.png
---

[Bernardo](https://github.com/bmartinez287) has worked as a web developer for HigherEd, Government, and Nonprofits. His computer science background triggers his curiosity to explore a different aspects of software engineering from devOps/sysadmin to mobile development. However, his specialty for the past 5 years has been with Drupal and WordPress. In his free time, he enjoys CrossFit, running, and other outdoor adventures. After years of Drupal work, he is delighted to increase his open source contributions and empower others to do so.
[Bernardo](https://github.com/bmartinez287) has worked as a web developer for HigherEd, Government, and Nonprofits. His computer science background triggers his curiosity to explore a different aspects of software engineering from devOps/sysadmin to mobile development. However, his specialty for the past 5 years has been with Drupal and WordPress. In his free time, he enjoys CrossFit, running, and other outdoor adventures. After years of Drupal work, he is delighted to increase his open source contributions and empower others to do so.
2 changes: 1 addition & 1 deletion src/content/authors/jochen-roth.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ firstName: Jochen
avatarUrl: https://avatars.githubusercontent.com/u/4623070
---

Jochen works at B13 creating websites based on TYPO3.
Jochen works at B13 creating websites based on TYPO3.
2 changes: 1 addition & 1 deletion src/content/authors/lasse-blomenkemper.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ firstName: Lasse
avatarUrl: /img/avatar/lasse.jpg
---

Lasse Blomenkemper is the Chief Technology Officer at [i-gelb](https://i-gelb.net) located in Cologne. He has a passion for solving all kinds of problems, mostly using code.
Lasse Blomenkemper is the Chief Technology Officer at [i-gelb](https://i-gelb.net) located in Cologne. He has a passion for solving all kinds of problems, mostly using code.
14 changes: 7 additions & 7 deletions src/content/authors/matt-stein.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Matt Stein
firstName: Matt
avatarUrl: /img/avatar/matt.png
---
[Matt](https://github.com/mattstein) is a designer that’s been doing CMS-based development for clients using PHP, Twig, and different front-end frameworks. He's fond of writing, documentation, and content strategy.
---
name: Matt Stein
firstName: Matt
avatarUrl: /img/avatar/matt.png
---

[Matt](https://github.com/mattstein) is a designer that’s been doing CMS-based development for clients using PHP, Twig, and different front-end frameworks. He's fond of writing, documentation, and content strategy.
14 changes: 7 additions & 7 deletions src/content/authors/tony-groff.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Tony Groff
firstName: Tony
avatarUrl: https://0.gravatar.com/avatar/9161de1c0e26f072027556f27df02a3f6abba5693bf6f6585e10b23d7e92182e?size=128
---
[Tony](https://www.drupal.org/u/rowbotony) has been an *Ambitious Site Builder* since his career began in the late '90s at a wireless broadband startup working with Perl and PHP on Unix systems. He began freelancing in 2003. His first website launched in 1997, and by 2010, he was proficient in Drupal, completing an impactful non-profit project. He admires Drupal's adaptability, versatility, and longevity as a web platform.
---
name: Tony Groff
firstName: Tony
avatarUrl: https://0.gravatar.com/avatar/9161de1c0e26f072027556f27df02a3f6abba5693bf6f6585e10b23d7e92182e?size=128
---

[Tony](https://www.drupal.org/u/rowbotony) has been an _Ambitious Site Builder_ since his career began in the late '90s at a wireless broadband startup working with Perl and PHP on Unix systems. He began freelancing in 2003. His first website launched in 1997, and by 2010, he was proficient in Drupal, completing an impactful non-profit project. He admires Drupal's adaptability, versatility, and longevity as a web platform.
Loading
Loading