Skip to content

Commit

Permalink
Merge pull request #582 from artichoke/lopopolo/prettier-3.x
Browse files Browse the repository at this point in the history
Reformat with prettier 3.0.0
  • Loading branch information
lopopolo authored Jul 18, 2023
2 parents 17679c5 + 93afcc2 commit 8110567
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 15 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3.5.3

- name: Install Node.js toolchain
uses: actions/setup-node@v3.6.0
with:
node-version: 18

- name: Install toolchain
run: npm ci

- name: Lint and check formatting with prettier
run: npx prettier --check '**/*'

Expand Down
12 changes: 6 additions & 6 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ marked.use(
const html = highlighted.value;
return html;
},
})
}),
);

const includeMarkdown = (source) => {
Expand All @@ -106,7 +106,7 @@ const renderTemplate = async (template, locale) => {
const context = {
locale,
locales: Object.fromEntries(
locales.map((locale) => [locale.language, locale])
locales.map((locale) => [locale.language, locale]),
),
defaultLocale: locales.find((locale) => locale.default),
t,
Expand Down Expand Up @@ -166,7 +166,7 @@ const copyAssets = async (outdir, socialAssetDir, logosAssetDir) => {
return;
}
await fs.copyFile(asset, path.join(outdir, file));
})
}),
);
};

Expand All @@ -179,16 +179,16 @@ const build = async () => {
locales.map(async (locale) => {
let index = await renderTemplate("index.html", locale);
const indexOut = path.normalize(
path.join(outdir, locale.pathPrefix, "index.html")
path.join(outdir, locale.pathPrefix, "index.html"),
);
await fs.writeFile(indexOut, index);

let install = await renderTemplate("install.html", locale);
const installOut = path.normalize(
path.join(outdir, locale.pathPrefix, "install", "index.html")
path.join(outdir, locale.pathPrefix, "install", "index.html"),
);
await fs.writeFile(installOut, install);
})
}),
);

await esbuild.build({
Expand Down
18 changes: 17 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"eta": "^2.2.0",
"highlight.js": "^11.8.0",
"marked": "^5.0.4",
"marked-highlight": "^2.0.1"
"marked-highlight": "^2.0.1",
"prettier": "^3.0.0"
},
"eslintConfig": {
"env": {
Expand All @@ -49,7 +50,7 @@
"clean": "rm -rf dist",
"dev:debug": "npx concurrently \"npm:serve\" \"npm:watch:debug\"",
"dev:release": "npx concurrently \"npm:serve\" \"npm:watch:release\"",
"fmt": "npx prettier --write \"**/*\"",
"fmt": "prettier --write \"**/*\"",
"lint": "npx eslint . --ext .js,.jsx,.mjs,.ts,.tsx",
"lint:fix": "npx eslint . --ext .js,.jsx,.mjs,.ts,.tsx --fix",
"release:markdown_link_check": "find . -name '*.md' -and -not -path '*/node_modules/*' | sort | xargs -n1 npx markdown-link-check --config .github/markdown-link-check.json",
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="<%= it.language %>" dir="ltr">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion src/install.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
Expand Down
26 changes: 22 additions & 4 deletions src/partials/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,34 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<!-- prettier-ignore -->
<a class="nav-link <% if (it.page === 'home') { %> active" aria-current="page" <% } else { %> " <% } %> href="<%= it.locale.links.home %>">
<% if (it.page === 'home') { %>
<a
class="nav-link active"
aria-current="page"
href="<%= it.locale.links.home %>"
>
<%= it.t.home %>
</a>
<% } else { %>
<a class="nav-link" href="<%= it.locale.links.home %>">
<%= it.t.home %>
</a>
<% } %>
</li>
<li class="nav-item">
<!-- prettier-ignore -->
<a class="nav-link <% if (it.page === 'install') { %> active" aria-current="page" <% } else { %> " <% } %> href="<%= it.locale.links.install %>">
<% if (it.page === 'install') { %>
<a
class="nav-link active"
aria-current="page"
href="<%= it.locale.links.install %>"
>
<%= it.t.install %>
</a>
<% } else { %>
<a class="nav-link" href="<%= it.locale.links.install %>">
<%= it.t.install %>
</a>
<% } %>
</li>
<li class="nav-item">
<a class="nav-link" href="https://artichoke.run">Playground</a>
Expand Down

0 comments on commit 8110567

Please sign in to comment.