forked from mermaid-js/mermaid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mermaid-js#166 from sidharthv96/master
Live editor V2
- Loading branch information
Showing
186 changed files
with
10,181 additions
and
305,513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module.exports = { | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], | ||
plugins: ['svelte3', 'tailwindcss', '@typescript-eslint'], | ||
ignorePatterns: ['docs/*', '*.cjs', 'snapshots.js'], | ||
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], | ||
settings: { | ||
'svelte3/typescript': () => require('typescript') | ||
}, | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2019 | ||
}, | ||
env: { | ||
browser: true, | ||
es2017: true, | ||
node: true | ||
}, | ||
rules: { | ||
'@typescript-eslint/ban-ts-comment': [ | ||
'error', | ||
{ | ||
'ts-ignore': 'allow-with-description' | ||
} | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: 'Mermaid CodeQL config' | ||
|
||
paths: | ||
- src | ||
paths-ignore: | ||
- node_modules | ||
- '**/*.spec.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Cypress Tests | ||
|
||
on: [push] | ||
|
||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
container: cypress/browsers:node14.16.0-chrome90-ff88 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/cache@v2 | ||
id: yarn-and-build-cache | ||
with: | ||
path: | | ||
~/.cache/Cypress | ||
build | ||
node_modules | ||
key: ${{ runner.os }}-node_modules-build-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-node_modules-build- | ||
# Install NPM dependencies, cache them correctly | ||
# and run all Cypress tests | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v2 | ||
with: | ||
build: yarn build | ||
start: yarn preview | ||
wait-on: 'http://localhost:3000' | ||
wait-on-timeout: 120 | ||
record: true | ||
headless: true | ||
env: | ||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
dist/ | ||
docs/** | ||
.svelte-kit/** | ||
static/** | ||
build/** | ||
node_modules/** | ||
snapshots.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"singleQuote": true, | ||
"svelteSortOrder": "scripts-styles-markup", | ||
"svelteBracketNewLine": false | ||
} | ||
"singleQuote": true, | ||
"svelteSortOrder": "options-scripts-markup-styles", | ||
"svelteBracketNewLine": false, | ||
"useTabs": true, | ||
"trailingComma": "none", | ||
"printWidth": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
pushd ../docs | ||
# find ./ -type f -exec sed -i 's/service-worker.js/mermaid-live-editor\/service-worker.js/g' {} \; | ||
find ./ -type f -exec sed -i 's/manifest.json/\/mermaid-live-editor\/manifest.json/g' {} \; | ||
find ./ -type f -exec sed -i 's/favicon.png/\/mermaid-live-editor\/favicon.png/g' {} \; | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"projectId": "2ckppp", | ||
"$schema": "https://on.cypress.io/cypress.schema.json", | ||
"baseUrl": "http://localhost:3000", | ||
"pluginsFile": "./cypress/plugins/index.cjs", | ||
"viewportWidth": 1440, | ||
"viewportHeight": 768, | ||
"snapshotFileName": "./cypress/snapshots.js", | ||
"defaultCommandTimeout": 16000, | ||
"requestTimeout": 16000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"plugins": ["cypress", "mocha"], | ||
"extends": ["plugin:cypress/recommended", "plugin:mocha/recommended"], | ||
"rules": { | ||
"jest/expect-expect": "off", | ||
"mocha/no-mocha-arrows": "off" | ||
}, | ||
"env": { | ||
"cypress/globals": true, | ||
"mocha": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "hello@cypress.io", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
describe('Check actions', () => { | ||
// eslint-disable-next-line mocha/no-hooks-for-single-case | ||
beforeEach(() => { | ||
cy.clearLocalStorage(); | ||
cy.visit('/edit'); | ||
cy.contains('Actions').click(); | ||
}); | ||
it('should update markdown code', () => { | ||
cy.get('#markdown') | ||
.invoke('val') | ||
.then((oldText) => { | ||
cy.get('#editor').click('bottom').type('{enter}C --> HistoryTest'); | ||
cy.get('#markdown') | ||
.invoke('val') | ||
.then((newText) => { | ||
expect(oldText).to.not.eq(newText); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
describe('Auto sync tests', () => { | ||
beforeEach(() => { | ||
cy.clearLocalStorage(); | ||
cy.visit('/'); | ||
}); | ||
it('should dim diagram when code is edited', () => { | ||
cy.contains('Auto sync').click(); | ||
cy.get('#view').should('not.have.class', 'outOfSync'); | ||
cy.get('#editor').type(' C --> Test'); | ||
cy.get('#view').should('have.class', 'outOfSync'); | ||
cy.getLocalStorage('codeStore').snapshot(); | ||
}); | ||
|
||
it('should show/hide sync button with auto sync', () => { | ||
cy.get('[data-cy=sync]').should('not.exist'); | ||
cy.contains('Auto sync').click(); | ||
cy.get('[data-cy=sync]').should('exist'); | ||
cy.get('#autoSync').check(); | ||
cy.get('[data-cy=sync]').should('not.exist'); | ||
}); | ||
it('should not dim diagram when code is in sync', () => { | ||
cy.contains('Auto sync').click(); | ||
cy.get('#view').should('not.have.class', 'outOfSync'); | ||
cy.get('#editor').type(' C --> Test'); | ||
cy.get('#view').should('have.class', 'outOfSync'); | ||
cy.get('[data-cy=sync]').click(); | ||
cy.get('#view').should('not.have.class', 'outOfSync'); | ||
cy.get('#autoSync').check(); | ||
cy.get('#editor').type('ing'); | ||
cy.get('#view').should('not.have.class', 'outOfSync'); | ||
cy.getLocalStorage('codeStore').snapshot(); | ||
}); | ||
}); |
Oops, something went wrong.