Skip to content

Commit

Permalink
Merge pull request #19 from mig8447/prepare-for-npm-package-publishing
Browse files Browse the repository at this point in the history
fix: prepare package for publishing
  • Loading branch information
vadim-tropashko authored Oct 31, 2023
2 parents e42dc20 + a44ff7d commit 64683fd
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 55 deletions.
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,41 @@ git commit --signoff
Only pull requests from committers that can be verified as having signed the OCA
can be accepted.

## Getting Started

1. Open a terminal window
2. Clone the repository
3. Change into the cloned repository directory
4. Install dependencies by running

```bash
npm install
```

## Building Locally

Once you have set up the project, you can build the library by executing:

```bash
npm run build
```

## Running Tests

Once you have set up the project, you can run the test suite by executing:

```bash
npm run test
```

## Running the Example CLI

Once you have built the library, you can run the example CLI by executing:

```bash
npm run example-cli -- ./test/department_employees.quicksql
```

## Pull request process

1. Ensure there is an issue created to track and discuss the fix or enhancement
Expand Down
50 changes: 9 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
## Table of Contents <!-- omit in toc -->

- [Overview](#overview)
- [Installation](#installation)
- [Building Locally](#building-locally)
- [Running Tests](#running-tests)
- [Running the Example CLI](#running-the-example-cli)
- [Install](#install)
- [Translating Quick SQL into Oracle SQL Data Definition Language (DDL)](#translating-quick-sql-into-oracle-sql-data-definition-language-ddl)
- [DDL NodeJS ECMA Script Module (ESM) Example](#ddl-nodejs-ecma-script-module-esm-example)
- [DDL NodeJS Common JS (CJS) Example](#ddl-nodejs-common-js-cjs-example)
Expand Down Expand Up @@ -36,39 +33,10 @@ module that can be used as seen in the example below:

![Quick ERD](./assets/quick-erd-dark.png)

## Installation

1. Open a terminal window
2. Clone the repository
3. Change into the cloned repository directory
4. Install dependencies by running

```bash
npm install
```

## Building Locally

Once you have set up the project, you can build the library by executing:
## Install

```bash
npm run build
```

## Running Tests

Once you have set up the project, you can run the test suite by executing:

```bash
npm run test
```

## Running the Example CLI

Once you have built the library, you can run the example CLI by executing:

```bash
npm run example-cli -- ./test/department_employees.quicksql
npm install @oracle/quicksql
```

## Translating Quick SQL into Oracle SQL Data Definition Language (DDL)
Expand All @@ -83,12 +51,12 @@ See below for examples of how to use this library.
### DDL NodeJS ECMA Script Module (ESM) Example

```js
import quickSQL from "./dist/quick-sql.js";
import { toDDL } from "@oracle/quicksql";
import fs from "fs";

try {
const text = fs.readFileSync( './test/department_employees.quicksql' );
console.log( quickSQL.toDDL( text.toString() ) );
console.log( toDDL( text.toString() ) );
} catch( e ) {
console.error( e );
};
Expand All @@ -97,12 +65,12 @@ try {
### DDL NodeJS Common JS (CJS) Example

```js
const quickSQL = require( "./dist/quick-sql.umd.cjs" );
const { toDDL } = require( "@oracle/quicksql" );
const fs = require( "fs" );

try {
const text = fs.readFileSync( './test/department_employees.quicksql' );
console.log( quickSQL.toDDL( text.toString() ) );
console.log( toDDL( text.toString() ) );
} catch( e ) {
console.error( e );
};
Expand All @@ -112,8 +80,8 @@ try {

```html
<script type="module">
import quickSQL from './dist/quick-sql.js';
document.body.innerText = quickSQL.toDDL(
import { toDDL } from './dist/quick-sql.js';
document.body.innerText = toDDL(
`departments /insert 2
name /nn
location
Expand Down
2 changes: 1 addition & 1 deletion dist/quick-erd.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ class de {
e.rearrangeDiagram(3, !1), this.paperScroller.centerContent();
}
}
const ue = "1.1.3", fe = {
const ue = "1.1.4", fe = {
Diagram: de,
version: ue
};
Expand Down
2 changes: 1 addition & 1 deletion dist/quick-erd.umd.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/quick-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -8992,7 +8992,7 @@ const Y = {
};
return Object.defineProperty(D, "version", {
writable: !1,
value: "1.1.3"
value: "1.1.4"
}), D;
}(), be = X.toDDL, pe = X.toERD, ge = X.toQSQL, Ce = X.errors, ve = X.version;
export {
Expand Down
2 changes: 1 addition & 1 deletion dist/quick-sql.umd.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,4 @@ dv `+D+"_dv "+D,A+=`
Non-default options:
# settings = `+JSON.stringify(this.nonDefaultOptions())+`
`,S+=`
*/`,this.appliedOptions=JSON.parse(JSON.stringify(this.options)),this.resetOptions(),S},this.errors=function(y,p){this.toDDL(y,p),this.options=JSON.parse(JSON.stringify(this.appliedOptions));const S=be.findErrors(this,y);return this.appliedOptions=JSON.parse(JSON.stringify(this.options)),this.resetOptions(),S},this.toQSQL=function(y){const p=JSON.parse(y);return me.introspect(null,p,0)},this.descendants=function(){for(var y=[],p=0;p<this.forest.length;p++)y=y.concat(this.forest[p].descendants());return y},this.additionalColumns=function(){var y=[],p=this.getOptionValue("Auxiliary Columns");if(p==null)return y;for(var S=p.split(","),T=0;T<S.length;T++){var A=S[T].trim(),k="VARCHAR2(4000)",b=A.indexOf(" ");0<b&&(k=A.substring(b+1).toUpperCase(),A=A.substring(0,b)),y[A]=k}return y},this.objPrefix=function(y){var p=this.getOptionValue("schema");p==null&&(p=""),p!=""&&y==null?p=p+".":p="";var S="";return this.getOptionValue("prefix")!=null&&(S=this.getOptionValue("prefix")),p=p+S,S!=""&&(p=p+"_"),p.toLowerCase()}}const f=new m;let D={toDDL:f.toDDL.bind(f),toERD:f.toERD.bind(f),toQSQL:f.toQSQL.bind(f),errorMsgs:f.errors.bind(f)};return Object.defineProperty(D,"version",{writable:!1,value:"1.1.3"}),D}(),pe=X.toDDL,ge=X.toERD,Ce=X.toQSQL,ve=X.errors,Ae=X.version;K.default=X,K.errors=ve,K.toDDL=pe,K.toERD=ge,K.toQSQL=Ce,K.version=Ae,Object.defineProperties(K,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
*/`,this.appliedOptions=JSON.parse(JSON.stringify(this.options)),this.resetOptions(),S},this.errors=function(y,p){this.toDDL(y,p),this.options=JSON.parse(JSON.stringify(this.appliedOptions));const S=be.findErrors(this,y);return this.appliedOptions=JSON.parse(JSON.stringify(this.options)),this.resetOptions(),S},this.toQSQL=function(y){const p=JSON.parse(y);return me.introspect(null,p,0)},this.descendants=function(){for(var y=[],p=0;p<this.forest.length;p++)y=y.concat(this.forest[p].descendants());return y},this.additionalColumns=function(){var y=[],p=this.getOptionValue("Auxiliary Columns");if(p==null)return y;for(var S=p.split(","),T=0;T<S.length;T++){var A=S[T].trim(),k="VARCHAR2(4000)",b=A.indexOf(" ");0<b&&(k=A.substring(b+1).toUpperCase(),A=A.substring(0,b)),y[A]=k}return y},this.objPrefix=function(y){var p=this.getOptionValue("schema");p==null&&(p=""),p!=""&&y==null?p=p+".":p="";var S="";return this.getOptionValue("prefix")!=null&&(S=this.getOptionValue("prefix")),p=p+S,S!=""&&(p=p+"_"),p.toLowerCase()}}const f=new m;let D={toDDL:f.toDDL.bind(f),toERD:f.toERD.bind(f),toQSQL:f.toQSQL.bind(f),errorMsgs:f.errors.bind(f)};return Object.defineProperty(D,"version",{writable:!1,value:"1.1.4"}),D}(),pe=X.toDDL,ge=X.toERD,Ce=X.toQSQL,ve=X.errors,Ae=X.version;K.default=X,K.errors=ve,K.toDDL=pe,K.toERD=ge,K.toQSQL=Ce,K.version=Ae,Object.defineProperties(K,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
6 changes: 3 additions & 3 deletions examples/cli.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env node

/**
* Reads QuickSQL input from a file in the filesystem and outputs the translated
* Reads Quick SQL input from a file in the filesystem and outputs the generated
* DDL to console
*
* Execution:
*
* ```sh
* ./translate.js <FILE_PATH>
* ./cli.js <FILE_PATH>
* ```
*/

Expand All @@ -18,7 +18,7 @@ import quicksql from '../dist/quick-sql.js';
function print_usage() {
console.log(
/* eslint-disable indent */
`QuickSQL ${ quicksql.version } Translation Example
`Quick SQL ${ quicksql.version } DDL Generation Example
Usage: ./cli.js <FILE_PATH>
Example: ./cli.js ../test/project_management.quicksql
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 20 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
{
"name": "@oracle/quicksql",
"version": "1.1.3",
"version": "1.1.4",
"description": "Quick SQL to DDL and ERD translator",
"main": "src/index.js",
"main": "./dist/quick-sql.umd.cjs",
"module": "./dist/quick-sql.js",
"type": "module",
"exports": {
".": {
"import": "./dist/quick-sql.js",
"require": "./dist/quick-sql.umd.cjs"
},
"./erd": {
"import": "./dist/quick-erd.js",
"require": "./dist/quick-erd.umd.cjs"
}
},
"engines": {
"node": ">=14"
"node": ">=16"
},
"config": {
"ddlLibraryName": "quickSQL",
Expand All @@ -21,7 +32,7 @@
"test": "./test/regression_test.js",
"lint:markdown": "markdownlint-cli2 *.md, doc/**/*.md",
"lint": "run-p lint:*",
"example-cli": "./examples/cli.js ./test/project_management.quicksql",
"example-cli": "./examples/cli.js",
"postversion": "run-s build"
},
"repository": {
Expand All @@ -37,12 +48,16 @@
"Diagram"
],
"files": [
"src/*.js"
"assets",
"!(CONTRIBUTING).md",
"doc/user",
"dist"
],
"license": "UPL-1.0",
"dependencies": {
"chance": "^1.1.11"
},
"bundledDependencies": true,
"devDependencies": {
"eslint": "^8.42.0",
"markdownlint-cli2": "^0.10.0",
Expand Down

0 comments on commit 64683fd

Please sign in to comment.