-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #431 from thematters/develop
Release: v0.2.0
- Loading branch information
Showing
134 changed files
with
19,776 additions
and
19,584 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"plugin:react/recommended", | ||
"standard-with-typescript", | ||
"prettier" | ||
], | ||
"overrides": [ | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"react", | ||
"simple-import-sort" | ||
], | ||
"rules": { | ||
"simple-import-sort/imports": "error", | ||
"simple-import-sort/exports": "error", | ||
"react-hooks/exhaustive-deps": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Deploy Demo | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
|
||
- name: Install dependencies | ||
uses: bahmutov/npm-install@v1 | ||
|
||
- name: Build project | ||
run: npm run build:demo | ||
|
||
- name: Upload production-ready build files | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: production-files | ||
path: ./demo | ||
|
||
deploy: | ||
name: Deploy | ||
needs: build | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: production-files | ||
path: ./demo | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ jobs: | |
- name: Setup Node.js | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '12.16' | ||
node-version: '16.14' | ||
registry-url: 'https://registry.npmjs.org' | ||
always-auth: true | ||
|
||
|
@@ -37,15 +37,15 @@ jobs: | |
run: npm ci | ||
|
||
- name: Test | ||
run: npm run lint | ||
run: npm run lint && npm run test | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
# === `master` branch === | ||
- name: Publish to NPM | ||
if: github.ref == 'refs/heads/master' | ||
run: npm publish | ||
run: npm publish ./dist | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ jobs: | |
- name: Setup Node.js | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '12.16' | ||
node-version: '16.14' | ||
registry-url: 'https://registry.npmjs.org' | ||
always-auth: true | ||
|
||
|
@@ -35,7 +35,7 @@ jobs: | |
run: npm ci | ||
|
||
- name: Test | ||
run: npm run lint | ||
run: npm run lint && npm run test | ||
|
||
- name: Build | ||
run: npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm test && npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
unsafe-perm=true | ||
legacy-peer-deps=true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { suite, add, cycle, complete, save } from 'benny' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import naturalCompare from 'natural-compare-lite' | ||
|
||
import { html2md } from '../src' | ||
|
||
const originalDir = path.resolve('./examples/original') | ||
|
||
const htmls: { [key: string]: any } = {} | ||
const adds: any[] = [] | ||
|
||
const filenames = fs | ||
.readdirSync(originalDir, { encoding: 'utf-8' }) | ||
.sort(naturalCompare) | ||
|
||
for (let filename of filenames) { | ||
const html = fs.readFileSync(path.resolve(originalDir, filename), 'utf-8') | ||
htmls[filename] = html | ||
adds.push( | ||
add(`~${filename.split('.')[0]} characters`, async () => { | ||
html2md(htmls[filename]) | ||
}) | ||
) | ||
} | ||
|
||
suite( | ||
'HTML to Markdown', | ||
...adds, | ||
cycle(), | ||
complete(() => { | ||
const used = process.memoryUsage().heapUsed / 1024 / 1024 | ||
console.log( | ||
`\nThe script uses approximately ${Math.round(used * 100) / 100} MB` | ||
) | ||
}), | ||
save({ file: 'html2md' }), | ||
save({ file: 'html2md', format: 'chart.html' }) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import './html2md' | ||
import './md2html' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { suite, add, cycle, complete, save } from 'benny' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import naturalCompare from 'natural-compare-lite' | ||
|
||
import { md2html } from '../src' | ||
|
||
const markdownDir = path.resolve('./examples/markdown') | ||
|
||
const mds: { [key: string]: any } = {} | ||
const adds: any[] = [] | ||
|
||
const filenames = fs | ||
.readdirSync(markdownDir, { encoding: 'utf-8' }) | ||
.sort(naturalCompare) | ||
|
||
for (let filename of filenames) { | ||
const md = fs.readFileSync(path.resolve(markdownDir, filename), 'utf-8') | ||
mds[filename] = md | ||
adds.push( | ||
add(`~${filename.split('.')[0]} characters`, async () => { | ||
md2html(mds[filename]) | ||
}) | ||
) | ||
} | ||
|
||
suite( | ||
'Markdown to HTML', | ||
...adds, | ||
cycle(), | ||
complete(() => { | ||
const used = process.memoryUsage().heapUsed / 1024 / 1024 | ||
console.log( | ||
`\nThe script uses approximately ${Math.round(used * 100) / 100} MB` | ||
) | ||
}), | ||
save({ file: 'md2html' }), | ||
save({ file: 'md2html', format: 'chart.html' }) | ||
) |
Oops, something went wrong.