Skip to content

Commit afa4556

Browse files
committed
Initial OCLIF command setup
1 parent 5a18c44 commit afa4556

File tree

9 files changed

+560
-53
lines changed

9 files changed

+560
-53
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false

.gitignore

Lines changed: 43 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,52 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
8-
# Runtime data
9-
pids
10-
*.pid
11-
*.seed
12-
*.pid.lock
13-
14-
# Directory for instrumented libs generated by jscoverage/JSCover
15-
lib-cov
16-
17-
# Coverage directory used by tools like istanbul
18-
coverage
19-
20-
# nyc test coverage
21-
.nyc_output
22-
23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24-
.grunt
25-
261
# Bower dependency directory (https://bower.io/)
27-
bower_components
28-
29-
# node-waf configuration
30-
.lock-wscript
31-
322
# Compiled binary addons (https://nodejs.org/api/addons.html)
33-
build/Release
34-
3+
# Coverage directory used by tools like istanbul
354
# Dependency directories
36-
node_modules/
37-
jspm_packages/
38-
39-
# TypeScript v1 declaration files
40-
typings/
41-
42-
# Optional npm cache directory
43-
.npm
44-
45-
# Optional eslint cache
46-
.eslintcache
47-
5+
# Directory for instrumented libs generated by jscoverage/JSCover
6+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
7+
# Logs
488
# Optional REPL history
49-
.node_repl_history
50-
9+
# Optional eslint cache
10+
# Optional npm cache directory
5111
# Output of 'npm pack'
52-
*.tgz
53-
12+
# Runtime data
13+
# TypeScript v1 declaration files
5414
# Yarn Integrity file
55-
.yarn-integrity
56-
5715
# dotenv environment variables file
58-
.env
59-
6016
# next.js build output
17+
# node-waf configuration
18+
# nyc test coverage
19+
*-debug.log
20+
*-error.log
21+
*.log
22+
*.pid
23+
*.pid.lock
24+
*.seed
25+
*.tgz
26+
.env
27+
.eslintcache
28+
.grunt
29+
.lock-wscript
6130
.next
31+
.node_repl_history
32+
.npm
33+
.nyc_output
34+
.yarn-integrity
35+
/.nyc_output
36+
/dist
37+
/lib
38+
/tmp
39+
/yarn.lock
40+
bower_components
41+
build/Release
42+
coverage
43+
jspm_packages/
44+
lib-cov
45+
logs
46+
node_modules
47+
node_modules/
48+
npm-debug.log*
49+
pids
50+
typings/
51+
yarn-debug.log*
52+
yarn-error.log*

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
# http-toolkit-server
1+
http-toolkit-server
2+
===================
3+
4+
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
5+
[![Version](https://img.shields.io/npm/v/http-toolkit-server.svg)](https://npmjs.org/package/http-toolkit-server)
6+
[![Downloads/week](https://img.shields.io/npm/dw/http-toolkit-server.svg)](https://npmjs.org/package/http-toolkit-server)
7+
[![License](https://img.shields.io/npm/l/http-toolkit-server.svg)](https://github.com/pimterry/http-toolkit-server/blob/master/package.json)
8+
9+
The non-browser part of [HTTP Toolkit](https://httptoolkit.tech/).
10+
11+
This server is runnable standalone as a CLI, or importable into other modules to be run programmatically.
12+
13+
When run it:
14+
15+
* Configures & runs a standalone [Mockttp](https://npmjs.com/package/mockttp) server, to proxy traffic.
16+
* Starts a HTTP toolkit server, which provides various http-toolkit features that live outside the browser, including:
17+
* Reading & changing the Mockttp server configuration
18+
* Querying, starting & stopping traffic interceptors on the local machine/network.

bin/run

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs')
4+
const path = require('path')
5+
const project = path.join(__dirname, '../tsconfig.json')
6+
const dev = fs.existsSync(project)
7+
8+
if (dev) {
9+
require('ts-node').register({project})
10+
}
11+
12+
require(`../${dev ? 'src' : 'lib'}`).run()
13+
.catch(require('@oclif/errors/handle'))

bin/run.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node "%~dp0\run" %*

0 commit comments

Comments
 (0)