Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
root = true

[*.{js,ts,json,md}]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
# editorconfig.org
root = true

Expand Down
22 changes: 22 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"root": true,
"env": {
"node": true,
"mocha": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parserOptions": {
"ecmaVersion": 2019,
"sourceType": "module"
},
"rules": {
"no-unused-vars": ["warn", { "args": "none" }],
"no-console": "off",
"import/no-unresolved": "off"
}
}
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Run '...'
3. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Environment (please complete the following information):**
- OS: [e.g. Windows 10]
- Node: [e.g. 18.x]

**Additional context**
Add any other context about the problem here.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.

## Unreleased

- Add CI workflow
- Add ESLint and EditorConfig
- Add CONTRIBUTING and issue template
- Add fast-test and ci-test scripts
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contributing

Thanks for your interest in contributing to node-sql-parser. A few guidelines:

- Fork the repo and open a branch for your change.
- Run tests locally with `npm test` and keep lint passing with `npm run lint`.
- Include unit tests for bug fixes and new features.
- Open a PR and reference an issue if applicable.

If you're new, check open issues labeled `good first issue`.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,22 @@ parser.whiteListCheck(sql, whiteColumnList, opt) // if check failed, an error wo

## :kissing_heart: Acknowledgement

## Developer quickstart

Run tests locally:

```bash
npm ci
npm test
```

For a faster local smoke-run during development:

```bash
npm run fast-test
```


This project is inspired by the SQL parser [flora-sql-parser](https://github.com/godmodelabs/flora-sql-parser) module.

## License
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
"main": "index.js",
"types": "types.d.ts",
"scripts": {
"start": "webpack --config webpack.config.js",
"build": "npm run lint && npm run compile && webpack --config webpack.config.js --mode production",
"test": "npm run lint && mochapack --reporter-option maxDiffSize=1000000 \"test/**/*.spec.js\"",
"lint": "eslint src",
"compile": "babel src -d lib",
"start": "webpack --config webpack.config.js",
"build": "npm run lint && npm run compile && webpack --config webpack.config.js --mode production",
"test": "npm run lint && mochapack --reporter-option maxDiffSize=1000000 \"test/**/*.spec.js\"",
"fast-test": "mocha \"test/**/*(select|insert|update|delete|util).spec.js\" --reporter spec",
"ci-test": "npm run lint && npm run fast-test",
"lint": "eslint src",
"compile": "babel src -d lib",
"coverLocal": "cross-env NODE_ENV=coverage nyc --reporter=lcov --reporter=text npm run test",
"cover:run": "cross-env NODE_ENV=coverage nyc --reporter=text-lcov npm run test",
"cover": "npm run cover:run && nyc report --reporter=text-lcov | coveralls",
Expand Down