How to use pluginDirectory method in stryker-parent

Best JavaScript code snippet using stryker-parent

cmd.js

Source:cmd.js Github

copy

Full Screen

1#!/usr/bin/env node2const fs = require('fs');3const path = require('path');4const os = require('os');5const puppeteer = require('puppeteer');6const mri = require('mri');7const glob = require('tiny-glob');8const {9 rollup10} = require('rollup');11const rollupBpmnlint = require('rollup-plugin-bpmnlint');12const rollupResolve = require('rollup-plugin-node-resolve');13const rollupCommonjs = require('rollup-plugin-commonjs');14function fail(...args) {15 console.error(...args);16 process.exit(1);17}18async function pack(file) {19 const bundle = await rollup({20 input: file,21 plugins: [22 rollupResolve({23 mainFields: [ 'browser', 'module', 'main' ]24 }),25 rollupCommonjs(),26 rollupBpmnlint()27 ]28 });29 const result = await bundle.generate({30 format: 'iife',31 exports: 'named'32 });33 const { code } = result.output[0];34 fs.writeFileSync(file, code, 'utf8');35}36async function generateImage(page, bpmnFile, imageFile) {37 const xml = fs.readFileSync(bpmnFile, 'utf8');38 const viewbox = await page.evaluate(xml => renderDiagram(xml), xml);39 await page.setViewport({40 width: 800,41 height: viewbox.y * 2 + viewbox.height,42 deviceScaleFactor: 243 });44 const issues = await page.evaluate(() => lint());45 await page.screenshot({ path: imageFile });46 return issues;47}48async function generateImages(workingDirectory, rulesWithExamples) {49 const browser = await puppeteer.launch();50 const page = await browser.newPage();51 await page.goto('file://' + workingDirectory + '/index.html', { waitUntil: 'networkidle2' });52 for (const rule of rulesWithExamples) {53 console.log(' rule: %s', rule.name);54 await page.evaluate(name => enableRule(name), rule.name);55 const correctResults = await generateImage(page, rule.correctBPMN, rule.correctImage);56 if (correctResults > 0) {57 console.warn('found %s warnings evaluating correct BPMN', correctResults);58 }59 const incorrectResults = await generateImage(page, rule.incorrectBPMN, rule.incorrectImage);60 if (incorrectResults === 0) {61 console.error('found no errors evaluating incorrect BPMN');62 }63 }64 await browser.close();65}66async function globRules(pluginDirectory) {67 const ruleDirectory = path.join(pluginDirectory, 'docs/rules');68 if (!fs.existsSync(ruleDirectory)) {69 return [];70 }71 return await glob('*.md', {72 cwd: ruleDirectory,73 filesOnly: true74 });75}76async function globRules(pluginDirectory) {77 const ruleDirectory = path.join(pluginDirectory, 'docs/rules');78 if (!fs.existsSync(ruleDirectory)) {79 return [];80 }81 const rules = await glob('*.md', {82 cwd: ruleDirectory,83 filesOnly: true84 });85 return rules.filter(r => r !== 'README.md');86}87async function globExamples(pluginDirectory) {88 const exampleDirectory = path.join(pluginDirectory, 'docs/rules/examples');89 if (!fs.existsSync(exampleDirectory)) {90 return [];91 }92 return await glob('*.bpmn', {93 cwd: path.join(pluginDirectory, 'docs/rules/examples'),94 filesOnly: true95 });96}97async function run() {98 const argv = process.argv.slice(2);99 const args = mri(argv, {100 default: {101 'dry-run': false,102 'forgiving': false,103 'verbose': false104 }105 });106 if (args.version) {107 console.log(require('./package').version);108 return;109 }110 if (args._.length !== 1 || args.help) {111 return fail('Usage: bpmnlint-generate-images [pluginDirectory]');112 }113 const pluginDirectory = path.resolve(args._[0]);114 const dryRun = args['dry-run'];115 const verbose = args['verbose'];116 const forgiving = args['forgiving'];117 if (!fs.existsSync(pluginDirectory)) {118 return fail('Directory %s does not exist', pluginDirectory);119 }120 let pkg;121 try {122 pkg = require(path.join(pluginDirectory + '/package.json'));123 } catch (err) {124 return fail('Missing package.json in path %s', pluginDirectory);125 }126 const pluginName = pkg.name;127 const shortNameMatch = /^bpmnlint(?:-plugin-(.+))?$/.exec(pluginName);128 if (!shortNameMatch) {129 return fail('Unexpected plug-in name, expected bpmnlint || bpmnlint-plugin-{SHORT_NAME}');130 }131 const pluginShortName = shortNameMatch[1] || shortNameMatch[0];132 let ruleDocs = await globRules(pluginDirectory);133 let ruleExamples = await globExamples(pluginDirectory);134 const errors = [];135 const rulesWithExamples = ruleDocs.map(doc => {136 const ruleName = path.basename(doc, '.md');137 const incorrectBPMN = ruleExamples.find(e => e === `${ruleName}-incorrect.bpmn`);138 const correctBPMN = ruleExamples.find(e => e === `${ruleName}-correct.bpmn`);139 if (!correctBPMN) {140 errors.push(`${ruleName}: missing correct example`);141 }142 if (!incorrectBPMN) {143 errors.push(`${ruleName}: missing incorrect example`);144 }145 if (correctBPMN && incorrectBPMN) {146 return {147 name: pluginShortName === 'bpmnlint' ? ruleName : `${pluginShortName}/${ruleName}`,148 correctBPMN: path.join(pluginDirectory, 'docs/rules/examples', correctBPMN),149 correctImage: path.join(pluginDirectory, 'docs/rules/examples', path.basename(correctBPMN, '.bpmn') + '.png'),150 incorrectBPMN: path.join(pluginDirectory, 'docs/rules/examples', incorrectBPMN),151 incorrectImage: path.join(pluginDirectory, 'docs/rules/examples', path.basename(incorrectBPMN, '.bpmn') + '.png')152 }153 }154 }).filter(doc => doc);155 if (errors.length) {156 if (forgiving) {157 console.warn('incomplete rules: \n %s\n', errors.join('\n '));158 } else {159 return fail('incomplete rules: \n %s', errors.join('\n '));160 }161 }162 if (rulesWithExamples.length === 0) {163 console.warn('No documented rules in plug-in directory %s', path.resolve(pluginDirectory));164 return;165 }166 if (verbose) {167 console.log('Found %s documented rules: \n %s\n', rulesWithExamples.length, rulesWithExamples.map(r => r.name).join('\n '));168 } else {169 console.log('Found %s documented rules', rulesWithExamples.length);170 }171 const bpmnlintrc = {172 rules: rulesWithExamples.reduce((rules, rule) => {173 rules[rule.name] = 'error';174 return rules;175 }, {})176 };177 if (dryRun) {178 console.log(`Would generate the following .bpmnlintrc`);179 console.log(JSON.stringify(bpmnlintrc, null, ' '));180 return;181 }182 const workingDirectory = path.join(__dirname, 'tmp');183 verbose && console.debug('Using working directory %s', workingDirectory);184 fs.mkdirSync(workingDirectory, { recursive: true });185 const script = path.join(workingDirectory, 'index.js');186 console.log('Assembling generator');187 fs.writeFileSync(path.join(workingDirectory, '.bpmnlintrc'), JSON.stringify(bpmnlintrc, null, ' '), 'utf8');188 fs.copyFileSync(path.join(__dirname, 'src/index.html'), path.join(workingDirectory, 'index.html'));189 fs.copyFileSync(path.join(__dirname, 'src/index.js'), path.join(workingDirectory, 'index.js'));190 fs.copyFileSync(require.resolve('bpmn-js-bpmnlint/dist/assets/css/bpmn-js-bpmnlint.css'), path.join(workingDirectory, 'bpmn-js-bpmnlint.css'));191 fs.mkdirSync(path.join(workingDirectory, 'node_modules'), { recursive: true });192 try {193 fs.symlinkSync(pluginDirectory, path.join(workingDirectory, 'node_modules', pluginName));194 verbose && console.log('Compiling builder script');195 await pack(script);196 } finally {197 fs.unlinkSync(path.join(workingDirectory, 'node_modules', pluginName));198 }199 console.log('Generating images');200 await generateImages(workingDirectory, rulesWithExamples);201 console.log('\nDone.');202}203run().catch(err => {204 return fail(err);...

Full Screen

Full Screen

Configuration.ts

Source:Configuration.ts Github

copy

Full Screen

1import path from "path";2import {VueVersionManager} from "./Managers/VueVersionManager";3const packageJson = require(path.resolve(process.cwd(), 'package.json'));4export type FileNames = {5 stores: string,6 definitions: string;7 plugin: string;8 storeClass: string;9 vueCompApi: string;10 vueCompApiExports: string;11}12export type PluginConfiguration = {13 usingTypescript?: boolean;14 pluginDirectory?: string;15 storesDirectory?: string;16 shortVueDeclaration?: boolean;17}18export type ConfigurationManagerConfiguration = {19 usingTypescript: boolean;20 pluginDirectory: string;21 storesDirectory: string;22 storesPath?: string;23 pluginPath?: string;24 shortVueDeclaration: boolean;25 versionManager: VueVersionManager,26 vueVersion: 2 | 3;27 fileExtension: string;28 storesFilePath?: string;29 definitionsFilePath?: string;30 vueStorePluginFilePath?: string;31 storeClassFilePath?: string;32}33export class Configuration {34 public static usingTypescript: boolean;35 public static pluginDirectory: string;36 public static storesDirectory: string;37 public static storesPath?: string;38 public static pluginPath?: string;39 public static shortVueDeclaration: boolean;40 public static versionManager: VueVersionManager;41 public static vueVersion: 2 | 3;42 public static fileExtension: string;43 public static storesFilePath?: string;44 public static definitionsFilePath?: string;45 public static vueStorePluginFilePath?: string;46 public static vueCompositionInstallScriptFilePath?: string;47 public static vueCompositionExportsFilePath?: string;48 public static storeClassFilePath?: string;49 public static setConfiguration(configuration?: PluginConfiguration) {50 this.usingTypescript = false;51 this.pluginDirectory = path.join('src', 'Stores', 'Plugin');52 this.storesDirectory = path.join('src', 'Stores');53 this.shortVueDeclaration = false;54 this.versionManager = new VueVersionManager();55 this.vueVersion = VueVersionManager.get().getVersion();56 this.fileExtension = '.js';57 if (configuration === undefined) {58 const packageJsonConfig = packageJson["vue-class-stores"];59 if (packageJsonConfig !== undefined) {60 configuration = packageJsonConfig;61 }62 }63 this.setupConfiguration(configuration);64 }65 public static set(key: keyof ConfigurationManagerConfiguration, value: any) {66 //@ts-ignore67 this[key] = value;68 }69 private static setupConfiguration(configuration: PluginConfiguration) {70 // Set the main configurations that were passed to the plugin71 for (let key of Object.keys(configuration)) {72 if (configuration[key] === undefined) {73 continue;74 }75 this.set(76 key as keyof ConfigurationManagerConfiguration,77 configuration[key]78 );79 }80 // Lets now configure any additional configs81 this.fileExtension = configuration.usingTypescript ? '.ts' : '.js';82 this.storesPath = path.resolve(...this.storesDirectory.split(path.sep));83 this.pluginPath = path.resolve(...this.pluginDirectory.split(path.sep));84 this.storesFilePath = path.resolve(85 ...this.pluginDirectory.split(path.sep),86 this.fileNames(true).stores,87 );88 this.definitionsFilePath = path.resolve(89 ...this.pluginDirectory.split(path.sep),90 this.fileNames(true).definitions,91 );92 this.vueStorePluginFilePath = path.resolve(93 ...this.pluginDirectory.split(path.sep),94 this.fileNames(true).plugin,95 );96 this.vueCompositionExportsFilePath = path.resolve(97 ...this.pluginDirectory.split(path.sep),98 this.fileNames(true).vueCompApiExports,99 );100 this.vueCompositionInstallScriptFilePath = path.resolve(101 ...this.pluginDirectory.split(path.sep),102 this.fileNames(true).vueCompApi,103 );104 this.storeClassFilePath = path.resolve(105 ...this.pluginDirectory.split(path.sep),106 this.fileNames(true).storeClass,107 );108 }109 public static fileNames(withExtensions = false, absolutePath = false): FileNames {110 const fileNames = {111 stores : 'VueStores',112 definitions : 'VueClassStoresPluginTypes.d.ts',113 plugin : 'VueClassStoresPlugin',114 storeClass : 'Store',115 vueCompApi : 'InstallVueCompositionApi',116 vueCompApiExports : 'VueCompositionApiExports',117 };118 if (absolutePath) {119 fileNames.storeClass = path.join(this.pluginDirectory, fileNames.storeClass);120 fileNames.stores = path.join(this.pluginDirectory, fileNames.stores);121 fileNames.definitions = path.join(this.pluginDirectory, fileNames.definitions);122 fileNames.plugin = path.join(this.pluginDirectory, fileNames.plugin);123 fileNames.vueCompApi = path.join(this.pluginDirectory, fileNames.vueCompApi);124 fileNames.vueCompApiExports = path.join(this.pluginDirectory, fileNames.vueCompApiExports);125 }126 if (withExtensions) {127 fileNames.storeClass += this.fileExtension;128 fileNames.stores += this.fileExtension;129 fileNames.plugin += this.fileExtension;130 fileNames.vueCompApi += this.fileExtension;131 fileNames.vueCompApiExports += this.fileExtension;132 }133 return fileNames;134 }...

Full Screen

Full Screen

install.js

Source:install.js Github

copy

Full Screen

1// @flow strict2const os = require('os');3const { resolve } = require('path');4const chalk = require('chalk');5const { join } = require('path');6const { mkdir, chmod, rmdir, readFile, unlink, writeFile } = require('fs').promises;7const homedir = require('os').homedir();8const { readManifest } = require('./manifest');9const executableFile = (entry) =>10`#!/usr/bin/env node11require("${resolve(entry)}");12`;13const getOSArch = () => {14 switch (os.arch()) {15 case 'x64':16 return 'amd64';17 case 'x32':18 return '386';19 }20}21const getOSType = () => {22 return os.type().toLowerCase();23};24const getOperatingSystem = () => {25 return [getOSType(), getOSArch()].join('_');26};27const getPluginDirectory = (namespace, type, version) => {28 return join(29 homedir,30 '.terraform.d/plugins/',31 'local',32 namespace,33 type,34 version,35 getOperatingSystem(),36 );37};38const getPluginFilename = (type, version) => {39 return `terraform-provider-${type}_${version}`;40}41const install = async () => {42 const manifest = await readManifest();43 const { type, namespace, version, entry } = manifest;44 console.log(chalk.blue(JSON.stringify(manifest, null, 2)));45 const pluginDirectory = getPluginDirectory(namespace, type, version);46 const pluginFilename = getPluginFilename(type, version);47 48 console.log(chalk.blue(JSON.stringify({49 pluginDirectory,50 pluginFilename,51 }, null, 2)));52 const pluginPath = join(pluginDirectory, pluginFilename);53 // $FlowFixMe54 await rmdir(pluginDirectory, { recursive: true });55 await mkdir(pluginDirectory, { recursive: true });56 await writeFile(pluginPath, executableFile(entry));57 await chmod(pluginPath, 0o775);58 console.log(chalk.bold(`Installed ${pluginFilename} to ${pluginDirectory}`));59};60const uninstall = async () => {61 const package = JSON.parse(await readFile('./package.json', 'utf8'));62 const [packageName, packageScope = '@plugins'] = package.name.split('/').reverse(); 63 const org = package.author;64 const namespace = packageScope.slice(1);65 const providerName = packageName;66 const version = package.version;67 const binary = package.main;68 const operatingSystem = getOperatingSystem();69 const pluginDirectory = join(homedir, '.terraform.d/plugins/', org, namespace, providerName, version, operatingSystem);70 const pluginFilename = `terraform-provider-${providerName}_${version}`;71 const pluginPath = join(pluginDirectory, pluginFilename);72 await unlink(pluginPath);73 // $FlowFixMe74 await rmdir(pluginDirectory, { recursive: true });75 console.log(chalk.bold(`Uninstalled ${pluginFilename} to ${pluginDirectory}`))76};77module.exports = {78 uninstall,79 install,...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { pluginDirectory } = require('stryker-parent');2const { pluginDirectory } = require('stryker-parent');3const { pluginDirectory } = require('stryker-parent');4const { pluginDirectory } = require('stryker-parent');5const { pluginDirectory } = require('stryker-parent');6const { pluginDirectory } = require('stryker-parent');7const { pluginDirectory } = require('stryker-parent');8const { pluginDirectory } = require('stryker-parent');9const { pluginDirectory } = require('stryker-parent');10const { pluginDirectory } = require('stryker-parent');11const { pluginDirectory } = require('stryker-parent');12const { pluginDirectory } = require('stryker-parent');13const { pluginDirectory } = require('stryker-parent');14const { pluginDirectory } = require('stryker-parent');15const { pluginDirectory } = require('stryker-parent');16const { pluginDirectory } = require('stryker-parent');17const { pluginDirectory } = require('stryker-parent');18const { pluginDirectory } = require('stryker-parent');

Full Screen

Using AI Code Generation

copy

Full Screen

1const strykerParent = require('stryker-parent');2strykerParent.pluginDirectory('stryker-javascript-mutator');3const strykerParent = require('stryker-parent');4strykerParent.pluginDirectory('stryker-javascript-mutator');5const strykerParent = require('stryker-parent');6strykerParent.pluginDirectory('stryker-javascript-mutator');7const strykerParent = require('stryker-parent');8strykerParent.pluginDirectory('stryker-javascript-mutator');9const strykerParent = require('stryker-parent');10strykerParent.pluginDirectory('stryker-javascript-mutator');11const strykerParent = require('stryker-parent');12strykerParent.pluginDirectory('stryker-javascript-mutator');13const strykerParent = require('stryker-parent');14strykerParent.pluginDirectory('stryker-javascript-mutator');15const strykerParent = require('stryker-parent');16strykerParent.pluginDirectory('stryker-javascript-mutator');17const strykerParent = require('stryker-parent');18strykerParent.pluginDirectory('stryker-javascript-mutator');19const strykerParent = require('stryker-parent');

Full Screen

Using AI Code Generation

copy

Full Screen

1const pluginDirectory = require('stryker-parent').pluginDirectory;2console.log(pluginDirectory('stryker-html-reporter'));3module.exports = function(config) {4 config.set({5 });6};7module.exports = function(config) {8 config.set({9 });10};11module.exports = function(config) {12 config.set({13 });14};15module.exports = function(config) {16 config.set({17 });18};19module.exports = function(config) {20 config.set({21 });22};23module.exports = function(config) {24 config.set({25 });26};27module.exports = function(config) {28 config.set({29 });30};31module.exports = function(config) {32 config.set({33 });34};35module.exports = function(config) {36 config.set({37 });38};39module.exports = function(config) {40 config.set({

Full Screen

Using AI Code Generation

copy

Full Screen

1const pluginDirectory = require('stryker-parent').pluginDirectory;2const pluginLoader = require('plugin-loader');3const plugins = pluginLoader.load(pluginDirectory('stryker-*'));4console.log(plugins);5{6 "dependencies": {7 }8}

Full Screen

Using AI Code Generation

copy

Full Screen

1const pluginDirectory = require('stryker-parent').pluginDirectory;2const pluginName = 'stryker-plugin-foo';3const plugin = require(pluginDirectory(pluginName));4module.exports = {5 pluginDirectory: function (pluginName) {6 return pluginName + '/index';7 }8};9module.exports = {10 foo: function () {11 return 'foo';12 }13};14const pluginDirectory = require('stryker-parent').pluginDirectory;15const pluginName = 'stryker-plugin-foo';16const plugin = require(pluginDirectory(pluginName));17module.exports = {18 pluginDirectory: function (pluginName) {19 return pluginName + '/index';20 }21};22module.exports = {23 foo: function () {24 return 'foo';25 }26};27const pluginDirectory = require('stryker-parent').pluginDirectory;28const pluginName = 'stryker-plugin-foo';29const plugin = require(pluginDirectory(pluginName));30module.exports = {31 pluginDirectory: function (pluginName) {32 return pluginName + '/index';33 }34};35module.exports = {36 foo: function () {37 return 'foo';38 }39};40const pluginDirectory = require('stryker-parent').pluginDirectory;41const pluginName = 'stryker-plugin-foo';42const plugin = require(pluginDirectory(pluginName));43module.exports = {44 pluginDirectory: function (pluginName) {45 return pluginName + '/index';46 }47};48module.exports = {49 foo: function () {50 return 'foo';51 }52};53const pluginDirectory = require('stryker-parent').pluginDirectory;

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stryker-parent automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful