diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 3946f6c4..00000000 --- a/.eslintrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint", "prettier"], - "settings": { - "react": { - "version": "detect" - } - }, - "env": { - "node": true - }, - "extends": ["plugin:@typescript-eslint/recommended", "prettier"], - "ignorePatterns": ["**/*.js", "**/**/*.js"], - "rules": { - "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], - "eqeqeq": ["error", "always", { "null": "ignore" }], - "no-param-reassign": "error", - "no-return-assign": "error" - } -} diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml deleted file mode 100644 index 5d4cfe84..00000000 --- a/.github/workflows/check-release.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Validate labels - -on: - pull_request_target: - types: [labeled, unlabeled, opened, reopened, synchronize] - -jobs: - validate-labels: - runs-on: ubuntu-latest - if: - "!contains(github.event.head_commit.message, 'ci skip') && - !contains(github.event.head_commit.message, 'skip ci')" - steps: - - uses: actions/checkout@v2 - - - name: Prepare repository - run: git fetch --unshallow --tags - - - name: Use Node.js 22.x - uses: actions/setup-node@v4 - with: - node-version: 22.x - - - name: Install dependencies - uses: bahmutov/npm-install@v1 - - - name: Verify Release - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - run: - npx auto pr-check - --url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID diff --git a/.github/workflows/license-check.yaml b/.github/workflows/license-check.yaml deleted file mode 100644 index ebadf5b5..00000000 --- a/.github/workflows/license-check.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# To run this check locally, install SkyWalking Eyes -# (https://github.com/apache/skywalking-eyes). On macOS you can `brew install -# license-eye` and run `license-eye header check` or `license-eye header fix`. - -name: license-check -on: pull_request -jobs: - license: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Check License Header - uses: apache/skywalking-eyes/header@5dfa68f93380a5e57259faaf95088b7f133b5778 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6df8d866..0e82f145 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,46 +1,81 @@ name: Release -on: [push] +on: + push: + branches: [main] + pull_request: + types: [opened, synchronize, reopened] + +# Enabled permissions on GITHUB_TOKEN +permissions: + # To be able to push to the repo + contents: write + # To update the pr description with canary info + pull-requests: write + # For pr-check to create a status + statuses: write + # Needed to create PR statuses/checks + checks: write + # To post comments on PRs + issues: write + # For trusted publishing + id-token: write jobs: - release: + validate-labels: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')" - permissions: - pull-requests: write - contents: write steps: - uses: actions/checkout@v5 - run: git fetch --unshallow --tags - - - name: Use Node.js 22.x - uses: actions/setup-node@v4 + - uses: actions/setup-node@v5 with: node-version: 22.x cache: npm + - run: npm install + - name: Verify Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: + npx auto pr-check + --url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID - - name: Install dependencies - run: npm install + release: + runs-on: ubuntu-latest + environment: production + if: | + !contains(github.event.head_commit.message, 'ci skip') && + !contains(github.event.head_commit.message, 'skip ci') + steps: + - uses: actions/checkout@v5 + with: + ref: ${{ github.head_ref || github.ref_name }} + - run: git fetch --unshallow --tags + - uses: actions/setup-node@v5 + with: + node-version: 22.x + cache: npm + - run: npm install + - run: npm install -g npm@latest - name: Build run: npm run build - - name: Commit theme changes if needed + - name: Check theme changes run: | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add ./styles/dist if ! git diff --staged --quiet; then - git commit -m "Update themes from token file [ci skip]" + git commit -m "Update themes from token file" git push else - echo "No changes to commit" + echo "No theme changes detected. Continuing with release." fi - name: Create Release - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npm run release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.prettierignore b/.prettierignore index 1b763b1b..41762e23 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,3 @@ -CHANGELOG.md +**/*.json +*.md +*.css diff --git a/.prettierrc b/.prettierrc index 6962b53f..38a95c9a 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,8 +4,6 @@ "semi": false, "singleQuote": true, "trailingComma": "all", - "plugins": ["./node_modules/@trivago/prettier-plugin-sort-imports"], - "importOrder": ["^~/(.*)$", "^[./]"], - "importOrderSeparation": true, - "importOrderSortSpecifiers": true + "plugins": ["@ianvs/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"], + "importOrder": ["^~/(.*)$", "", "^[./]"] } diff --git a/README.md b/README.md index 06ed79da..31508b3c 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,7 @@ For more information checkout [auto's docs](https://intuit.github.io/auto/docs). To ensure consistency between our designs and implementation we use the [Design Tokens Plugin](https://www.figma.com/community/plugin/888356646278934516/Design-Tokens) -inside of figma to export a [json tokens file](styles/src/tokens.json) to the repo. When -that file is changed the [build-themes](.github/workflows/build-themes.yaml) workflow runs -to generate theme stylesheets, a tailwind token file, and other artifacts in -[dist](styles/dist/). +inside of figma to export a [json tokens file](styles/src/tokens.json) to the repo. The user can then run `npm run build` to generate theme files. This is not automatic, the user should then commit the changes. The design tokens plugin is two way so token changes made in the json file can be synced back with figma. @@ -46,7 +43,6 @@ icon component as shown below: ```tsx import { type Icon as IconType } from '@oxide/design-system/icons' - // Cannot be imported through '@oxide/design-system' import sprite from '../../node_modules/@oxide/design-system/icons/sprite.svg' diff --git a/components/src/asciidoc/Admonition.tsx b/components/src/asciidoc/Admonition.tsx index d5fda352..ff5c2e6a 100644 --- a/components/src/asciidoc/Admonition.tsx +++ b/components/src/asciidoc/Admonition.tsx @@ -5,7 +5,7 @@ * * Copyright Oxide Computer Company */ -import { type AdmonitionBlock, Content, Title, parse } from '@oxide/react-asciidoc' +import { Content, parse, Title, type AdmonitionBlock } from '@oxide/react-asciidoc' import { titleCase } from '../utils' diff --git a/components/src/asciidoc/Section.tsx b/components/src/asciidoc/Section.tsx index 7d2d14f7..eac35aef 100644 --- a/components/src/asciidoc/Section.tsx +++ b/components/src/asciidoc/Section.tsx @@ -6,9 +6,9 @@ * Copyright Oxide Computer Company */ import { Link16Icon } from '@/icons/react' -import { Content, type SectionBlock, parse } from '@oxide/react-asciidoc' +import { Content, parse, type SectionBlock } from '@oxide/react-asciidoc' import cn from 'classnames' -import { type JSX, createElement } from 'react' +import { createElement, type JSX } from 'react' // We need to remove anchors from the section title (and table of contents) because having // an anchor within an anchor causes a client/server render mismatch @@ -26,7 +26,7 @@ const Section = ({ node }: { node: SectionBlock }) => {