Skip to content

Commit 52b4a36

Browse files
committed
rewrite to use nest-js-report
1 parent e4c6aaf commit 52b4a36

Some content is hidden

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

58 files changed

+327
-1041
lines changed

README.md

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
git clone https://github.com/moofoo/nestjs-jsreport-examples && cd nestjs-jsreport-examples && yarn && yarn start:dev
55
```
66

7-
This repo demonstrates what you can do with the core JSReport libraries programmatically in your own NodeJS apps. Neither JsReport's 'Template Studio', their SaaS offerings, or any other SaaS provider or external service is involved in creating these reports.
7+
This repo demonstrates what you can do with the core JSReport libraries programmatically in your own NodeJS apps.
88

9-
All templating and report generation is performed locally by the NestJS server, using the JSReport 'renderer core' and the necessary extensions.
9+
Neither JsReport's 'Template Studio', their SaaS offerings, or any other SaaS provider or external service is involved in creating these reports. All templating and report generation is performed locally by the NestJS server, using the JSReport 'renderer core' and the necessary extensions.
1010

11-
The NestJS implementation is a work in progress. If you check back in a week or so, chances are it will be completely different.
11+
The NestJS + JsReport integration is a work in progress. See [nest-js-report](https://github.com/moofoo/nest-js-report)
1212

1313
I replicated all of the JSReport "[showcase](https://jsreport.net/showcases/)" reports, except for the "PDF Stock Report". Additional reports were pulled from examples in the [JSReport Playground](https://playground.jsreport.net/).
1414

@@ -85,37 +85,7 @@ I replicated all of the JSReport "[showcase](https://jsreport.net/showcases/)" r
8585

8686
#
8787

88-
### [http://localhost:3333/reports/html-to-xlsx](http://localhost:3333/reports/html-to-xlsx)
88+
### [http://localhost:3333/reports/htmlxlsx](http://localhost:3333/reports/htmlxlsx)
8989

9090
- Html-to-Xlsx
9191
- [Playground Link](https://playground.jsreport.net/w/admin/h45L49Dp)
92-
93-
#
94-
95-
Most of these will generate a PDF (instead .docx or .xlsx) with the query `pdf=1` (i.e, http://localhost:3333/reports/invoice?pdf=1)
96-
97-
#
98-
99-
#
100-
101-
## Commentary
102-
103-
The goal here is not to present a complete, self-contained and ready to use JSReports module, though that will probably happen eventually.
104-
105-
Rather, I wanted to
106-
107-
- Verify that the JSReport core libraries function adequately outside their usual web-based GUI context, as advertised.
108-
109-
- Demonstrate the feasiblity and potential of integrating JsReport with NestJS, in code (you're looking at it)
110-
111-
- Hopefully illustrate how useful and fully-featured the JSReport library is on its own, separate from the Studio GUI, to anyone paying attention, because I think it's cool.
112-
113-
#
114-
115-
#### **RANT**
116-
117-
JSReport, as far as I'm aware, is the only business reports company whose code base, top to bottem, is all open source and free for anyone to use. More impressively, they have intentionally architected their application as a collection of loosely coupled functional parts (extensions) that can be repurposd, mixed and matched, to perform useful work outside of their original Web GUI, Studio context. That is, outside the context where they make money for JSReport, as a business. And to top it all off, the core functionality on offer here - templating and doc gen - is **superlative**. Endless kudos.
118-
119-
Software like this really deserves more attention and love, especially given how bizarrely expensive and frankly predatory so many SaaS services in the space are.
120-
121-
#### **/RANT**

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
"bwip-js": "^3.4.0",
3939
"handlebars": "^4.7.7",
4040
"lodash": "^4.17.21",
41+
"lodash.clonedeep": "^4.5.0",
4142
"moment": "^2.29.4",
43+
"nest-js-report": "https://github.com/moofoo/nest-js-report",
4244
"puppeteer": "^20.4.0",
4345
"reflect-metadata": "^0.1.13",
4446
"rxjs": "^7.8.1",
@@ -58,6 +60,7 @@
5860
"@types/jsreport-html-to-xlsx": "^2.0.3",
5961
"@types/jsreport-scripts": "^2.6.2",
6062
"@types/jsreport-xlsx": "^1.4.2",
63+
"@types/lodash.clonedeep": "^4.5.7",
6164
"@types/node": "20.2.3",
6265
"@types/supertest": "^2.0.12",
6366
"@typescript-eslint/eslint-plugin": "^5.59.7",

src/app.module.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
import { Module } from '@nestjs/common';
22
import { AppController } from './app.controller';
3-
import { JsReportModule } from './js-report/js-report.module';
3+
import { JsReportModule } from 'nest-js-report';
4+
import { ReportsModule } from './reports/reports.module';
45
@Module({
5-
imports: [JsReportModule],
6+
imports: [
7+
JsReportModule.forRoot({
8+
engines: ['handlebars'],
9+
recipes: ['docx', 'xlsx', 'html-to-xlsx', 'chrome-pdf'],
10+
extensions: ['unoconv', 'pdf-utils'],
11+
}),
12+
ReportsModule,
13+
],
614
controllers: [AppController],
715
})
816
export class AppModule {

src/js-report/helpers/asset.helper.ts

Lines changed: 0 additions & 121 deletions
This file was deleted.

src/js-report/helpers/template.helper.ts

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)