Skip to content

Commit

Permalink
feat/rollup-config (#7)
Browse files Browse the repository at this point in the history
* chore(linter): update romejs to biomejs

* cicd(release): add semantic-release

* chore(linter): update rules

* docs(readme): update readme

* chore(git): update gitignore

* chore(package): remove shebangify

* chore(package): update gitignore and package.json

* chore(package): remove dep from package.json in cli

* chore(rollup): implement rollup

* chore(rollup): update rollup impl

* fix: bundle everything together
  • Loading branch information
zeon256 authored May 25, 2024
1 parent b983780 commit 21d71fd
Show file tree
Hide file tree
Showing 18 changed files with 944 additions and 168 deletions.
30 changes: 13 additions & 17 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ jobs:
- name: Install dependencies
run: npm ci

# need to build library first
- name: Build Lib project
run: npm run build:libInternal && npm run build:lib

- name: Build CLI project
run: npm run build:cli
- name: Build all
run: npm run build:all

- name: Run Library tests
run: npm run test:lib
Expand All @@ -50,15 +46,15 @@ jobs:
package.lock.json
package.json
- name: Publish Library to NPM (dry run)
# Only run if the commit is tagged with release/v<version>
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN && npm publish --dry-run
# - name: Publish Library to NPM (dry run)
# # Only run if the commit is tagged with v<version>
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# run: npm set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN && npm publish --dry-run

- name: Publish Library to NPM
# Only run if the commit is tagged with release/v<version>
if: startsWith(github.ref, 'refs/tags/release/v')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN && npm publish
# - name: Publish Library to NPM
# # Only run if the commit is tagged with release/v<version>
# if: startsWith(github.ref, 'refs/tags/v')
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# run: npm set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN && npm publish
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Semantic Release

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main' # make sure it only run on main
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/exec @semantic-release/npm
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
dist
node_modules
node_modules
packages/cli/dist
packages/lib/dist
packages/lib/.rollup.cache
9 changes: 9 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
"@semantic-release/npm"
]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ Options:
import { MarkdownTable2Json, JsonLayout } from 'mdt2json';

const markdownString = `your_markdown_string_here`;
const transpiler = new MarkdownTable2Json({markdownString, layout: JsonLayout.AoS , minify: true });
const transpiler = new MarkdownTable2Json({markdownString, layout: JsonLayout.AoS , minify: true });
console.log(transpiler.transform());
```

## Use Cases
- Converting markdown tables to JSON for use in your web application
- Improve token efficiency of your markdown files for use in retrieval augmented generation (RAG) architecure with LLMs (Large Language Models) such as GPT-3
- Improve token efficiency of your markdown files for use in retrieval augmented generation (RAG) architecture with LLMs (Large Language Models) such as GPT-3

## Library Internals
This library works by parsing the markdown and getting the AST (Abstract Syntax Tree) of the markdown file. The AST is then traversed to find the tables in the markdown file. Once the tables are found, the tables are converted to JSON and returned.
Expand Down
4 changes: 2 additions & 2 deletions rome.json → biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://docs.rome.tools/schemas/12.1.0/schema.json",
"$schema": "https://biomejs.dev/schemas/1.7.0/schema.json",
"organizeImports": {
"enabled": false
},
Expand All @@ -19,7 +19,7 @@
"enabled": true,
"formatWithErrors": false,
"indentStyle": "tab",
"indentSize": 4,
"indentWidth": 4,
"lineWidth": 120,
"ignore": []
}
Expand Down
Loading

0 comments on commit 21d71fd

Please sign in to comment.