Skip to content

Commit a282120

Browse files
Merge pull request #12 from mig8447/main
doc: split quick-erd.md from README
2 parents 94829ed + cec8752 commit a282120

16 files changed

+10873
-579
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.DS_Store
22
node_modules
3-
dist
43
.env*
54
!.env*.example
65
build

.markdownlint.jsonc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/v0.27.0/schema/markdownlint-config-schema.json",
3+
"default": true,
4+
"MD007": {
5+
"indent": 4
6+
},
7+
"MD033": {
8+
"allowed_elements": [
9+
"details",
10+
"summary",
11+
"section",
12+
"img"
13+
]
14+
}
15+
}

.vscode/extensions.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"yzhang.markdown-all-in-one",
4+
"davidanson.vscode-markdownlint"
5+
]
6+
}

README.md

+24-218
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,35 @@
1-
# QuickSQL
1+
# Quick SQL <!-- omit in toc -->
22

3-
<!-- TOC -->
3+
## Table of Contents <!-- omit in toc -->
44

5-
- [QuickSQL](#quicksql)
6-
- [Overview](#overview)
7-
- [Installation](#installation)
8-
- [Building Locally](#building-locally)
9-
- [Running Tests](#running-tests)
10-
- [Running the Example CLI](#running-the-example-cli)
11-
- [Translating QSQL into Oracle SQL Data Definition Language (DDL)](#translating-qsql-into-oracle-sql-data-definition-language-ddl)
5+
- [Overview](#overview)
6+
- [Installation](#installation)
7+
- [Building Locally](#building-locally)
8+
- [Running Tests](#running-tests)
9+
- [Running the Example CLI](#running-the-example-cli)
10+
- [Translating Quick SQL into Oracle SQL Data Definition Language (DDL)](#translating-quick-sql-into-oracle-sql-data-definition-language-ddl)
1211
- [DDL NodeJS ECMA Script Module (ESM) Example](#ddl-nodejs-ecma-script-module-esm-example)
1312
- [DDL NodeJS Common JS (CJS) Example](#ddl-nodejs-common-js-cjs-example)
1413
- [DDL Browser ECMA Script Module (ESM) Example](#ddl-browser-ecma-script-module-esm-example)
1514
- [DDL Browser Universal Module Definition (UMD) Example](#ddl-browser-universal-module-definition-umd-example)
16-
- [Transforming Quick SQL into an Entity-Relationship Diagram (ERD)](#transforming-quick-sql-into-an-entity-relationship-diagram-erd)
17-
- [Prerequisites](#prerequisites)
18-
- [ERD Browser ESM Example](#erd-browser-esm-example)
19-
- [ERD Browser UMD Example](#erd-browser-umd-example)
20-
- [ERD Theming](#erd-theming)
21-
- [Contributing](#contributing)
22-
- [Security](#security)
23-
- [License](#license)
24-
25-
<!-- /TOC -->
26-
15+
- [Transforming Quick SQL into an Entity-Relationship Diagram (ERD)](#transforming-quick-sql-into-an-entity-relationship-diagram-erd)
16+
- [Contributing](#contributing)
17+
- [Security](#security)
18+
- [License](#license)
2719

2820
## Overview
2921

30-
Quick SQL (QSQL) is a markdown-like shorthand syntax that expands to standards-based
22+
Quick SQL is a markdown-like shorthand syntax that expands to standards-based
3123
Oracle SQL. It is useful to rapidly design and prototype data models. Take a
3224
look at the example below:
3325

3426
![Quick SQL](./assets/quick-sql-dark.png)
3527

3628
Previously, Quick SQL was only available within Oracle Application Express. This
37-
project reimplements the QSQL parser and translator into a JavaScript
29+
project reimplements the Quick SQL parser and translator into a JavaScript
3830
library which can be used in both NodeJS and the browser.
3931

40-
This repository also includes a QSQL to Entity Relationship Diagram
32+
This repository also includes a Quick SQL to Entity Relationship Diagram
4133
module that can be used as seen in the example below:
4234

4335
![Quick ERD](./assets/quick-erd-dark.png)
@@ -77,12 +69,12 @@ Once you have built the library, you can run the example CLI by executing:
7769
npm run example-cli -- ./test/department_employees.quicksql
7870
```
7971

80-
## Translating QSQL into Oracle SQL Data Definition Language (DDL)
72+
## Translating Quick SQL into Oracle SQL Data Definition Language (DDL)
8173

82-
The QSQL to DDL translator is the product's core component, It allows users
83-
to transform a QSQL string into an Oracle SQL string.
74+
The Quick SQL to DDL translator is the product's core component, It allows users
75+
to transform a Quick SQL string into an Oracle SQL string.
8476
85-
The Quick SQL Syntax is documented [here](./doc/quicksql.md)
77+
The Quick SQL Syntax and Grammar are documented [here](./doc/quick-sql-grammar.md)
8678
8779
See below for examples of how to use this library.
8880
@@ -168,203 +160,17 @@ view emp_v departments employees
168160
169161
## Transforming Quick SQL into an Entity-Relationship Diagram (ERD)
170162
171-
### Prerequisites
172-
173-
You need to add the following dependencies to your HTML:
174-
175-
- JointJS+ v3.5.0 (Requires a paid License). This requires the following
176-
dependencies (See the [JointJS+
177-
Documentation](https://resources.jointjs.com/docs/rappid/v3.5/index.html)):
178-
179-
- jQuery
180-
- lodash
181-
- Backbone JS
182-
183-
### ERD Browser ESM Example
184-
185-
<!-- markdownlint-disable MD013 -->
186-
```html
187-
<!DOCTYPE html>
188-
<html>
189-
<head>
190-
<meta charset="UTF-8">
191-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
192-
<title>Quick ERD</title>
193-
194-
<!-- Assuming you put the rappid.min.css file in this path -->
195-
<link rel="stylesheet" type="text/css" href="./examples/diagram-generator/libs/rappid.min.css">
196-
<link rel="stylesheet" href="./dist/quick-erd.css">
197-
198-
<style>
199-
html, body {
200-
height: 100%;
201-
margin: 0;
202-
}
203-
#quickERD {
204-
width: 100%;
205-
height: 100%;
206-
}
207-
</style>
208-
</head>
209-
<body>
210-
<div id="quickERD"></div>
211-
212-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
213-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js" integrity="sha256-qXBd/EfAdjOA2FGrGAG+b3YBn2tn5A6bhz+LSgYD96k=" crossorigin="anonymous"></script>
214-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/backbone-min.min.js"></script>
215-
216-
<!-- Assuming you put the rappid.min.js file in this path -->
217-
<script src="./examples/diagram-generator/libs/rappid.min.js"></script>
218-
219-
<script type="module">
220-
import { toERD } from './dist/quick-sql.js';
221-
import { Diagram } from './dist/quick-erd.js';
222-
223-
new Diagram( toERD(
224-
`
225-
departments
226-
name /nn
227-
location
228-
country
229-
employees
230-
departments_id /fk departments
231-
name /nn vc50
232-
email /lower
233-
cost center num
234-
date hired
235-
job vc255
236-
237-
view emp_v departments employees
238-
239-
# settings = { "prefix": null, "semantics": "CHAR", "DV": false }
240-
241-
`
242-
), '#quickERD' );
243-
</script>
244-
</body>
245-
</html>
246-
```
247-
<!-- markdownlint-enable MD013 -->
248-
249-
### ERD Browser UMD Example
250-
251-
<!-- markdownlint-disable MD013 -->
252-
```html
253-
<!DOCTYPE html>
254-
<html>
255-
<head>
256-
<meta charset="UTF-8">
257-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
258-
<title>Quick ERD</title>
259-
260-
<!-- Assuming you put the rappid.min.css file in this path -->
261-
<link rel="stylesheet" type="text/css" href="./examples/diagram-generator/libs/rappid.min.css">
262-
<link rel="stylesheet" href="./dist/quick-erd.css">
263-
264-
<style>
265-
html, body {
266-
height: 100%;
267-
margin: 0;
268-
}
269-
#quickERD {
270-
width: 100%;
271-
height: 100%;
272-
}
273-
</style>
274-
</head>
275-
<body>
276-
<div id="quickERD"></div>
277-
278-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
279-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js" integrity="sha256-qXBd/EfAdjOA2FGrGAG+b3YBn2tn5A6bhz+LSgYD96k=" crossorigin="anonymous"></script>
280-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/backbone-min.min.js"></script>
281-
282-
<!-- Assuming you put the rappid.min.js file in this path -->
283-
<script src="./examples/diagram-generator/libs/rappid.min.js"></script>
284-
285-
<script src="./dist/quick-sql.umd.cjs"></script>
286-
<script src="./dist/quick-erd.umd.cjs"></script>
287-
288-
<script>
289-
new quickERD.Diagram( quickSQL.toERD(
290-
`
291-
departments
292-
name /nn
293-
location
294-
country
295-
employees
296-
departments_id /fk departments
297-
name /nn vc50
298-
email /lower
299-
cost center num
300-
date hired
301-
job vc255
302-
303-
view emp_v departments employees
304-
305-
# settings = { "prefix": null, "semantics": "CHAR", "DV": false }
306-
307-
`
308-
), '#quickERD' );
309-
</script>
310-
</body>
311-
</html>
312-
```
313-
<!-- markdownlint-enable MD013 -->
314-
315-
### ERD Theming
316-
317-
By default, the diagram uses a neutral color scheme as per below:
318-
319-
![Quick ERD Example](./assets/quick-erd-example.png)
320-
321-
However, the diagram can be themed using CSS variables as shown in the example below:
322-
323-
```css
324-
/* Light Theme */
325-
:root {
326-
--qs-diagram-table-background-color: #FFF;
327-
--qs-diagram-font-family: var(--a-base-font-family, sans-serif);
328-
--qs-diagram-table-border-color: #f1efed;
329-
--qs-diagram-table-name-text-color: rgb(22 21 19);
330-
--qs-diagram-table-column-text-color: rgba(22, 21, 19, .9);
331-
--qs-diagram-table-data-type-text-color: rgba(22, 21, 19, .5);
332-
--qs-diagram-table-separator-color: #e7e3e1;
333-
}
334-
/* Dark Theme */
335-
@media (prefers-color-scheme: dark) {
336-
:root {
337-
--qs-diagram-table-background-color: #4a4541;
338-
--qs-diagram-font-family: var(--a-base-font-family, sans-serif);
339-
--qs-diagram-table-border-color: #55504c;
340-
--qs-diagram-table-text-color: #fcfbfa;
341-
--qs-diagram-table-name-text-color: white;
342-
--qs-diagram-table-column-text-color: rgb(255 255 255 / 90%);
343-
--qs-diagram-table-data-type-text-color: rgb(255 255 255 / 60%);
344-
--qs-diagram-table-separator-color: #55504c;
345-
}
346-
}
347-
```
348-
349-
Which would produce the following:
350-
351-
- Light Color Scheme
352-
353-
![Light Quick ERD Example](./assets/quick-erd-light-example.png)
354-
355-
- Dark Color Scheme
356-
357-
![Dark Quick ERD Example](./assets/quick-erd-dark-example.png)
358-
163+
Requires a paid library. Review the usage [here](./doc/quick-erd.md)
359164
360165
## Contributing
361166
362-
363-
This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)
167+
This project welcomes contributions from the community. Before submitting a pull
168+
request, please [review our contribution guide](./CONTRIBUTING.md)
364169
365170
## Security
366171
367-
Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process
172+
Please consult the [security guide](./SECURITY.md) for our responsible security
173+
vulnerability disclosure process
368174
369175
## License
370176

cspell.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
3+
"version": "0.2",
4+
"language": "en",
5+
"words": [
6+
"abnf",
7+
"CLOB",
8+
"createdbycol",
9+
"dname",
10+
"ename",
11+
"equijoin",
12+
"genpk",
13+
"LASTUPD",
14+
"longvc",
15+
"ondelete",
16+
"ORDS",
17+
"prefixpkwithtname",
18+
"qddl",
19+
"rappid",
20+
"rgba",
21+
"tenantid",
22+
"Tname",
23+
"tstz",
24+
"TSWLTZ",
25+
"TSWTZ",
26+
"updatedbycol"
27+
],
28+
"flagWords": [
29+
// cSpell:disable
30+
"wether",
31+
"heigth",
32+
"lenght"
33+
// cSpell:enable
34+
],
35+
"allowCompoundWords": true,
36+
"useGitignore": true,
37+
"validateDirectives": true
38+
}

dist/quick-erd.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)