summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2023-03-17 09:34:30 -0400
committerseth <[email protected]>2023-03-17 09:34:30 -0400
commite73226622083deb3ec5289ea517b9963e1998b77 (patch)
tree7de4b8754181a56ca97c23b54facaa8baf21b643
parentb33c5d086dddf4462121ac7cfc60e2ac4e0093e2 (diff)
feat(actions): add prettier format action
-rw-r--r--.editorconfig4
-rw-r--r--.github/workflows/deploy.yaml50
-rw-r--r--.github/workflows/format.yaml31
-rw-r--r--.prettierrc3
-rw-r--r--_config.ts27
-rw-r--r--deno.json16
-rw-r--r--src/js/chrisApp.js28
7 files changed, 94 insertions, 65 deletions
diff --git a/.editorconfig b/.editorconfig
index 059f2de..b69d331 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -6,3 +6,7 @@ insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 4
+
+[*.yaml]
+indent_style = space
+indent_size = 2
diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml
index b79089c..34a8c38 100644
--- a/.github/workflows/deploy.yaml
+++ b/.github/workflows/deploy.yaml
@@ -1,38 +1,38 @@
name: deploy to gh pages
on:
- push:
- branches: [main]
- workflow_dispatch:
+ push:
+ branches: [main]
+ workflow_dispatch:
permissions:
- contents: read
- pages: write
- id-token: write
+ contents: read
+ pages: write
+ id-token: write
jobs:
- build:
- runs-on: ubuntu-latest
+ build:
+ runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
+ steps:
+ - uses: actions/checkout@v3
- - name: setup deno
- uses: denoland/setup-deno@v1
- with:
- deno-version: v1.31.3
+ - name: setup deno
+ uses: denoland/setup-deno@v1
+ with:
+ deno-version: v1.31.3
- - name: build site
- run: deno task build
+ - name: build site
+ run: deno task build
- - name: setup pages
- uses: actions/configure-pages@v3
+ - name: setup pages
+ uses: actions/configure-pages@v3
- - name: upload artifact
- uses: actions/upload-pages-artifact@v1
- with:
- path: '_site'
+ - name: upload artifact
+ uses: actions/upload-pages-artifact@v1
+ with:
+ path: "_site"
- - name: deploy
- id: deployment
- uses: actions/deploy-pages@v1
+ - name: deploy
+ id: deployment
+ uses: actions/deploy-pages@v1
diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml
new file mode 100644
index 0000000..4b96fb3
--- /dev/null
+++ b/.github/workflows/format.yaml
@@ -0,0 +1,31 @@
+name: format
+
+on:
+ pull_request:
+ branches: [main]
+ push:
+ branches: [main]
+
+jobs:
+ format:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: checkout repository
+ uses: actions/checkout@v3
+
+ - name: setup node
+ uses: actions/setup-node@v3
+
+ - name: install prettier
+ run: |
+ npm install -g prettier
+
+ - name: format
+ run: prettier --editorconfig -w .
+
+ - name: add and commit
+ uses: EndBug/add-and-commit@v9
+ with:
+ default_author: github_actions
+ message: "chore: format with prettier"
diff --git a/.prettierrc b/.prettierrc
deleted file mode 100644
index 0cb0c2c..0000000
--- a/.prettierrc
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "editorconfig": true
-} \ No newline at end of file
diff --git a/_config.ts b/_config.ts
index 1a2f473..b2b79ce 100644
--- a/_config.ts
+++ b/_config.ts
@@ -8,8 +8,8 @@ import sass from "lume/plugins/sass.ts";
import sitemap from "lume/plugins/sitemap.ts";
const site = lume({
- src: "./src",
- location: new URL("https://getchoo.github.io"),
+ src: "./src",
+ location: new URL("https://getchoo.github.io"),
});
site.use(attributes());
@@ -21,23 +21,20 @@ site.use(sass());
site.use(sitemap());
const getGitRevision = async () => {
- const p = Deno.run({
- cmd: ["git", "rev-parse", "HEAD"],
- stdout: "piped",
- });
- const [status, output] = await Promise.all([p.status(), p.output()]);
+ const p = Deno.run({
+ cmd: ["git", "rev-parse", "HEAD"],
+ stdout: "piped",
+ });
+ const [status, output] = await Promise.all([p.status(), p.output()]);
- if (status.success) {
- return new TextDecoder().decode(output).trim();
- }
+ if (status.success) {
+ return new TextDecoder().decode(output).trim();
+ }
- return null;
+ return null;
};
-site.data(
- "gitRevision",
- await getGitRevision(),
-);
+site.data("gitRevision", await getGitRevision());
site.ignore("README.md", "LICENSE", ".gitignore", ".gitattributes");
diff --git a/deno.json b/deno.json
index dd0c13e..9cb4dc6 100644
--- a/deno.json
+++ b/deno.json
@@ -1,10 +1,10 @@
{
- "tasks": {
- "lume": "echo \"import 'lume/cli.ts'\" | deno run --unstable -A -",
- "build": "deno task lume",
- "serve": "deno task lume -s"
- },
- "imports": {
- "lume/": "https://deno.land/x/[email protected]/"
- }
+ "tasks": {
+ "lume": "echo \"import 'lume/cli.ts'\" | deno run --unstable -A -",
+ "build": "deno task lume",
+ "serve": "deno task lume -s"
+ },
+ "imports": {
+ "lume/": "https://deno.land/x/[email protected]/"
+ }
}
diff --git a/src/js/chrisApp.js b/src/js/chrisApp.js
index 4881b7a..133b16d 100644
--- a/src/js/chrisApp.js
+++ b/src/js/chrisApp.js
@@ -1,22 +1,22 @@
const chrisURL = "/imgs/chris/";
function randomChris() {
- const files = [
- "chis_very_fried.jpg",
- "chris_medium_fried.jpg",
- "chris_moshed.jpg",
- "fried_publisher.jpg",
- "help_me.png",
- "nice_chris.png",
- "nice_publisher.png",
- "bkender_bauob.jpg",
- "blurry_chris.jpg",
- ];
+ const files = [
+ "chis_very_fried.jpg",
+ "chris_medium_fried.jpg",
+ "chris_moshed.jpg",
+ "fried_publisher.jpg",
+ "help_me.png",
+ "nice_chris.png",
+ "nice_publisher.png",
+ "bkender_bauob.jpg",
+ "blurry_chris.jpg",
+ ];
- // this chooses a random file from the array
- const url = chrisURL + files[Math.floor(Math.random() * files.length)];
+ // this chooses a random file from the array
+ const url = chrisURL + files[Math.floor(Math.random() * files.length)];
- window.location.href = url;
+ window.location.href = url;
}
const chris = document.getElementById("chris_gif");