Skip to content

Commit

Permalink
Feature/implementation (#2)
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
szikszail authored Mar 25, 2021
1 parent 9f675ec commit fc87541
Show file tree
Hide file tree
Showing 19 changed files with 6,694 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
21 changes: 21 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/ban-ts-comment": 0
}
}
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: CI

on:
push:
branches:
- master
- 'feature/**'
- 'bugfix/**'
- 'hotfix/**'
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
32 changes: 32 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Docs

on:
push:
branches:
- master
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected] # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false

- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
npm install
npm run build
- name: Deploy
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: docs # The folder the action should deploy.
CLEAN: true # Automatically remove deleted files from the deploy branch
26 changes: 26 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Pull requests

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- name: Monitor coverage
if: ${{ always() }}
uses: szikszail/coverage-monitor-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clover_file: "coverage/clover.xml"
threshold_alert: 60
threshold_warning: 80
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Release

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm ci
- run: npm build

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run buildUpdate
- run: npm publish ./dist
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ bower_components
# node-waf configuration
.lock-wscript

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

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
# TypeScript v1 declaration files
typings/

# Optional npm cache directory
Expand All @@ -57,3 +57,9 @@ typings/
# dotenv environment variables file
.env

# next.js build output
.next

dist
docs
reports
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

## 1.0.0 - TBD

### Added

* Created package
* Added implementation
* Added CI
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Szikszai László
Copyright (c) 2019 Szikszai László

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
61 changes: 60 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,60 @@
# gherkin-io
# gherkin-io

![Downloads](https://img.shields.io/npm/dw/gherkin-io?style=flat-square)
![Version@npm](https://img.shields.io/npm/v/gherkin-io?label=version%40npm&style=flat-square)
![Version@git](https://img.shields.io/github/package-json/v/gherking/gherkin-io/master?label=version%40git&style=flat-square)
![CI](https://img.shields.io/github/workflow/status/gherking/gherkin-io/CI/master?label=ci&style=flat-square)
![Docs](https://img.shields.io/github/workflow/status/gherking/gherkin-io/Docs/master?label=docs&style=flat-square)

Tool to read/write GHerkin feature files and work with Gherking AST

## Usage

### Read feature files

The `read` function can be used to parse feature file(s) to [AST](https://github.com/gherking/gherkin-io).

```typescript
read(pattern: string): Promise<Document[]>
```

In TypeScript:
```typescript
import {read, Document} from "gherkin-io";

const documents: Document[] = await read("./features/*.feature");
```

In JavaScript:
```javascript
const {read} = require("gherkin-io");
const documents = await read("./features/*.feature");
```

### Write feature files

The `write` function can be used to write an AST to a feature file.

```typescript
write(filePath: string, document: Document, options?: FormatterOptions): Promise<void>
```

In TypeScript:
```typescript
import {Document, write, FormatterOptions} from "gherkin-io";
const document: Document = new Document(/*...*/);
const options: FormatterOptions = {/*...*/};
await write("./test.feature", document, options);
```

In JavaScript:
```javascript
const {write, Document} = require("gherkin-io");
const document = new Document(/*...*/);
const options = {/*...*/};
await write("./test.feature", document, options);
```

`FormatterOptions` is re-exported from [gherkin-formatter](https://github.com/gherking/gherkin-formatter).

For detailed documentation see the [TypeDocs documentation](https://gherking.github.io/gherkin-io/).
Empty file added docs/.gitkeep
Empty file.
Loading

0 comments on commit fc87541

Please sign in to comment.