From 07d00159154e01a9c28de45c8fd9905e79d55071 Mon Sep 17 00:00:00 2001 From: William Killerud Date: Tue, 30 Jul 2024 13:58:27 +0200 Subject: [PATCH] feat: initial release --- .gitattributes | 1 + .github/workflows/publish.yml | 29 ++++++++++++++++++++++ .github/workflows/test.yml | 23 ++++++++++++++++++ .gitignore | 1 + .npmrc | 2 ++ CONTRIBUTING.md | 11 +++++++++ README.md | 19 +++++++++++++++ eslint.config.js | 3 +++ lib/config.js | 12 +++++++++ package.json | 46 +++++++++++++++++++++++++++++++++++ prettier.config.js | 3 +++ release.config.js | 3 +++ renovate.json | 6 +++++ 13 files changed, 159 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 CONTRIBUTING.md create mode 100644 README.md create mode 100644 eslint.config.js create mode 100644 lib/config.js create mode 100644 package.json create mode 100644 prettier.config.js create mode 100644 release.config.js create mode 100644 renovate.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ef530ea --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish + +on: + push: + branches: + - main + - alpha + - beta + - next + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - run: npm install + + - run: npm run lint + + - run: npx semantic-release + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e1f773f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Test + +on: + push: + branches-ignore: + - main + - alpha + - beta + - next + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - run: npm install + + - run: npm run lint diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..0ca8d2a --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +package-lock=false +save-exact=true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..78ad1ba --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,11 @@ +# Contributing + +Thank you for showing an interest in contributing to Eik 🧡 + +This module is a [shared config for prettier](https://prettier.io/docs/en/configuration.html#sharing-configurations). We accept changes that should apply to all repositories in the [eik-lib origanisation](https://github.com/eik-lib). + +Commits should follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) format. + +A change in configuration is considered a `patch` in [semantic versioning](https://semver.org/). A new export would be a `minor`. Depending on a newer version of Prettier would be a `major`. + +This repo uses [semantic release](https://github.com/semantic-release/semantic-release) to automate releases whenever changes are merged to the default branch. diff --git a/README.md b/README.md new file mode 100644 index 0000000..29a29ec --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# @eik/prettier-config + +Shared config for [prettier](https://prettier.io/) used in Eik projects. + +## Install + +``` +npm install --save-dev prettier @eik/prettier-config +``` + +## Usage + +In `prettier.config.js`: + +```js +import config from "@eik/prettier-config"; + +export default config; +``` diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..b940db0 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,3 @@ +import config from "@eik/eslint-config"; + +export default config; diff --git a/lib/config.js b/lib/config.js new file mode 100644 index 0000000..b884cc1 --- /dev/null +++ b/lib/config.js @@ -0,0 +1,12 @@ +export default { + useTabs: true, + overrides: [ + { + files: ["*.yml", "*.json"], + options: { + tabWidth: 2, + useTabs: false, + }, + }, + ], +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..2a53a86 --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "@eik/prettier-config", + "version": "1.0.0", + "description": "Shared prettier config for Eik modules", + "type": "module", + "exports": { + ".": { + "default": "./lib/default.js" + } + }, + "files": [ + "lib" + ], + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/eik-lib/prettier-config.git" + }, + "publishConfig": { + "access": "public" + }, + "bugs": { + "url": "https://github.com/eik-lib/prettier-config/issues" + }, + "homepage": "https://github.com/eik-lib/prettier-config#readme", + "scripts": { + "lint": "eslint .", + "lint:fix": "npm run lint -- --fix", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "prettier", + "prettierconfig" + ], + "author": "", + "license": "MIT", + "peerDependencies": { + "prettier": ">= 3" + }, + "devDependencies": { + "@eik/eslint-config": "1.0.0", + "@eik/semantic-release-config": "1.0.0", + "eslint": "9.8.0", + "prettier": "3.3.3", + "semantic-release": "24.0.0" + } +} diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..163e155 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,3 @@ +import config from "./lib/config.js"; + +export default config; diff --git a/release.config.js b/release.config.js new file mode 100644 index 0000000..dd5cd51 --- /dev/null +++ b/release.config.js @@ -0,0 +1,3 @@ +export default { + extends: "@eik/semantic-release-config", +}; diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..5db72dd --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ] +}