Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
last 2 versions
not dead
> 0.2%
54 changes: 54 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
53 changes: 53 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file keeps dependencies up to date automatically.
# It checks for updates to npm packages and GitHub Actions.
#
# @see https://docs.github.com/en/code-security/dependabot
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

# 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
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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] # 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 # required for npm provenance

steps:
- name: Checkout repository
uses: actions/checkout@v7

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24.x'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

- name: Install dependencies (clean install)
run: npm ci

- 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 with provenance
run: npm publish --provenance --access public

5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
*.log
package-lock.json
.DS_Store
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 100,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "lf"
}
12 changes: 12 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -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"]
}
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
# package-template
# ComfortCSS Package Template

A template for creating new packages in the **ComfortCSS** ecosystem.
It includes a pre-configured build setup using **Lightning CSS**, linting, formatting, and automated publishing to npm via GitHub Actions.

---

## Quick Start

1. On GitHub, click the **"Use this template"** button when creating a new repository.

2. Clone the created repository:

```bash
git clone https://github.com/your-account/package-name.git
cd package-name
```

3. Install the dependencies:

```bash
npm install
```

4. Modify package.json:

- `name` – replace `@comfortcss/PACKAGE_NAME` with your package's actual name (e.g., `@comfortcss/buttons`).

- description, keywords, author – enter your details.

- Adjust the version if necessary.

## License

This template is distributed under the **MIT** license. You can use it for your projects without restrictions.
Loading