From 5accc2ffc495abc0725d8cc445f3b4d1c72b5aa1 Mon Sep 17 00:00:00 2001 From: winston Date: Sat, 18 Nov 2023 06:54:02 +0100 Subject: [PATCH 1/2] ci: move `src` -> `scripts`, `deno.json` to repo root --- .github/workflows/deno-check.yml | 3 +-- .github/workflows/generate.yml | 7 +++---- .github/workflows/lint.yml | 3 +-- .github/workflows/maintainers.yml | 7 +++---- .vscode/settings.json | 1 - src/deno.json => deno.json | 12 ++++++------ src/deno.lock => deno.lock | 0 {src => scripts}/deps.ts | 0 {src => scripts}/generate/main.ts | 2 +- .../generate/templates/userstyle-issue.yml | 0 {src => scripts}/generate/templates/userstyle.md | 0 {src => scripts}/lint/file-checker.ts | 0 {src => scripts}/lint/logger.ts | 0 {src => scripts}/lint/main.ts | 0 {src => scripts}/lint/metadata.ts | 0 {src => scripts}/lint/stylelint.ts | 0 {src => scripts}/sync-maintainers/main.ts | 2 +- {src => scripts}/types.d.ts | 0 {src => scripts}/types/userstyles.d.ts | 0 {src => scripts}/userstyles.schema.json | 0 {src => scripts}/userstyles.yml | 2 +- 21 files changed, 17 insertions(+), 22 deletions(-) rename src/deno.json => deno.json (61%) rename src/deno.lock => deno.lock (100%) rename {src => scripts}/deps.ts (100%) rename {src => scripts}/generate/main.ts (99%) rename {src => scripts}/generate/templates/userstyle-issue.yml (100%) rename {src => scripts}/generate/templates/userstyle.md (100%) rename {src => scripts}/lint/file-checker.ts (100%) rename {src => scripts}/lint/logger.ts (100%) rename {src => scripts}/lint/main.ts (100%) rename {src => scripts}/lint/metadata.ts (100%) rename {src => scripts}/lint/stylelint.ts (100%) rename {src => scripts}/sync-maintainers/main.ts (97%) rename {src => scripts}/types.d.ts (100%) rename {src => scripts}/types/userstyles.d.ts (100%) rename {src => scripts}/userstyles.schema.json (100%) rename {src => scripts}/userstyles.yml (99%) diff --git a/.github/workflows/deno-check.yml b/.github/workflows/deno-check.yml index 57dc7ad2db..4aced7e7d9 100644 --- a/.github/workflows/deno-check.yml +++ b/.github/workflows/deno-check.yml @@ -27,11 +27,10 @@ jobs: - name: Cache Deno dependencies uses: actions/cache@v3 with: - key: ${{ hashFiles('src/deno.lock') }} + key: ${{ hashFiles('./deno.lock') }} path: ${{ env.DENO_DIR }} - name: Check - working-directory: src run: | deno lint deno check **/*.ts diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 67babd057a..5aa291ecbd 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: paths: - - "src/**/*" + - "scripts/**/*" env: DENO_DIR: deno_cache @@ -38,12 +38,11 @@ jobs: - name: Cache Deno dependencies uses: actions/cache@v3 with: - key: ${{ hashFiles('src/deno.lock') }} + key: ${{ hashFiles('./deno.lock') }} path: ${{ env.DENO_DIR }} - name: Generate health files - working-directory: ./src - run: deno task generate + run: deno task ci:generate - name: Push changes uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a6984d397c..37a69bac59 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,9 +25,8 @@ jobs: - name: Cache Deno dependencies uses: actions/cache@v3 with: - key: ${{ hashFiles('src/deno.lock') }} + key: ${{ hashFiles('./deno.lock') }} path: ${{ env.DENO_DIR }} - name: Run Lint - working-directory: src run: deno task lint diff --git a/.github/workflows/maintainers.yml b/.github/workflows/maintainers.yml index f51753bc39..bae0b9564e 100644 --- a/.github/workflows/maintainers.yml +++ b/.github/workflows/maintainers.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: paths: - - "src/userstyles.yml" + - "scripts/userstyles.yml" env: DENO_DIR: deno_cache @@ -27,12 +27,11 @@ jobs: - name: Cache Deno dependencies uses: actions/cache@v3 with: - key: ${{ hashFiles('src/deno.lock') }} + key: ${{ hashFiles('./deno.lock') }} path: ${{ env.DENO_DIR }} - name: Sync maintainers if: ${{ github.repository == 'catppuccin/userstyles' && github.ref == 'refs/heads/main' }} - working-directory: ./src - run: deno task sync-maintainers + run: deno task ci:sync-maintainers env: GITHUB_TOKEN: ${{ secrets.USERSTYLES_TOKEN }} diff --git a/.vscode/settings.json b/.vscode/settings.json index 7d655ec165..271288afd1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,7 +4,6 @@ }, "deno.enable": true, - "deno.config": "./src/deno.json", "[less]": { "editor.defaultFormatter": "esbenp.prettier-vscode" diff --git a/src/deno.json b/deno.json similarity index 61% rename from src/deno.json rename to deno.json index aa13247751..f3a52b271a 100644 --- a/src/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "imports": { - "@/": "./", + "@/": "./scripts/", "std/": "https://deno.land/std@0.206.0/", "catppuccin-repo/": "https://raw.githubusercontent.com/catppuccin/catppuccin/91d6b5433730103c504dcf43583b594e418ee7c1/", "@actions/core": "npm:@actions/core@1.10.1", @@ -11,10 +11,10 @@ "less": "npm:less@4.2.0" }, "tasks": { - "generate": "./generate/main.ts", - "lint": "./lint/main.ts", - "lint:fix": "./lint/main.ts --fix", - "sync-maintainers": "./sync-maintainers/main.ts", - "update-types": "deno run -A 'npm:json-schema-to-typescript' ./userstyles.schema.json types/userstyles.d.ts" + "ci:generate": "deno run -A ./scripts/generate/main.ts", + "ci:sync-maintainers": "deno run -A ./scripts/sync-maintainers/main.ts", + "lint": "deno run -A ./scripts/lint/main.ts", + "lint:fix": "deno task lint --fix", + "update-types": "deno run -A 'npm:json-schema-to-typescript' ./scripts/userstyles.schema.json ./scripts/types/userstyles.d.ts" } } diff --git a/src/deno.lock b/deno.lock similarity index 100% rename from src/deno.lock rename to deno.lock diff --git a/src/deps.ts b/scripts/deps.ts similarity index 100% rename from src/deps.ts rename to scripts/deps.ts diff --git a/src/generate/main.ts b/scripts/generate/main.ts similarity index 99% rename from src/generate/main.ts rename to scripts/generate/main.ts index eb9bcb5223..202db93636 100755 --- a/src/generate/main.ts +++ b/scripts/generate/main.ts @@ -41,7 +41,7 @@ const validate = ajv.compile(schema); const validatePorts = ajv.compile(portsSchema); const userstylesYaml = Deno.readTextFileSync( - path.join(REPO_ROOT, "src/userstyles.yml"), + path.join(REPO_ROOT, "scripts/userstyles.yml"), ); const userstylesData = parseYaml(userstylesYaml); if (!validate(userstylesData)) { diff --git a/src/generate/templates/userstyle-issue.yml b/scripts/generate/templates/userstyle-issue.yml similarity index 100% rename from src/generate/templates/userstyle-issue.yml rename to scripts/generate/templates/userstyle-issue.yml diff --git a/src/generate/templates/userstyle.md b/scripts/generate/templates/userstyle.md similarity index 100% rename from src/generate/templates/userstyle.md rename to scripts/generate/templates/userstyle.md diff --git a/src/lint/file-checker.ts b/scripts/lint/file-checker.ts similarity index 100% rename from src/lint/file-checker.ts rename to scripts/lint/file-checker.ts diff --git a/src/lint/logger.ts b/scripts/lint/logger.ts similarity index 100% rename from src/lint/logger.ts rename to scripts/lint/logger.ts diff --git a/src/lint/main.ts b/scripts/lint/main.ts similarity index 100% rename from src/lint/main.ts rename to scripts/lint/main.ts diff --git a/src/lint/metadata.ts b/scripts/lint/metadata.ts similarity index 100% rename from src/lint/metadata.ts rename to scripts/lint/metadata.ts diff --git a/src/lint/stylelint.ts b/scripts/lint/stylelint.ts similarity index 100% rename from src/lint/stylelint.ts rename to scripts/lint/stylelint.ts diff --git a/src/sync-maintainers/main.ts b/scripts/sync-maintainers/main.ts similarity index 97% rename from src/sync-maintainers/main.ts rename to scripts/sync-maintainers/main.ts index bfb0285a00..9eec4d8d6c 100755 --- a/src/sync-maintainers/main.ts +++ b/scripts/sync-maintainers/main.ts @@ -16,7 +16,7 @@ const ajv = new Ajv.default(); const validate = ajv.compile(schema); const userstylesYaml = Deno.readTextFileSync( - path.join(REPO_ROOT, "src/userstyles.yml"), + path.join(REPO_ROOT, "scripts/userstyles.yml"), ); const userstylesData = parseYaml(userstylesYaml); if (!validate(userstylesData)) { diff --git a/src/types.d.ts b/scripts/types.d.ts similarity index 100% rename from src/types.d.ts rename to scripts/types.d.ts diff --git a/src/types/userstyles.d.ts b/scripts/types/userstyles.d.ts similarity index 100% rename from src/types/userstyles.d.ts rename to scripts/types/userstyles.d.ts diff --git a/src/userstyles.schema.json b/scripts/userstyles.schema.json similarity index 100% rename from src/userstyles.schema.json rename to scripts/userstyles.schema.json diff --git a/src/userstyles.yml b/scripts/userstyles.yml similarity index 99% rename from src/userstyles.yml rename to scripts/userstyles.yml index 7672f8cdc4..0721660d62 100644 --- a/src/userstyles.yml +++ b/scripts/userstyles.yml @@ -479,4 +479,4 @@ userstyles: answer: "It's available in case you have an OLED display. If you have one, you might want to enable this." current-maintainers: [*isabelroses] past-maintainers: [*elkrien] -# yaml-language-server: $schema=https://raw.githubusercontent.com/catppuccin/userstyles/main/src/userstyles.schema.json +# yaml-language-server: $schema=https://raw.githubusercontent.com/catppuccin/userstyles/main/scripts/userstyles.schema.json From 59d10de9b14eac4bf7a30c20f2a731499739d3bf Mon Sep 17 00:00:00 2001 From: winston Date: Sat, 18 Nov 2023 06:59:11 +0100 Subject: [PATCH 2/2] ci: move deno_dir cache to runner `/tmp` --- .github/workflows/deno-check.yml | 2 +- .github/workflows/generate.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/maintainers.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deno-check.yml b/.github/workflows/deno-check.yml index 4aced7e7d9..adf091f5cf 100644 --- a/.github/workflows/deno-check.yml +++ b/.github/workflows/deno-check.yml @@ -9,7 +9,7 @@ on: paths: ["**/*.ts"] env: - DENO_DIR: deno_cache + DENO_DIR: /tmp/deno_cache jobs: deno-check: diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 5aa291ecbd..12be755151 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -7,7 +7,7 @@ on: - "scripts/**/*" env: - DENO_DIR: deno_cache + DENO_DIR: /tmp/deno_cache HAS_USERSTYLES_TOKEN: ${{ secrets.USERSTYLES_TOKEN != '' }} jobs: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 37a69bac59..d38ec033c9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,7 +7,7 @@ on: branches: [main] env: - DENO_DIR: deno_cache + DENO_DIR: /tmp/deno_cache jobs: lint: diff --git a/.github/workflows/maintainers.yml b/.github/workflows/maintainers.yml index bae0b9564e..8e0be04cea 100644 --- a/.github/workflows/maintainers.yml +++ b/.github/workflows/maintainers.yml @@ -7,7 +7,7 @@ on: - "scripts/userstyles.yml" env: - DENO_DIR: deno_cache + DENO_DIR: /tmp/deno_cache jobs: sync-maintainers: