@carbonorm/carbonnode 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -6,13 +6,19 @@
|
|
|
6
6
|

|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
# CarbonNode
|
|
9
|
+
# CarbonNode (Alpha Release)
|
|
10
10
|
|
|
11
11
|
CarbonNode is a part of the CarbonORM series. It is a NodeJS MySQL ORM that is designed to work with CarbonPHP. This langauge
|
|
12
12
|
will implement the same ORM as CarbonPHP, but will be written in Typescript. Currently only C6 enabled request can be sent
|
|
13
13
|
using the bindings. Receiving API requests and handling it appropriately is not yet implemented. This is scheduled for
|
|
14
14
|
early 2023. This repository is in the early stages of development an any support is greatly appreciated.
|
|
15
15
|
|
|
16
|
+
## Alpha Release
|
|
17
|
+
|
|
18
|
+
This is an alpha release. The code is not yet ready for production. We are looking for feedback on the API and any bugs.
|
|
19
|
+
Some features are not yet implemented. We are working on the documentation and will be adding more examples. Please
|
|
20
|
+
check out [any issue](https://github.com/CarbonORM/CarbonWordPress/issues) we have open and feel free to contribute.
|
|
21
|
+
|
|
16
22
|
## Installation
|
|
17
23
|
|
|
18
24
|
CarbonNode is available on [NPM](https://www.npmjs.com/). You'll need to have [NodeJS](https://nodejs.org/en/) installed
|
|
@@ -55,9 +61,9 @@ database consisting of your GET PUT POST and DELETE methods and a Jest test file
|
|
|
55
61
|
table information and TypeScript types, and finally a websocket file which contains references to methods that are
|
|
56
62
|
generate. Here are the templates used to generate the code:
|
|
57
63
|
|
|
58
|
-
1) [C6.
|
|
59
|
-
2) [Table.
|
|
60
|
-
3) [Websocket.
|
|
64
|
+
1) [C6.ts.handlebars](https://github.com/CarbonORM/CarbonNode/blob/main/scripts/assets/handlebars/C6.ts.handlebars)
|
|
65
|
+
2) [Table.ts.handlebars](https://github.com/CarbonORM/CarbonNode/blob/main/scripts/assets/handlebars/Table.ts.handlebars)
|
|
66
|
+
3) [Websocket.ts.handlebars](https://github.com/CarbonORM/CarbonNode/blob/main/scripts/assets/handlebars/WsLiveUpdates.ts.handlebars)
|
|
61
67
|
|
|
62
68
|
|
|
63
69
|
# Support and Issues
|
package/package.json
CHANGED
|
@@ -290,15 +290,15 @@ var tableData = parseSQLToTypeScript(sql);
|
|
|
290
290
|
// write to file
|
|
291
291
|
fs.writeFileSync(path.join(process.cwd(), 'C6MySqlDump.json'), JSON.stringify(tableData));
|
|
292
292
|
// import this file src/assets/handlebars/C6.tsx.handlebars for a mustache template
|
|
293
|
-
var c6Template = fs.readFileSync(path.resolve(__dirname, 'assets/handlebars/C6.
|
|
294
|
-
fs.writeFileSync(path.join(MySQLDump.OUTPUT_DIR, 'C6.
|
|
295
|
-
var wsLiveUpdatesTemplate = fs.readFileSync(path.resolve(__dirname, 'assets/handlebars/WsLiveUpdates.
|
|
296
|
-
fs.writeFileSync(path.join(MySQLDump.OUTPUT_DIR, 'WsLiveUpdates.
|
|
297
|
-
var template = fs.readFileSync(path.resolve(__dirname, 'assets/handlebars/Table.
|
|
298
|
-
var testTemplate = fs.readFileSync(path.resolve(__dirname, 'assets/handlebars/Table.test.
|
|
293
|
+
var c6Template = fs.readFileSync(path.resolve(__dirname, 'assets/handlebars/C6.ts.handlebars'), 'utf-8');
|
|
294
|
+
fs.writeFileSync(path.join(MySQLDump.OUTPUT_DIR, 'C6.ts'), Handlebars.compile(c6Template)(tableData));
|
|
295
|
+
var wsLiveUpdatesTemplate = fs.readFileSync(path.resolve(__dirname, 'assets/handlebars/WsLiveUpdates.ts.handlebars'), 'utf-8');
|
|
296
|
+
fs.writeFileSync(path.join(MySQLDump.OUTPUT_DIR, 'WsLiveUpdates.ts'), Handlebars.compile(wsLiveUpdatesTemplate)(tableData));
|
|
297
|
+
var template = fs.readFileSync(path.resolve(__dirname, 'assets/handlebars/Table.ts.handlebars'), 'utf-8');
|
|
298
|
+
var testTemplate = fs.readFileSync(path.resolve(__dirname, 'assets/handlebars/Table.test.ts.handlebars'), 'utf-8');
|
|
299
299
|
Object.values(tableData.TABLES).map(function (tableData, key) {
|
|
300
300
|
var tableName = tableData.TABLE_NAME_SHORT_PASCAL_CASE;
|
|
301
|
-
fs.writeFileSync(path.join(MySQLDump.OUTPUT_DIR, tableName + '.
|
|
302
|
-
fs.writeFileSync(path.join(MySQLDump.OUTPUT_DIR, tableName + '.test.
|
|
301
|
+
fs.writeFileSync(path.join(MySQLDump.OUTPUT_DIR, tableName + '.ts'), Handlebars.compile(template)(tableData));
|
|
302
|
+
fs.writeFileSync(path.join(MySQLDump.OUTPUT_DIR, tableName + '.test.ts'), Handlebars.compile(testTemplate)(tableData));
|
|
303
303
|
});
|
|
304
304
|
console.log('Successfully created CarbonORM bindings!');
|
|
@@ -377,9 +377,7 @@ const tableData = parseSQLToTypeScript(sql);
|
|
|
377
377
|
// write to file
|
|
378
378
|
fs.writeFileSync(path.join(process.cwd(), 'C6MySqlDump.json'), JSON.stringify(tableData));
|
|
379
379
|
|
|
380
|
-
|
|
381
380
|
// import this file src/assets/handlebars/C6.tsx.handlebars for a mustache template
|
|
382
|
-
|
|
383
381
|
const c6Template = fs.readFileSync(path.resolve(__dirname, 'assets/handlebars/C6.ts.handlebars'), 'utf-8');
|
|
384
382
|
|
|
385
383
|
fs.writeFileSync(path.join(MySQLDump.OUTPUT_DIR, 'C6.ts'), Handlebars.compile(c6Template)(tableData));
|
|
@@ -403,4 +401,3 @@ Object.values(tableData.TABLES).map((tableData, key) => {
|
|
|
403
401
|
})
|
|
404
402
|
|
|
405
403
|
console.log('Successfully created CarbonORM bindings!')
|
|
406
|
-
|