Skip to content

Commit 0a01d6e

Browse files
committed
Rewrite project in TypeScript
1 parent e8a2c74 commit 0a01d6e

File tree

295 files changed

+67535
-3179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

295 files changed

+67535
-3179
lines changed

.babelrc

-11
This file was deleted.

.editorconfig

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
end_of_line = lf
6+
insert_final_newline = true
7+
8+
[*.json]
9+
indent_style = space
10+
indent_size = 4
11+
12+
[*.md]
13+
indent_style = space
14+
indent_size = 4
15+
16+
[{*.yaml,*.yml}]
17+
indent_style = space
18+
indent_size = 4
19+
20+
[package.json]
21+
indent_style = space
22+
indent_size = 2

.eslintignore

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
.nyc_output
2-
coverage
3-
node_modules
1+
.nyc_output/
2+
build/
3+
coverage/
4+
docs/
5+
lib/
6+
node_modules/
7+
types/

.eslintrc

-15
This file was deleted.

.eslintrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
root: true,
3+
extends: [
4+
'mitmaro',
5+
'mitmaro/config/typescript',
6+
],
7+
rules: {
8+
'no-unused-vars': 'off',
9+
}
10+
};

.gitignore

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
lib
2-
node_modules
3-
.nyc_output
4-
coverage
5-
test/Runtime/fixtures/access-denied.tpl
1+
.nyc_output/
2+
node_modules/
3+
build/
4+
coverage/
5+
lib/
6+
types/
7+
test/fixtures/access-denied.tpl

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8

.nycrc

+6-8
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,20 @@
44
"functions": 100,
55
"branches": 100,
66
"include": [
7-
"src/**/*.js"
7+
"src/**/*.ts"
88
],
99
"exclude": [
10+
"*.d.ts"
1011
],
12+
"extension": [".ts"],
1113
"reporter": [
1214
"json",
15+
"text",
1316
"text-summary",
1417
"html"
1518
],
16-
"all": true,
1719
"check-coverage": true,
18-
"produce-source-map": true,
1920
"report-dir": "./coverage",
20-
"require": [
21-
"babel-register"
22-
],
23-
"sourceMap": false,
24-
"instrument": false
21+
"sourceMap": true,
22+
"instrument": true
2523
}

README.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# SQL Template Engine
2+
3+
[![Service Status](https://david-dm.org/MitMaro/node-sql-template-engine.svg)](https://david-dm.org/MitMaro/node-sql-template-engine)
4+
[![Build Status](https://travis-ci.org/MitMaro/node-sql-template-engine.svg?branch=master)](https://travis-ci.org/MitMaro/node-sql-template-engine)
5+
[![Coverage Status](https://coveralls.io/repos/github/MitMaro/node-sql-template-engine/badge.svg?branch=master)](https://coveralls.io/github/MitMaro/node-sql-template-engine?branch=master)
6+
[![NPM version](https://img.shields.io/npm/v/@mitmaro/sql-template-engine.svg)](https://www.npmjs.com/package/@mitmaro/sql-template-engine)
7+
[![GitHub license](https://img.shields.io/badge/license-ISC-blue.svg)](https://raw.githubusercontent.com/MitMaro/node-sql-template-engine/master/LICENSE.md)
8+
[![Known Vulnerabilities](https://snyk.io/test/github/mitmaro/node-sql-template-engine/badge.svg?targetFile=package.json)](https://snyk.io/test/github/mitmaro/node-sql-template-engine?targetFile=package.json)
9+
10+
## Install
11+
12+
npm install --save @mitmaro/sql-template-engine
13+
14+
## Documentation
15+
16+
* [API Documentation][documentation]
17+
18+
## Usage
19+
20+
### Creating an instance
21+
22+
Creating a SQL Template Engine instance is very straight forward.
23+
24+
#### JavaScript
25+
```javascript
26+
const sqlTemplateEngine = require('@mitmaro/sql-template-engine');
27+
const serviceManager = sqlTemplateEngine({
28+
// options
29+
});
30+
```
31+
32+
#### TypeScript
33+
```typescript
34+
import sqlTemplateEngine from '@mitmaro/sql-template-engine';
35+
const serviceManager = sqlTemplateEngine({
36+
// options
37+
});
38+
```
39+
40+
#### Options
41+
42+
|Name |Type |Description |Default |
43+
|-----------------|--------------------------|----------------------------------------------------------------|--------------------------|
44+
|cache |`AbstractSyntaxTreeCache` |A custom abstract syntax tree cache |Memory |
45+
|epsilon |`number` |The allowed error due to rounding in floating point comparisons |`Number.EPSILON` |
46+
|fileEncoding |`string` |The file encoding for template files |UTF-8 |
47+
|rootPath |`string` |The root directory for looking for template files |Current working directory |
48+
|maximumCallDepth |`number` |The maximum depth of nested includes |64 |
49+
50+
### Invoking a template file
51+
52+
```javascript
53+
const result = await serviceManager.invokeTemplateFile('template.tpl', {foo: 'bar'});
54+
```
55+
56+
## Development
57+
58+
Development is done using Node 8 and NPM 5, and tested against both Node 8 and Node 10. To get started
59+
60+
* Install Node 8 from [NodeJS.org][node] or using [nvm]
61+
* Clone the repository using `git clone [email protected]:MitMaro/node-sql-template-engine.git`
62+
* `cd node-sql-template-engine`
63+
* Install the dependencies `npm install`
64+
* Make changes, add tests, etc.
65+
* Run linting and test suite using `npm run test`
66+
* Build using `npm run build`
67+
68+
## License
69+
70+
This project is released under the ISC license. See [LICENSE](LICENSE.md).
71+
72+
73+
[documentation]: http://www.mitmaro.ca/node-service-manager/
74+
[LICENSE]:LICENSE
75+
[node]:https://nodejs.org/en/download/
76+
[nvm]:https://github.com/creationix/nvm#installation

0 commit comments

Comments
 (0)