From c7e05df9c0b94c3cb53b8b310f1e0d64fda1e6f9 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Wed, 7 Apr 2021 19:43:07 +0200 Subject: [PATCH 1/7] Create dependabot.yml --- .github/dependabot.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..894c440a0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 + +updates: +- package-ecosystem: javascript + directory: / + target-branch: develop + schedule: + interval: daily From 74c109d6f1966727eed7c75e4698eb15d620d04c Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Wed, 7 Apr 2021 20:03:48 +0200 Subject: [PATCH 2/7] Update pr-labeler.yml to support Dependabot --- .github/pr-labeler.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml index 077cc568b..5ed526bc5 100644 --- a/.github/pr-labeler.yml +++ b/.github/pr-labeler.yml @@ -1,3 +1,4 @@ 'Type: Bug / Error': 'bug/*' 'Type: Enhancement': 'feature/*' 'Type: Other': 'other/*' +'Type: Dependabot': 'dependabot/*' From 8af62c37bb36e193fb1930780f8fb440440e5326 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Wed, 7 Apr 2021 22:47:15 +0200 Subject: [PATCH 3/7] Update dependabot.yml --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 894c440a0..2faf97966 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,7 @@ version: 2 updates: -- package-ecosystem: javascript +- package-ecosystem: npm directory: / target-branch: develop schedule: From 7866e761cc8c48576ae36c5456c53469a171bb1f Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Wed, 7 Apr 2021 23:03:18 +0200 Subject: [PATCH 4/7] Update dependabot.yml For npm and github-actions --- .github/dependabot.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2faf97966..2b09726b9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,3 +6,8 @@ updates: target-branch: develop schedule: interval: daily +- package-ecosystem: github-actions + directory: / + target-branch: develop + schedule: + interval: daily From 9eedd6c57ae08ad3cc2ae0d480bd399af01eb029 Mon Sep 17 00:00:00 2001 From: laDanz Date: Fri, 9 Apr 2021 14:12:45 +0200 Subject: [PATCH 5/7] Update development.md little grammar fix --- docs/development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development.md b/docs/development.md index adc51cccf..22b110e28 100644 --- a/docs/development.md +++ b/docs/development.md @@ -74,7 +74,7 @@ To start working with the e2e tests: The rendering tests are very straightforward to create. There is a function `imgSnapshotTest`, which takes a diagram in text form and the mermaid options, and it renders that diagram in Cypress. -When running in CI it will take a snapshot of the rendered diagram and compare it with the snapshot from last build and flag for review it if it differs. +When running in CI it will take a snapshot of the rendered diagram and compare it with the snapshot from last build and flag it for review if it differs. This is what a rendering test looks like: From 84f664de14b4650932988533a1768a8f4f74db58 Mon Sep 17 00:00:00 2001 From: Ahmad Nassri Date: Mon, 12 Apr 2021 15:56:17 -0400 Subject: [PATCH 6/7] fix(id-generator): re-write generator to allow it to function properly after compiling in cli --- src/mermaid.js | 2 +- src/utils.js | 22 ++++++++++++---------- src/utils.spec.js | 6 +++--- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/mermaid.js b/src/mermaid.js index b872df2fc..d6e67f699 100644 --- a/src/mermaid.js +++ b/src/mermaid.js @@ -78,7 +78,7 @@ const init = function() { mermaidAPI.updateSiteConfig({ gantt: mermaid.ganttConfig }); } - const idGeneratior = utils.initIdGeneratior(conf.deterministicIds, conf.deterministicIDSeed); + const idGeneratior = new utils.initIdGeneratior(conf.deterministicIds, conf.deterministicIDSeed); let txt; diff --git a/src/utils.js b/src/utils.js index 97b6d125f..b6e2a9d9a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -793,17 +793,19 @@ export const configureSvgSize = function(svgElem, height, width, useMaxWidth) { d3Attrs(svgElem, attrs); }; -export const initIdGeneratior = function(deterministic, seed) { - if (!deterministic) return { next: () => Date.now() }; - class iterator { - constructor() { - return (this.count = seed ? seed.length : 0); - } - next() { - return this.count++; - } +export const initIdGeneratior = class iterator { + constructor (deterministic, seed) { + this.deterministic = deterministic; + this.seed = seed; + + this.count = seed ? seed.length : 0 + } + + next() { + if (!this.deterministic) return Date.now(); + + return this.count++; } - return new iterator(); }; export default { diff --git a/src/utils.spec.js b/src/utils.spec.js index 66b13a276..c490099dd 100644 --- a/src/utils.spec.js +++ b/src/utils.spec.js @@ -256,7 +256,7 @@ describe('when calculating SVG size', function() { describe('when initializing the id generator', function () { it('should return a random number generator based on Date', function (done) { - const idGenerator = utils.initIdGeneratior(false) + const idGenerator = new utils.initIdGeneratior(false) expect(typeof idGenerator.next).toEqual('function') const lastId = idGenerator.next() setTimeout(() => { @@ -266,7 +266,7 @@ describe('when initializing the id generator', function () { }); it('should return a non random number generator', function () { - const idGenerator = utils.initIdGeneratior(true) + const idGenerator = new utils.initIdGeneratior(true) expect(typeof idGenerator.next).toEqual('function') const start = 0 const lastId = idGenerator.next() @@ -275,7 +275,7 @@ describe('when initializing the id generator', function () { }); it('should return a non random number generator based on seed', function () { - const idGenerator = utils.initIdGeneratior(true, 'thisIsASeed') + const idGenerator = new utils.initIdGeneratior(true, 'thisIsASeed') expect(typeof idGenerator.next).toEqual('function') const start = 11 const lastId = idGenerator.next() From f78d8b3e5ee37f9085c2e2b58ba529a322361937 Mon Sep 17 00:00:00 2001 From: Ahmad Nassri Date: Mon, 12 Apr 2021 16:28:14 -0400 Subject: [PATCH 7/7] fix(lint): correct lint errors --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index b6e2a9d9a..f1eac0bee 100644 --- a/src/utils.js +++ b/src/utils.js @@ -794,11 +794,11 @@ export const configureSvgSize = function(svgElem, height, width, useMaxWidth) { }; export const initIdGeneratior = class iterator { - constructor (deterministic, seed) { + constructor(deterministic, seed) { this.deterministic = deterministic; this.seed = seed; - this.count = seed ? seed.length : 0 + this.count = seed ? seed.length : 0; } next() {