Skip to content

Commit df26cc3

Browse files
committed
Add CLI package for html-to-text (WIP)
1 parent 4392eeb commit df26cc3

File tree

11 files changed

+273
-1
lines changed

11 files changed

+273
-1
lines changed

.eslintrc.cjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ module.exports = {
162162
'filenames/match-exported': 'error'
163163
},
164164
overrides: [
165+
{
166+
'files': ['packages/html-to-text-cli/**/*.js'],
167+
'rules': {
168+
'sort-keys': 'off',
169+
'import/extensions': [ 'error', 'never', { 'json': 'always' } ],
170+
'import/no-nodejs-modules': [ 'error', { 'allow': ['node:process'] }]
171+
}
172+
},
165173
{
166174
'files': ['example/*.js'],
167175
'rules': { 'import/no-nodejs-modules': 'off' }

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
coverage
55
node_modules
66
lib
7+
bin
78
__*.*
89
packages/*/LICENSE

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.17
1+
14.21

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ This is a monorepo.
1414

1515
Docs: [README.md](/packages/html-to-text/README.md), [CHANGELOG.md](/packages/html-to-text/CHANGELOG.md)
1616

17+
- **@html-to/text-cli**
18+
19+
CLI for html to text converter.
20+
21+
Folder: [/packages/html-to-text-cli](/packages/html-to-text-cli)
22+
23+
Docs: [README.md](/packages/html-to-text-cli/README.md), [CHANGELOG.md](/packages/html-to-text-cli/CHANGELOG.md)
24+
1725
- **@html-to/md**
1826

1927
Advanced html to markdown converter.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"type": "module",
1313
"scripts": {
1414
"build:html-to-text": "cd ./packages/html-to-text/ && npm run build",
15+
"build:html-to-text-cli": "cd ./packages/html-to-text-cli/ && npm run build",
1516
"build:html-to-md": "cd ./packages/html-to-md/ && npm run build",
1617
"build": "concurrently npm:build:*",
1718
"cover:html-to-text": "cd ./packages/html-to-text/ && npm run cover",
@@ -21,6 +22,7 @@
2122
"example:text": "node --experimental-specifier-resolution=node ./example/html-to-text.js",
2223
"install:base": "cd ./packages/base/ && npm i",
2324
"install:html-to-text": "cd ./packages/html-to-text/ && npm i",
25+
"install:html-to-text-cli": "cd ./packages/html-to-text-cli/ && npm i",
2426
"install:html-to-md": "cd ./packages/html-to-md/ && npm i",
2527
"lint": "eslint .",
2628
"postinstall": "concurrently npm:install:*",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
## Version 0.5.0
4+
5+
- Initial release
6+
- Requires Node.js version >= 14.13.1
7+
- Based on `html-to-text` version 9.0.0-preview2
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# @html-to/text-cli
2+
3+
Command line interface for `html-to-text` Node.js package
4+
5+
6+
## Features
7+
8+
9+
## Changelog
10+
11+
Available here: [CHANGELOG.md](https://github.com/html-to-text/node-html-to-text/blob/master/packages/html-to-text-cli/CHANGELOG.md)
12+
13+
14+
## Installation
15+
16+
```
17+
npm i -g @html-to/text-cli
18+
```
19+
20+
### Name collisions
21+
22+
- old versions of `html-to-text` package expose a command with the same name. Make sure that package is not installed globally anymore.
23+
- there is an old abandoned CLI package that exposes a command with the same name and actually has nothing to do with `html-to-text` package. Make sure to only use namespaced package `@html-to/text-cli`.
24+
25+
26+
## Usage
27+
28+
- Use `html-to-text` command;
29+
- Pipe HTML to `stdin`;
30+
- Get plain text from `stdout`;
31+
- Pass converter options as command arguments.
32+
33+
TODO
34+
35+
36+
## License
37+
38+
[MIT License](https://github.com/html-to-text/node-html-to-text/blob/master/LICENSE)

packages/html-to-text-cli/package-lock.json

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "@html-to/text-cli",
3+
"version": "0.5.0",
4+
"description": "CLI html to plain text converter",
5+
"keywords": [
6+
"html",
7+
"node",
8+
"text",
9+
"converter",
10+
"html-to-text",
11+
"cli-wrapper"
12+
],
13+
"license": "MIT",
14+
"author": "KillyMXI <[email protected]>",
15+
"homepage": "https://github.com/html-to-text/node-html-to-text",
16+
"repository": {
17+
"type": "git",
18+
"url": "git://github.com/html-to-text/node-html-to-text.git"
19+
},
20+
"bugs": {
21+
"url": "https://github.com/html-to-text/node-html-to-text/issues"
22+
},
23+
"type": "module",
24+
"bin": {
25+
"html-to-text": "./bin/cli.js"
26+
},
27+
"files": [
28+
"bin",
29+
"README.md",
30+
"CHANGELOG.md",
31+
"LICENSE"
32+
],
33+
"engines": {
34+
"node": ">=14.13.1"
35+
},
36+
"scripts": {
37+
"build:rollup": "rollup -c",
38+
"build": "npm run clean && npm run build:rollup",
39+
"clean": "rimraf bin",
40+
"copy:license": "copyfiles -f ../../LICENSE .",
41+
"prepublishOnly": "npm run copy:license"
42+
},
43+
"dependencies": {
44+
"deepmerge": "^4.2.2",
45+
"aspargvs": "^0.5.0"
46+
}
47+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
// const json = require('@rollup/plugin-json');
3+
const { nodeResolve } = require('@rollup/plugin-node-resolve');
4+
5+
/**
6+
* @type {import('rollup').RollupOptions}
7+
*/
8+
module.exports = {
9+
input: 'src/cli.js',
10+
output: [
11+
{
12+
// banner: '#!/usr/bin/env node\n',
13+
file: 'bin/cli.js',
14+
format: 'es',
15+
}
16+
],
17+
plugins: [
18+
// json(),
19+
nodeResolve({ resolveOnly: ['@html-to-text/html-to-text'] })
20+
],
21+
};

0 commit comments

Comments
 (0)