@bpmn-io/bpmnlint-generate-docs-images
Advanced tools
Comparing version 0.3.0 to 0.3.1
34
cmd.js
@@ -18,4 +18,4 @@ #!/usr/bin/env node | ||
const rollupResolve = require('rollup-plugin-node-resolve'); | ||
const rollupCommonjs = require('rollup-plugin-commonjs'); | ||
const rollupResolve = require('@rollup/plugin-node-resolve'); | ||
const rollupCommonjs = require('@rollup/plugin-commonjs'); | ||
@@ -150,3 +150,4 @@ function fail(...args) { | ||
'forgiving': false, | ||
'verbose': false | ||
'verbose': false, | ||
'cleanup': true | ||
} | ||
@@ -171,4 +172,8 @@ }); | ||
const cleanup = args['cleanup']; | ||
const forgiving = args['forgiving']; | ||
verbose && console.log('Executing in %s', path.resolve(pluginDirectory)); | ||
if (!fs.existsSync(pluginDirectory)) { | ||
@@ -244,3 +249,3 @@ return fail('Directory %s does not exist', pluginDirectory); | ||
if (verbose) { | ||
console.log('Found %s documented rules: \n %s\n', rulesWithExamples.length, rulesWithExamples.map(r => r.name).join('\n ')); | ||
console.log('Found %s documented rules: \n %s', rulesWithExamples.length, rulesWithExamples.map(r => r.name).join('\n ')); | ||
} else { | ||
@@ -266,3 +271,3 @@ console.log('Found %s documented rules', rulesWithExamples.length); | ||
const workingDirectory = path.join(__dirname, 'tmp'); | ||
const workingDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'bpmnlint-generate-docs-images')); | ||
@@ -290,14 +295,21 @@ verbose && console.debug('Using working directory %s', workingDirectory); | ||
for (const lib of [ 'bpmn-js', 'bpmn-js-bpmnlint' ]) { | ||
fs.symlinkSync(path.dirname(require.resolve(`${lib}/package.json`)), path.join(workingDirectory, 'node_modules', lib)); | ||
} | ||
verbose && console.log('Compiling builder script'); | ||
await pack(script); | ||
console.log('Generating images'); | ||
await generateImages(workingDirectory, rulesWithExamples); | ||
} finally { | ||
fs.unlinkSync(path.join(workingDirectory, 'node_modules', pluginName)); | ||
cleanup && verbose && console.log('Cleaning up %s', workingDirectory); | ||
cleanup && fs.rmSync(workingDirectory, { recursive: true, force: true }); | ||
} | ||
console.log('Generating images'); | ||
await generateImages(workingDirectory, rulesWithExamples); | ||
console.log('\nDone.'); | ||
console.log('Done'); | ||
} | ||
@@ -304,0 +316,0 @@ |
{ | ||
"name": "@bpmn-io/bpmnlint-generate-docs-images", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Generate documentation images for bpmnlint rules", | ||
@@ -9,4 +9,4 @@ "scripts": { | ||
"test": "run-s test:*", | ||
"test:bpmnlint": "(cd tmp && npx degit github:bpmn-io/bpmnlint bpmnlint --force && node ../cmd.js bpmnlint --verbose)", | ||
"test:example": "(cd tmp && npx degit github:bpmn-io/bpmnlint-plugin-example example --force && node ../cmd.js example --verbose)" | ||
"test:bpmnlint": "(cd tmp && npx degit github:bpmn-io/bpmnlint bpmnlint --force && cd bpmnlint && node ../../cmd.js . --verbose)", | ||
"test:example": "(cd tmp && npx degit github:bpmn-io/bpmnlint-plugin-example example --force && node ../cmd.js example)" | ||
}, | ||
@@ -27,4 +27,6 @@ "bin": "cmd.js", | ||
"dependencies": { | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"bpmn-js": "^11.3.1", | ||
"bpmn-js-bpmnlint": "^0.20.0", | ||
"bpmn-js-bpmnlint": "^0.20.1", | ||
"bpmnlint": "^8.1.1", | ||
@@ -34,5 +36,3 @@ "mri": "^1.1.4", | ||
"rollup": "^3.15.0", | ||
"rollup-plugin-bpmnlint": "^0.3.1", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-bpmnlint": "^0.4.1", | ||
"tiny-glob": "^0.2.6" | ||
@@ -39,0 +39,0 @@ }, |
# bpmnlint-generate-docs-images | ||
[![Build Status](https://travis-ci.com/bpmn-io/bpmnlint-generate-docs-images.svg?branch=master)](https://travis-ci.com/bpmn-io/bpmnlint-generate-docs-images) | ||
[![CI](https://github.com/bpmn-io/bpmnlint-generate-docs-images/actions/workflows/CI.yml/badge.svg)](https://github.com/bpmn-io/bpmnlint-generate-docs-images/actions/workflows/CI.yml) | ||
@@ -20,2 +20,2 @@ Generate documentation images for your bpmnlint rules. | ||
MIT | ||
MIT |
@@ -48,29 +48,20 @@ import bpmnlintConfig from '.bpmnlintrc'; | ||
function renderDiagram(diagramXML) { | ||
async function renderDiagram(diagramXML) { | ||
return new Promise((resolve, reject) => { | ||
linting.toggle(false); | ||
linting.toggle(false); | ||
instance.importXML(diagramXML, function(err) { | ||
await instance.importXML(diagramXML); | ||
if (err) { | ||
return reject(err); | ||
} | ||
const { inner } = canvas.viewbox(); | ||
const { inner } = canvas.viewbox(); | ||
const delta = { | ||
x: - Math.round(inner.x) + 210, | ||
y: - Math.round(inner.y) + 25 | ||
}; | ||
const delta = { | ||
x: - Math.round(inner.x) + 210, | ||
y: - Math.round(inner.y) + 25 | ||
}; | ||
modeling.moveElements(canvas.getRootElement().children, delta); | ||
modeling.moveElements(canvas.getRootElement().children, delta); | ||
const viewbox = canvas.viewbox(); | ||
const viewbox = canvas.viewbox(); | ||
resolve(viewbox.inner); | ||
}); | ||
}); | ||
return viewbox.inner; | ||
} | ||
@@ -80,5 +71,6 @@ | ||
return new Promise((resolve) => { | ||
return new Promise(resolve => { | ||
eventBus.once('linting.completed', 100, (event) => { | ||
return resolve(Object.keys(event.issues).length); | ||
setTimeout(() => resolve(Object.keys(event.issues).length), 100); | ||
}); | ||
@@ -85,0 +77,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
11881
268
21
0
3
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@rollup/plugin-commonjs@24.1.0(transitive)
+ Added@rollup/plugin-node-resolve@15.3.0(transitive)
+ Added@rollup/pluginutils@5.1.3(transitive)
+ Added@types/resolve@1.20.2(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedcommondir@1.0.1(transitive)
+ Addeddeepmerge@4.3.1(transitive)
+ Addedestree-walker@2.0.2(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@8.1.0(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedmagic-string@0.27.0(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedpicomatch@4.0.2(transitive)
+ Addedrollup-plugin-bpmnlint@0.4.1(transitive)
- Removedrollup-plugin-commonjs@^10.1.0
- Removedrollup-plugin-node-resolve@^5.2.0
- Removed@types/resolve@0.0.8(transitive)
- Removedbuiltin-modules@3.3.0(transitive)
- Removedmagic-string@0.25.9(transitive)
- Removedrollup-plugin-bpmnlint@0.3.1(transitive)
- Removedrollup-plugin-commonjs@10.1.0(transitive)
- Removedrollup-plugin-node-resolve@5.2.0(transitive)
- Removedsourcemap-codec@1.4.8(transitive)
Updatedbpmn-js-bpmnlint@^0.20.1