From cfbc4b6b37d0c0251aeb1e0f994263b3a2408332 Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 15 Apr 2021 22:05:08 +0200 Subject: [PATCH 1/2] Templates relative path --- ROADMAP.md | 6 ++++-- lib/services/compiler.service.js | 14 +++++++------- src/services/compiler.service.ts | 14 +++++++------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 0351793..53b9ca6 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,9 +1,11 @@ # Roadmap -- [ ] **v1.0.1** +- [ ] **v1.0.3** - [ ] Headers images - [ ] Integration HTML/CSS for all transactions. Factored code. 4 colours - + - [ ] Export views in lib + - [ ] Check meta.to validation + - [ ] **v1.1.0** - [ ] Check / sanitize payloads - [ ] Support inlines images diff --git a/lib/services/compiler.service.js b/lib/services/compiler.service.js index accac4c..076c184 100644 --- a/lib/services/compiler.service.js +++ b/lib/services/compiler.service.js @@ -14,15 +14,15 @@ class Compiler { /** * @description */ - this.LAYOUT = '/src/views/layouts/default.hbs'; + this.LAYOUT = '/../../src/views/layouts/default.hbs'; /** * @description */ - this.PARTIALS = '/src/views/partials/'; + this.PARTIALS = '/../../src/views/partials'; /** * @description */ - this.BLOCKS = '/src/views/blocks/'; + this.BLOCKS = '/../../src/views/blocks'; /** * @description */ @@ -101,10 +101,10 @@ class Compiler { }); } data.banner = this.getBanner(event); - Hbs.handlebars.registerPartial('header', Hbs.handlebars.compile(fs_1.readFileSync(`${process.cwd()}${this.PARTIALS}/header.hbs`, { encoding: 'utf-8' }))(container_service_1.Container.configuration.consumer)); - Hbs.handlebars.registerPartial('body', Hbs.handlebars.compile(fs_1.readFileSync(`${process.cwd()}${this.BLOCKS}/${this.getSegment(event)}.hbs`, { encoding: 'utf-8' }))(data)); - Hbs.handlebars.registerPartial('footer', Hbs.handlebars.compile(fs_1.readFileSync(`${process.cwd()}${this.PARTIALS}/footer.hbs`, { encoding: 'utf-8' }))(container_service_1.Container.configuration.consumer)); - const html = Hbs.handlebars.compile(fs_1.readFileSync(`${process.cwd()}${this.LAYOUT}`, { encoding: 'utf-8' }))(data); + Hbs.handlebars.registerPartial('header', Hbs.handlebars.compile(fs_1.readFileSync(`${__dirname}${this.PARTIALS}/header.hbs`, { encoding: 'utf-8' }))(container_service_1.Container.configuration.consumer)); + Hbs.handlebars.registerPartial('body', Hbs.handlebars.compile(fs_1.readFileSync(`${__dirname}${this.BLOCKS}/${this.getSegment(event)}.hbs`, { encoding: 'utf-8' }))(data)); + Hbs.handlebars.registerPartial('footer', Hbs.handlebars.compile(fs_1.readFileSync(`${__dirname}${this.PARTIALS}/footer.hbs`, { encoding: 'utf-8' }))(container_service_1.Container.configuration.consumer)); + const html = Hbs.handlebars.compile(fs_1.readFileSync(`${__dirname}${this.LAYOUT}`, { encoding: 'utf-8' }))(data); return { text: this.textify(html), html: this.customize(html) diff --git a/src/services/compiler.service.ts b/src/services/compiler.service.ts index 00613e2..cf4ae8e 100644 --- a/src/services/compiler.service.ts +++ b/src/services/compiler.service.ts @@ -20,17 +20,17 @@ class Compiler { /** * @description */ - private readonly LAYOUT: string = '/src/views/layouts/default.hbs'; + private readonly LAYOUT: string = '/../../src/views/layouts/default.hbs'; /** * @description */ - private readonly PARTIALS: string = '/src/views/partials/'; + private readonly PARTIALS: string = '/../../src/views/partials'; /** * @description */ - private readonly BLOCKS: string = '/src/views/blocks/'; + private readonly BLOCKS: string = '/../../src/views/blocks'; /** * @description @@ -119,11 +119,11 @@ class Compiler { data.banner = this.getBanner(event); - Hbs.handlebars.registerPartial('header', Hbs.handlebars.compile( readFileSync(`${process.cwd()}${this.PARTIALS}/header.hbs`, { encoding: 'utf-8' } ))(Container.configuration.consumer)) - Hbs.handlebars.registerPartial('body', Hbs.handlebars.compile( readFileSync(`${process.cwd()}${this.BLOCKS}/${this.getSegment(event)}.hbs`, { encoding: 'utf-8' } ))(data)) - Hbs.handlebars.registerPartial('footer', Hbs.handlebars.compile( readFileSync(`${process.cwd()}${this.PARTIALS}/footer.hbs`, { encoding: 'utf-8' } ))(Container.configuration.consumer)) + Hbs.handlebars.registerPartial('header', Hbs.handlebars.compile( readFileSync(`${__dirname}${this.PARTIALS}/header.hbs`, { encoding: 'utf-8' } ))(Container.configuration.consumer)) + Hbs.handlebars.registerPartial('body', Hbs.handlebars.compile( readFileSync(`${__dirname}${this.BLOCKS}/${this.getSegment(event)}.hbs`, { encoding: 'utf-8' } ))(data)) + Hbs.handlebars.registerPartial('footer', Hbs.handlebars.compile( readFileSync(`${__dirname}${this.PARTIALS}/footer.hbs`, { encoding: 'utf-8' } ))(Container.configuration.consumer)) - const html = Hbs.handlebars.compile( readFileSync(`${process.cwd()}${this.LAYOUT}`, { encoding: 'utf-8' } ) )(data); + const html = Hbs.handlebars.compile( readFileSync(`${__dirname}${this.LAYOUT}`, { encoding: 'utf-8' } ) )(data); return { text: this.textify(html), From 30593757f5f4042c19b8e7e8dd784f47a54fc946 Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 15 Apr 2021 22:07:02 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 9 ++++++++- package.json | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3dd196..1cd3240 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -## [v1.0.1](https://github.com/konfer-be/cliam/compare/v1.0.0...v1.0.1) +## [v1.0.2](https://github.com/konfer-be/cliam/compare/v1.0.1...v1.0.2) + +### Commits + +- Templates relative path [`cfbc4b6`](https://github.com/konfer-be/cliam/commit/cfbc4b6b37d0c0251aeb1e0f994263b3a2408332) + +## [v1.0.1](https://github.com/konfer-be/cliam/compare/v1.0.0...v1.0.1) - 2021-04-15 ### Commits - Remove typescript paths [`a917877`](https://github.com/konfer-be/cliam/commit/a917877435d28b59f61181cb2c93009589c71844) - Update NPM dependencies [`f488bda`](https://github.com/konfer-be/cliam/commit/f488bda78965c51801d895b2c3adfe1eb091746a) +- Update changelog [`4a0dfbb`](https://github.com/konfer-be/cliam/commit/4a0dfbb9a8cacedd1a8dfdd1285fb60321ee66f2) ## v1.0.0 - 2021-04-15 diff --git a/package.json b/package.json index 0ad1972..b3fe656 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cliam", - "version": "1.0.1", + "version": "1.0.2", "engines": { "node": ">=14.16" },