-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from webpod/mvp
chore: mvp
- Loading branch information
Showing
19 changed files
with
5,087 additions
and
2 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,85 @@ | ||
# This is a Github Workflow that runs tests on any push or pull request. | ||
# If the tests pass and this is a push to the master branch it also runs Semantic Release. | ||
name: CI | ||
on: [push, pull_request] | ||
jobs: | ||
push: | ||
name: Push ${{ github.ref }} | ||
if: github.event_name == 'push' | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
checks: read | ||
statuses: write | ||
contents: write | ||
packages: write | ||
id-token: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: ${{ github.ref == 'refs/heads/main' && '0' || '1' }} | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
# cache: 'yarn' | ||
|
||
- name: Fetch deps | ||
run: yarn --mutex network --frozen-lockfile --network-concurrency 25 --silent --disable-self-update-check | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Run tests | ||
run: yarn test | ||
|
||
# - name: Codeclimate | ||
# if: github.ref == 'refs/heads/main' | ||
# uses: paambaati/[email protected] | ||
# env: | ||
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
# with: | ||
# coverageLocations: | | ||
# ${{github.workspace}}/target/coverage/lcov.info:lcov | ||
|
||
# - name: Semantic Release | ||
# if: github.ref == 'refs/heads/main' | ||
# env: | ||
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
# NPM_PROVENANCE: true | ||
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# GIT_BRANCH: 'main' | ||
# GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} | ||
# GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} | ||
# GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }} | ||
# GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }} | ||
# run: npm_config_yes=true npx zx-semrel | ||
|
||
pr: | ||
if: github.event_name == 'pull_request' | ||
name: PR (Node v${{ matrix.node-version }}, OS ${{ matrix.os }}) | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-22.04 ] | ||
node-version: [ 20 ] | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
|
||
- name: Fetch deps | ||
run: yarn --mutex network --frozen-lockfile --network-concurrency 25 --silent --disable-self-update-check | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Run tests | ||
run: yarn test |
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 |
---|---|---|
@@ -1,2 +1,45 @@ | ||
# ingrid | ||
A shell-printed tables parser | ||
# @webpod/ingrid | ||
> A shell-printed tables parser | ||
## Usage | ||
There are so many tools for printing tables in the shell, but much less to parse them back. | ||
|
||
```ts | ||
import { parse } from '@webpod/ingrid' | ||
|
||
const table = ` | ||
foo bar baz | ||
1 2 3 | ||
` | ||
const result = parse(table.trim()) | ||
// {foo: ['1'], bar: ['2'], baz: ['3']} | ||
``` | ||
|
||
To parse [wmic](https://en.wikipedia.org/wiki/Windows_Management_Instrumentation) grids, set the `format` option: | ||
|
||
```ts | ||
const table = ` | ||
foo bar baz | ||
1 | ||
2 3 | ||
a | ||
b c | ||
d e | ||
` | ||
|
||
const result = parse(table.trim(), {format: 'win'}) | ||
/** | ||
[ | ||
{ foo: ['1'], bar: ['2'], baz: ['3'] }, | ||
{ foo: ['a'], bar: ['b'], baz: ['c'] }, | ||
{ foo: ['a'], bar: ['d'], baz: ['e'] } | ||
] | ||
*/ | ||
``` | ||
|
||
## License | ||
[MIT](./LICENSE) |
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,58 @@ | ||
{ | ||
"name": "@webpod/ingrid", | ||
"version": "0.0.0", | ||
"description": "A shell-printed tables parser", | ||
"type": "module", | ||
"main": "target/cjs/index.cjs", | ||
"exports": { | ||
".": { | ||
"types": "./target/dts/index.d.ts", | ||
"require": "./target/cjs/index.cjs", | ||
"import": "./target/esm/index.mjs", | ||
"default": "./target/esm/index.mjs" | ||
} | ||
}, | ||
"module": "target/esm/index.mjs", | ||
"types": "target/dts/index.d.ts", | ||
"files": [ | ||
"target/cjs", | ||
"target/esm", | ||
"target/dts" | ||
], | ||
"scripts": { | ||
"build": "concurrently 'npm:build:*'", | ||
"build:js": "node ./src/scripts/build.mjs", | ||
"build:dts": "tsc --emitDeclarationOnly --outDir target/dts", | ||
"build:docs": "typedoc --options src/main/typedoc", | ||
"build:stamp": "npx buildstamp", | ||
"test": "concurrently 'npm:test:*'", | ||
"test:lint": "eslint -c src/test/lint/.eslintrc.json src", | ||
"test:unit": "c8 -r lcov -r text -o target/coverage -x src/scripts -x src/test -x target node --loader ts-node/esm --experimental-specifier-resolution=node src/scripts/test.mjs" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/webpod/ingrid.git" | ||
}, | ||
"author": "Anton Golub <[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/webpod/ingrid/issues" | ||
}, | ||
"homepage": "https://github.com/webpod/ingrid#readme", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@types/node": "^20.11.30", | ||
"c8": "^9.1.0", | ||
"concurrently": "^8.2.2", | ||
"esbuild": "^0.20.2", | ||
"esbuild-node-externals": "^1.13.0", | ||
"esbuild-plugin-entry-chunks": "^0.1.11", | ||
"eslint": "^8.57.0", | ||
"eslint-config-qiwi": "^2.1.3", | ||
"fast-glob": "^3.3.2", | ||
"minimist": "^1.2.8", | ||
"ts-node": "^10.9.2", | ||
"typedoc": "^0.25.12", | ||
"typescript": "^5.4.3" | ||
} | ||
} |
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 @@ | ||
export type * from './ingrid.ts' | ||
export { parse } from './ingrid.ts' |
Oops, something went wrong.