Skip to content

Commit

Permalink
Issue5 single install (#6)
Browse files Browse the repository at this point in the history
* 🚑 Fixes (#5)

* 📝 Updated CI/CD

* 📝 Updated README

* 🚑 Updated CICD to run internal build first
  • Loading branch information
zeon256 authored Aug 1, 2023
1 parent 92f4c71 commit cd6b0bf
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 52 deletions.
22 changes: 4 additions & 18 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

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

- name: Build CLI project
run: npm run build:cli
Expand All @@ -45,34 +45,20 @@ jobs:
with:
name: release-artifact
path: |
packages/cli/dist
packages/lib/dist
dist
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 && cd packages/lib && npm publish --dry-run
run: npm set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN && npm publish --dry-run

- name: Publish CLI 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 && cd packages/cli && 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 && cd packages/lib && npm publish

- name: Publish CLI 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 && cd packages/cli && npm publish

run: npm set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN && npm publish
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@
> mdtable2json is a TypeScript library and CLI tool that allows you to transpile tables in your markdown file to minified JSON. With mdtable2json, you can easily convert your markdown table data into a structured JSON format.
## Features
- ESModule support
- Convert markdown tables to JSON
- Command-line interface (CLI) tool for easy conversion
- Multiple knobs available for customizing the conversion process. Don't need to minify? No problem! Prefer Array of Structures (AoS) over Structure of Arrays (SoA)? We got you covered!

## Installation (CLI)
## Installation (CLI and Library)
```bash
npm install -g mdt2json-cli
```

## Installation (Library)
```bash
npm install mdt2json-ts
npm install -g mdt2json
```

## CLI Usage
```bash
Usage: mdt2json-cli-cli [options]
Usage: mdt2json [options]

Options:
-f, --file <file> file to transpile
Expand All @@ -32,7 +28,7 @@ Options:

## Library Usage
```typescript
import { MarkdownTable2Json, JsonLayout } from 'mdt2json-ts';
import { MarkdownTable2Json, JsonLayout } from 'mdt2json';

const markdownString = `your_markdown_string_here`;
const transpiler = new MarkdownTable2Json({markdownString, layout: JsonLayout.AoS , minify: true });
Expand Down
24 changes: 15 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 32 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,43 @@
{
"name": "mdt2json",
"version": "0.1.0",
"description": "Markdown Table to Minified JSON Transpiler",
"main": "index.js",
"version": "0.2.0",
"description": "Configurable Markdown Table to Minified JSON Transpiler",
"main": "./dist/lib/lib.js",
"types": "./dist/lib/lib.d.ts",
"type": "module",
"exports": {
".": {
"types": "./dist/lib/lib.d.ts",
"default": "./dist/lib/lib.js"
},
"./package.json": "./package.json"
},
"bin": {
"mdt2json": "./dist/cli/main.js",
"shebangify": "./shebangify.js"
},
"files": [
"dist"
],
"readme": "README.md",
"keywords": [
"markdown",
"table",
"json",
"transpiler"
],
"repository": {
"type": "git",
"url": "https://github.com/zeon256/mdtable2json"
},
"workspaces": [
"packages/cli",
"packages/lib"
],
"scripts": {
"build:cli": "npm run cleanBuild -w packages/cli",
"build:cli": "npm run cleanBuild -w packages/cli && node ./shebangify.cjs ./dist/cli/main.js",
"build:lib": "npm run cleanBuild -w packages/lib",
"build:libInternal": "npm run cleanBuild:internal -w packages/lib",
"test:lib": "npm run test -w packages/lib"
},
"author": "Budi Syahiddin",
Expand Down
8 changes: 3 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"name": "mdt2json-cli",
"version": "0.1.0",
"version": "0.2.0",
"description": "Markdown Table to Minified JSON Transpiler CLI tool",
"type": "module",
"main": "./dist/main.js",
"bin": "./dist/main.js",
"scripts": {
"cleanBuild": "rm -rf ./dist && tsc && chmod +x ./dist/main.js && ../../shebangify ./dist/main.js"
"cleanBuild": "rm -rf ../../dist/cli && tsc && chmod +x ../../dist/cli/main.js"
},
"dependencies": {
"commander": "^11.0.0",
"mdt2json-ts": "*"
"mdt2json": "*"
},
"author": "Budi Syahiddin",
"license": "MIT"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Command } from "commander";
import { JsonLayout, MarkdownTable2Json } from "mdt2json-ts/dist/lib.js";
import { JsonLayout, MarkdownTable2Json } from "mdt2json-ts";
import fs from "fs";

(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"rootDir": "src",
"moduleResolution": "Node",
"declaration": true,
"outDir": "./dist",
"outDir": "../../dist/cli",
"isolatedModules": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
Expand Down
14 changes: 11 additions & 3 deletions packages/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
{
"name": "mdt2json-ts",
"version": "0.1.0",
"version": "0.2.0",
"description": "Markdown Table to Minified JSON Transpiler",
"main": "./dist/lib.js",
"files": ["dist", "src", "tests"],
"private": true,
"files": [
"dist",
"src",
"tests"
],
"dist": {
"type": "module",
"main": "./dist/lib.js",
"module": "./dist/lib.js",
"types": "./dist/lib.d.ts"
},
"types": "./dist/lib.d.ts",
"type": "module",
"scripts": {
"cleanBuild": "rm -rf ./dist && tsc",
"cleanBuild": "rm -rf ../../dist/lib && tsc",
"cleanBuild:internal": "rm -rf ./dist && tsc --outDir ./dist",
"test": "NODE_OPTIONS=--experimental-vm-modules jest --verbose --config jest-unit.config.json"
},
"author": "Budi Syahiddin",
Expand All @@ -27,6 +34,7 @@
},
"dependencies": {
"commander": "^11.0.0",
"mdt2json": "^0.2.0",
"remark": "^14.0.3",
"remark-gfm": "^3.0.1",
"remark-parse": "^10.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"rootDir": "src",
"moduleResolution": "Node",
"declaration": true,
"outDir": "./dist",
"outDir": "../../dist/lib",
"isolatedModules": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
Expand Down
1 change: 0 additions & 1 deletion shebangify → shebangify.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env node
const fs = require('fs');
const path = process.argv[2];
let data = "#!/usr/bin/env node\n\n";
Expand Down

0 comments on commit cd6b0bf

Please sign in to comment.