Skip to content

Commit

Permalink
chore: init
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 5, 2021
0 parents commit c5998b1
Show file tree
Hide file tree
Showing 12 changed files with 3,061 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["@antfu"],
"rules": {}
}
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [antfu]
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '14'
registry-url: https://registry.npmjs.org/
- run: npm i -g pnpm @antfu/ni
- run: nci
- run: nr test --if-present
- run: npx conventional-github-releaser -p angular
env:
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.GITHUB_TOKEN}}
81 changes: 81 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# Nuxt generate
dist

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# IDE
.idea
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Anthony Fu <https://github.com/antfu>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# log-editor

[![NPM version](https://img.shields.io/npm/v/log-editor?color=a1b858&label=)](https://www.npmjs.com/package/log-editor)

Fan of using `console.log` to debugger? Use your editor to inspect the log instead of scrolling the congested terminal.

```diff
- console.log(largeObject)
+ console.logEditor(largeObject)
```

## Install

> Only works in Node.js environment.
```bash
npm i -D log-editor
```

Add the following statement at the very beginning of your script:

```ts
import 'log-editor'
```

Then use `console.logEditor` instead of `console.log` whenever you want to see the result in editor. It will launch the corresponsing editor powered by [`launch_editor`](https://github.com/yyx990803/launch-editor).

```ts
console.logEditor(largeObject)
```

## Options

### Named log

Pass a second argument to specify the key. When calling same key for multiple times, the same temp file will be used and overrides the previous content.

```ts
console.logEditor(largeObject, 'foo')
```

To accumulate the result of multiple calls, setting the `override` to false.

```ts
console.logEditor('message 1', 'key', { override: false })
console.logEditor('message 2', 'key', { override: false })
```

## Sponsors

<p align="center">
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
</a>
</p>

## License

[MIT](./LICENSE) License © 2021 [Anthony Fu](https://github.com/antfu)
46 changes: 46 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "log-editor",
"version": "0.0.0",
"description": "",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"funding": "https://github.com/sponsors/antfu",
"author": "Anthony Fu <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/antfu/log-editor/issues"
},
"homepage": "https://github.com/antfu/log-editor#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/antfu/log-editor.git"
},
"keywords": [],
"files": [
"dist"
],
"scripts": {
"prepublishOnly": "nr build",
"dev": "nr build --watch",
"start": "esno src/index.ts",
"build": "tsup src/index.ts --format cjs,esm --dts",
"release": "bumpp --commit --push --tag && pnpm publish",
"lint": "eslint \"{src,test}/**/*.ts\"",
"lint:fix": "nr lint -- --fix"
},
"devDependencies": {
"@antfu/eslint-config": "^0.6.2",
"@antfu/ni": "^0.5.5",
"@types/node": "^14.14.37",
"bumpp": "^6.0.6",
"eslint": "^7.23.0",
"esno": "^0.5.0",
"tsup": "^4.8.21",
"typescript": "^4.2.3"
},
"dependencies": {
"launch-editor": "^2.2.1",
"tempy": "^1.0.1"
}
}
Loading

0 comments on commit c5998b1

Please sign in to comment.