Skip to content

Commit

Permalink
Feature/implementation (#1)
Browse files Browse the repository at this point in the history
Implemented the precompiler with the new gherking API.
  • Loading branch information
szikszail committed Jan 28, 2022
1 parent f5226bb commit 19d725f
Show file tree
Hide file tree
Showing 29 changed files with 10,266 additions and 2,346 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/beta-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

# 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: Beta Release

on:
push:
branches:
- 'beta/**'

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 run build

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- name: Generate build number
uses: einaregilsson/build-number@v3
with:
token: ${{secrets.github_token}}
- name: Checkout
uses: actions/checkout@v2
- name: Setting up Node.js
uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: Install
run: npm ci
- name: Build
run: npm run buildUpdate
- name: Release
run: |
cv=$(cat package.json | grep version | cut -d '"' -f 4)
echo "$cv-beta.$BUILD_NUMBER"
npm --no-git-tag-version version "$cv-beta.$BUILD_NUMBER"
npm publish --tag beta .
working-directory: ./dist
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

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

steps:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.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 }}
Expand All @@ -23,4 +28,4 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
clover_file: "coverage/clover.xml"
threshold_alert: 60
threshold_warning: 80
threshold_warning: 80
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16
- run: npm ci
- run: npm build
- run: npm run build

publish-npm:
needs: build
Expand All @@ -26,10 +26,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run buildUpdate
- run: npm publish ./dist
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0 - 2022-01-28

Implemented precompiler
52 changes: 34 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,65 @@
# gpc-template
# gpc-remove-duplicates

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

This repository is a template to create precompilers for GherKing.
![Downloads](https://img.shields.io/npm/dw/gpc-remove-duplicates?style=flat-square) ![Version@npm](https://img.shields.io/npm/v/gpc-remove-duplicates?label=version%40npm&style=flat-square) ![Version@git](https://img.shields.io/github/package-json/v/gherking/gpc-remove-duplicates/master?label=version%40git&style=flat-square) ![CI](https://img.shields.io/github/workflow/status/gherking/gpc-remove-duplicates/CI/master?label=ci&style=flat-square) ![Docs](https://img.shields.io/github/workflow/status/gherking/gpc-remove-duplicates/Docs/master?label=docs&style=flat-square)

## Usage

```javascript
'use strict';
const compiler = require('gherking');
const {Template} = require('gpc-template');
const RemoveDuplicates = require('gpc-remove-duplicates');

let ast = compiler.load('./features/src/login.feature');
let ast = await compiler.load('./features/src/login.feature');
ast = compiler.process(
ast,
new Template({
new RemoveDuplicates({
// config
})
);
compiler.save('./features/dist/login.feature', ast, {
await compiler.save('./features/dist/login.feature', ast, {
lineBreak: '\r\n'
});
```

```typescript
'use strict';
import {load, process, save} from "gherking";
import {Template} from "gpc-template";
import RemoveDuplicates from "gpc-remove-duplicates";

let ast = load("./features/src/login.feature");
let ast = await load("./features/src/login.feature");
ast = process(
ast,
new Template({
new RemoveDuplicates({
// config
})
);
save('./features/dist/login.feature', ast, {
await save('./featuresdist/login.feature', ast, {
lineBreak: '\r\n'
});
```

For detailed documentation see the [TypeDocs documentation](https://gherking.github.io/gpc-template/).
The RemoveDuplicates precompiler is responsible for having only a reasonable amount of tags and/or rows in each feature file.

It can proceed with the following actions:
1. Removes tags from Rule/Scenario/ScenarioOutline/Examples which exists on parent (Feature/Rule/ScenarioOutline) too.
1. Removes duplicate tags from Feature/Rule/Scenario/ScearioOutline/Examples.
1. Removes duplicate rows from Examples and step DataTables.

## Configuration

RemoveDuplicateRows accepts the following configuration:

| Option | Type | Description | Default |
|:------:|:----:|:------------|:--------|
| `processTags` | `boolean` | It indicates whether the 1st and 2nd options should be applied. | `true` |
| `processRows` | `boolean` | It indicates whether the 3rd option should be applied. | `false` |

## Other

This package uses [debug](https://www.npmjs.com/package/debug) for logging, use `gpc:remove-duplicates` :

```shell
DEBUG=gpc:remove-duplicates* gherking ...
```

This package uses [debug](https://www.npmjs.com/package/debug) for logging.
For detailed documentation see the [TypeDocs documentation](https://gherking.github.io/gpc-remove-duplicates/).
Loading

0 comments on commit 19d725f

Please sign in to comment.