diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..53674be --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,29 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - run: npm ci + - run: npm test diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..ed5aded --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,34 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + - run: npm ci + # scoped packages are private by default so need to add public flag + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/README.md b/README.md new file mode 100644 index 0000000..b2c9cae --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# markdown + +[![Build status](https://github.com/scheduleonce/markdown/actions/workflows/node.js.yml/badge.svg)](https://github.com/scheduleonce/markdown/actions) [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) + +> Thin wrapper for markdown parsing and output sanitization + +## Installation + +To install this module, run the following command: + +```sh +$ npm install --save @oncehub/markdown +``` + +## Usage + +## Development + +### Tests + +Run tests via `npm test`. + +### Deployment + +Package is automatically published to npm when [creating a new release](.github/workflows/npm-publish.yml) on Github. Check out the release section in the repo. Read more about releases [here](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository). + +## License + +This module is licensed under the MIT License. See the LICENSE file for details. diff --git a/package.json b/package.json new file mode 100644 index 0000000..0a2b1bc --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "@oncehub/markdown", + "version": "1.0.0", + "description": "Markdown parser and sanitizer", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "MIT" +}