This precompiler can be used to inject License statement into the feature files.
'use strict';
const compiler = require('gherking');
const { default: License } = require('gpc-license');
let ast = await compiler.load('./features/src/login.feature');
ast = compiler.process(
ast,
new License({
licenseFile: './LICENSE',
})
);
await compiler.save('./features/dist/login.feature', ast, {
lineBreak: '\r\n'
});
import {load, process, save} from "gherking";
import License from "gpc-license";
let ast = await load("./features/src/login.feature");
ast = process(
ast,
new License({
licenseFile: './LICENSE',
})
);
await save('./features/dist/login.feature', ast, {
lineBreak: '\r\n'
});
You can set the license text to the feature files in 3 ways:
licenseFile
option to the file's path where the license is stored, then it is added to each feature file as a comment.licenseText
option to the exact license text, and it is added to each feature file as a comment.${LICENSE}
token in the license text, to inject the content of the license file, thus it must be added to the license text!You can find a proper License in the following site for your project: https://choosealicense.com/licenses.
The license text can be placed either in the start or the end of the feature file. By default it is placed in the start of the feature file. It can be set via the placement
configuration option, with one of the LicensePlacement
enum values.
This package uses debug for logging, use gpc:license
:
DEBUG=gpc:license* gherking ...
For detailed documentation see the TypeDocs documentation.
Generated using TypeDoc