diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 0000000..a01c233 --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,3 @@ +last 2 versions +not dead +> 0.2% diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f0e7d17 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,54 @@ +# EditorConfig is awesome: https://editorconfig.org + +root = true + +# Global settings for all files +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +# CSS, SCSS, Less +[*.{css,scss,less}] +indent_size = 2 +max_line_length = 100 + +# JavaScript / TypeScript (future-proof) +[*.{js,jsx,ts,tsx,mjs,cjs}] +indent_size = 2 +max_line_length = 100 +quote_type = single + +# JSON files (Prettier handles formatting) +[*.{json,json5,jsonc}] +indent_size = 2 +max_line_length = 0 + +# YAML (e.g., GitHub Actions) +[*.{yml,yaml}] +indent_size = 2 +max_line_length = 120 + +# Markdown (preserve trailing spaces for line breaks) +[*.md] +trim_trailing_whitespace = false +indent_size = 2 +max_line_length = 80 + +# GitHub Actions workflows (YAML) +[.github/**/*.yml] +indent_size = 2 +max_line_length = 120 + +# Dotfiles with no extension (.gitignore, .browserslistrc, etc.) +[*.{gitignore,browserslistrc}] +indent_size = 2 +trim_trailing_whitespace = true + +# Shell scripts +[*.{sh,bash}] +indent_size = 2 +end_of_line = lf \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d16b62b..79fefce 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,51 +5,51 @@ version: 2 updates: - - package-ecosystem: "npm" - directory: "/" # root of the repository - schedule: - interval: "weekly" # check once a week (on Monday) - day: "monday" - time: "08:00" - timezone: "Europe/London" - versioning-strategy: "increase" # prefer updating to the next semver range - target-branch: "main" # PRs will target the main branch - labels: - - "dependencies" - - "npm" - commit-message: - prefix: "chore(deps)" - prefix-development: "chore(deps-dev)" - include: "scope" # include the package name in the commit message + - package-ecosystem: 'npm' + directory: '/' # root of the repository + schedule: + interval: 'weekly' # check once a week (on Monday) + day: 'monday' + time: '08:00' + timezone: 'Europe/London' + versioning-strategy: 'increase' # prefer updating to the next semver range + target-branch: 'main' # PRs will target the main branch + labels: + - 'dependencies' + - 'npm' + commit-message: + prefix: 'chore(deps)' + prefix-development: 'chore(deps-dev)' + include: 'scope' # include the package name in the commit message - # Group all development dependencies into a single PR to reduce noise - groups: - dev-dependencies: - dependency-type: "development" - update-types: - - "minor" - - "patch" - # Ignore specific packages if needed (example) - ignore: - - dependency-name: "lightningcss" - # keep it on the latest major version (optional) - # Limit the number of open PRs - open-pull-requests-limit: 10 + # Group all development dependencies into a single PR to reduce noise + groups: + dev-dependencies: + dependency-type: 'development' + update-types: + - 'minor' + - 'patch' + # Ignore specific packages if needed (example) + ignore: + - dependency-name: 'lightningcss' + # keep it on the latest major version (optional) + # Limit the number of open PRs + open-pull-requests-limit: 10 - # ---------------------------- - # GitHub Actions (workflows) - # ---------------------------- - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - day: "monday" - time: "08:00" - timezone: "Europe/London" - labels: - - "dependencies" - - "github-actions" - commit-message: - prefix: "chore(ci)" - include: "scope" - open-pull-requests-limit: 5 + # ---------------------------- + # GitHub Actions (workflows) + # ---------------------------- + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: 'weekly' + day: 'monday' + time: '08:00' + timezone: 'Europe/London' + labels: + - 'dependencies' + - 'github-actions' + commit-message: + prefix: 'chore(ci)' + include: 'scope' + open-pull-requests-limit: 5 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..37cd6ef --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: + - main + - dev + pull_request: + branches: + - main + +jobs: + quality-checks: + name: Lint, Format & Build + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: '24.x' + cache: 'npm' + + - name: Install dependencies (clean install) + run: npm ci + + - name: Run Stylelint (CSS linting) + run: npm run lint + + - name: Check Prettier formatting + run: npm run format -- --check + + - name: Build package (verify it compiles) + run: npm run build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7c04eea..767fc26 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,32 +1,53 @@ +# Publish to npm when a release is published or manually triggered. +# Also verifies version consistency, runs linters, builds the package, and publishes with provenance. name: Publish to npm on: release: - types: [published] - workflow_dispatch: + types: [published] # triggers when a GitHub Release is published + workflow_dispatch: # allows manual trigger from Actions tab jobs: publish: + name: Build & Publish runs-on: ubuntu-latest permissions: contents: read - id-token: write + id-token: write # required for npm provenance + steps: - - name: 'Checkout code' + - name: Checkout repository uses: actions/checkout@v7 - - name: 'Setup Node.js' + - name: Setup Node.js uses: actions/setup-node@v6 with: - node-version: '24.x' - registry-url: 'https://registry.npmjs.org' - - name: 'Install dependencies' + node-version: '24.x' + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + + - name: Install dependencies (clean install) run: npm ci - # - name: 'Build' - # run: npm run build - # - name: 'Test' - # run: npm test + - name: Verify version matches the release tag (if triggered by release) + if: github.event_name == 'release' + run: | + PACKAGE_VERSION=$(node -p "require('./package.json').version") + RELEASE_TAG=${github.event.release.tag_name#v} + if [ "$PACKAGE_VERSION" != "$RELEASE_TAG" ]; then + echo "❌ Package version ($PACKAGE_VERSION) does not match release tag ($RELEASE_TAG)" + exit 1 + fi + echo "✅ Package version $PACKAGE_VERSION matches release tag $RELEASE_TAG" + + - name: Run Stylelint (CSS linting) + run: npm run lint + + - name: Check Prettier formatting + run: npm run format -- --check + + - name: Build package + run: npm run build - - name: 'Publish to npm' + - name: Publish to npm with provenance run: npm publish --provenance --access public diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..2312dc5 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..46233b1 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +node_modules +dist +*.log +package-lock.json +.DS_Store diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..5e7a9d3 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "printWidth": 100, + "tabWidth": 4, + "useTabs": false, + "semi": true, + "singleQuote": true, + "trailingComma": "es5", + "bracketSpacing": true, + "arrowParens": "avoid", + "endOfLine": "lf" +} diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 0000000..522df25 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,12 @@ +{ + "extends": ["stylelint-config-standard", "stylelint-prettier/recommended"], + "plugins": ["stylelint-order"], + "rules": { + "order/properties-alphabetical-order": true, + "declaration-block-no-redundant-longhand-properties": true, + "no-descending-specificity": null, + "selector-class-pattern": null, + "value-keyword-case": ["lower", { "ignoreProperties": ["/^--/"] }] + }, + "ignoreFiles": ["dist/**/*.css"] +} diff --git a/README.md b/README.md index 91c3c75..8dccd66 100644 --- a/README.md +++ b/README.md @@ -15,26 +15,29 @@ Alternatively, download the files manually from the repository. ## Usage At the very beginning of the CSS file: + ```css @import '~@comfortcss/reset'; ``` + For example, just the basic reset and forms: + ```css -@import "~@comfortcss/reset/reset"; -@import "~@comfortcss/reset/modules/core/base.css"; +@import '~@comfortcss/reset/reset'; +@import '~@comfortcss/reset/modules/core/base.css'; ``` ## Modules -| Module | Description | -|--------|-------------| -|base|Box model, html, body, system colors| -|typography|Headings, paragraphs, lists, quotes, code, hr| -|forms|All input fields, buttons, select elements, and textareas| -|tables|Tables, cells, captions| -|media|Images, videos, iframes, SVG, audio| -|interactive|Links, focus, hidden, disabled, contenteditable| -|accessibility|prefers-reduced-motion, system @property| +| Module | Description | +| ------------- | --------------------------------------------------------- | +| base | Box model, html, body, system colors | +| typography | Headings, paragraphs, lists, quotes, code, hr | +| forms | All input fields, buttons, select elements, and textareas | +| tables | Tables, cells, captions | +| media | Images, videos, iframes, SVG, audio | +| interactive | Links, focus, hidden, disabled, contenteditable | +| accessibility | prefers-reduced-motion, system @property | ## License diff --git a/example/css/index.css b/example/css/index.css index 83edfd2..96ae4c8 100644 --- a/example/css/index.css +++ b/example/css/index.css @@ -1 +1 @@ -@import url('../../dist/reset.min.css'); \ No newline at end of file +@import url('../../dist/reset.min.css'); diff --git a/example/index.html b/example/index.html index f45f350..469bcc8 100644 --- a/example/index.html +++ b/example/index.html @@ -1,27 +1,27 @@ - + -
- - -This is an example page.
+This is an example page.
-