From 8e4d7c613a4db5385eedb9696726a98e855b9969 Mon Sep 17 00:00:00 2001 From: Przemek Trzepinski Date: Fri, 30 Aug 2024 17:29:47 +0200 Subject: [PATCH] added publishing and readme --- .github/workflows/publish.yml | 28 ++++++++++++ README.md | 81 ++++++++++++++++++++++++++++++++++- 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f172ca2 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,28 @@ +name: Publish Package to npmjs +on: + release: + types: [published] +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.4 + # Setup .npmrc file to publish to npm + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.12 + registry-url: 'https://registry.npmjs.org' + - run: pnpm i --frozen-lockfile + - run: pnpm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index effb4dc..b3d2d82 100644 --- a/README.md +++ b/README.md @@ -1 +1,80 @@ -# omnicalculator-eslint-config \ No newline at end of file +# Omni Calculator eslint config ⚙️ + +This is eslint configuration meant to be used across different projects and/or repositories within [Omni Calculator](https://www.omnicalculator.com) company + +## Usage + +### Prerequisites +- [eslint](https://www.npmjs.com/package/eslint) — version 9.x must be installed in your projext. + +### Installation +Simply install omnicalculator-eslint-config with your favorite package manager as **development dependency** +```bash +npm install -D omnicalculator-eslint-config + +#or +pnpm i -D omnicalculator-eslint-config + +#or +yarn add -D omnicalculator-eslint-config +``` + +### Usage +Use this configuration preset in you `eslint.config.js` file. If you do not need to extend this configuration simply reexport: +```js +// eslint.config.js +const omniCalculatorEslintConfig = require(' omnicalculator-eslint-config'); + +module.exports = omniCalculatorEslintConfig; +``` + +In case yoy need to extend thuis configuration simply add your config at the end to exported array: +```js +// eslint.config.js +const omniCalculatorEslintConfig = require(' omnicalculator-eslint-config'); + +module.exports = [ + ...omniCalculatorEslintConfig, + { + files: ['**/legacy'], + rules: { complexity: 'off'}, + } +]; + +``` + +## Development + +### Prerequisites + +- [Node.js](https://nodejs.org) — version 20.x +- [pnpm](https://pnpm.io/) — version 9.x + + +### Install + +Install dependencies with: + +```sh +$ pnpm install +``` + +### Running + +Once you installed depedencies you are good to start development, no other action is required. + +```sh +$ pnpm knex-migrate +``` + +> **Note** +> +> To run migrations you need to supply the .env file. For the development purposes you can use thre .env.development, just rename it to .env + + +## Publication + +To publish next version of this npm package first create a branch from `main`. Release branch should be named: `release-[versionTag]`, where `[versionTag]` is tag of version you want to publish. + +Push such branch to github and follow github instructions on [creating and publishing release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release) in github GUI. +