now works as intended
This commit is contained in:
parent
8e3633827c
commit
7998c99f27
1
dist/smartscaf.classes.smartscaf.d.ts
vendored
1
dist/smartscaf.classes.smartscaf.d.ts
vendored
@ -25,6 +25,7 @@ export declare class ScafTemplate {
|
|||||||
* Will ask for the missing variables by cli interaction
|
* Will ask for the missing variables by cli interaction
|
||||||
*/
|
*/
|
||||||
askCliForMissingVariables(): Promise<void>;
|
askCliForMissingVariables(): Promise<void>;
|
||||||
|
writeToDisk(destinationDirArg: any): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* finds all variables in a Template in as string
|
* finds all variables in a Template in as string
|
||||||
* e.g. myobject.someKey and myobject.someOtherKey
|
* e.g. myobject.someKey and myobject.someOtherKey
|
||||||
|
13
dist/smartscaf.classes.smartscaf.js
vendored
13
dist/smartscaf.classes.smartscaf.js
vendored
@ -65,6 +65,17 @@ class ScafTemplate {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
writeToDisk(destinationDirArg) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let smartfileArrayToWrite = plugins.lodash.cloneDeep(this.templateSmartfileArray);
|
||||||
|
for (let smartfile of smartfileArrayToWrite) {
|
||||||
|
let template = yield plugins.smarthbs.getTemplateForString(smartfile.contents.toString());
|
||||||
|
let renderedTemplateString = template(this.suppliedVariables);
|
||||||
|
smartfile.contents = Buffer.from(renderedTemplateString);
|
||||||
|
}
|
||||||
|
yield plugins.smartfile.memory.smartfileArrayToFs(smartfileArrayToWrite, destinationDirArg);
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* finds all variables in a Template in as string
|
* finds all variables in a Template in as string
|
||||||
* e.g. myobject.someKey and myobject.someOtherKey
|
* e.g. myobject.someKey and myobject.someOtherKey
|
||||||
@ -121,4 +132,4 @@ class ScafTemplate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ScafTemplate = ScafTemplate;
|
exports.ScafTemplate = ScafTemplate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UQsaUJBQWlCLENBQUMsUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUN0QyxDQUFBO2dCQUNELElBQUksQ0FBQyxnQkFBZ0IsR0FBRyxhQUFhLENBQUE7WUFDdkMsQ0FBQztZQUFDLElBQUksQ0FBQyxDQUFDO2dCQUNOLElBQUksQ0FBQyxnQkFBZ0IsR0FBRyxFQUFFLENBQUE7WUFDNUIsQ0FBQztRQUNILENBQUM7S0FBQTtDQUNGO0FBM0hELG9DQTJIQyJ9
|
@ -28,8 +28,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/lodash": "^4.14.64",
|
"@types/lodash": "^4.14.64",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"smartfile": "^4.2.11",
|
"smartfile": "^4.2.12",
|
||||||
"smarthbs": "^1.0.12",
|
"smarthbs": "^1.0.15",
|
||||||
"smartinteract": "^1.0.4",
|
"smartinteract": "^1.0.4",
|
||||||
"smartq": "^1.1.1",
|
"smartq": "^1.1.1",
|
||||||
"smartyaml": "^1.0.2",
|
"smartyaml": "^1.0.2",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { expect, tap } from 'tapbundle'
|
import { expect, tap } from 'tapbundle'
|
||||||
|
import * as path from 'path'
|
||||||
|
|
||||||
import * as smartscaf from '../dist/index'
|
import * as smartscaf from '../dist/index'
|
||||||
|
|
||||||
@ -25,4 +26,8 @@ tap.test('ask cli', async () => {
|
|||||||
await testScafTemplate.askCliForMissingVariables()
|
await testScafTemplate.askCliForMissingVariables()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
tap.test('should output ready rendered template', async () => {
|
||||||
|
await testScafTemplate.writeToDisk(path.resolve('./test/test_output'))
|
||||||
|
})
|
||||||
|
|
||||||
tap.start()
|
tap.start()
|
||||||
|
2
test/test_output/defaults.yml
Normal file
2
test/test_output/defaults.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
templateVar1: from default yaml
|
||||||
|
templateVar2: this is another value from yml
|
3
test/test_output/template1.md
Normal file
3
test/test_output/template1.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# this is a from default yaml
|
||||||
|
# this is a this is another value from yml
|
||||||
|
# this is a undefined variable
|
3
test/test_output/template2.md
Normal file
3
test/test_output/template2.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# this is a from default yaml
|
||||||
|
# this is a this is another value from yml
|
||||||
|
# this is a undefined variable
|
1
test/test_output/template3.md
Normal file
1
test/test_output/template3.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# some undefined variable
|
@ -66,6 +66,18 @@ export class ScafTemplate {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async writeToDisk (destinationDirArg) {
|
||||||
|
let smartfileArrayToWrite = plugins.lodash.cloneDeep(this.templateSmartfileArray)
|
||||||
|
for (let smartfile of smartfileArrayToWrite) {
|
||||||
|
let template = await plugins.smarthbs.getTemplateForString(
|
||||||
|
smartfile.contents.toString()
|
||||||
|
)
|
||||||
|
let renderedTemplateString = template(this.suppliedVariables)
|
||||||
|
smartfile.contents = Buffer.from(renderedTemplateString)
|
||||||
|
}
|
||||||
|
await plugins.smartfile.memory.smartfileArrayToFs(smartfileArrayToWrite, destinationDirArg)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* finds all variables in a Template in as string
|
* finds all variables in a Template in as string
|
||||||
* e.g. myobject.someKey and myobject.someOtherKey
|
* e.g. myobject.someKey and myobject.someOtherKey
|
||||||
|
12
yarn.lock
12
yarn.lock
@ -827,9 +827,9 @@ smartenv@^2.0.0:
|
|||||||
smartq "^1.1.1"
|
smartq "^1.1.1"
|
||||||
typings-global "^1.0.14"
|
typings-global "^1.0.14"
|
||||||
|
|
||||||
smartfile@^4.2.11:
|
smartfile@^4.2.11, smartfile@^4.2.12:
|
||||||
version "4.2.11"
|
version "4.2.12"
|
||||||
resolved "https://registry.yarnpkg.com/smartfile/-/smartfile-4.2.11.tgz#20bb3a1411722688135499520de2fd00985becdb"
|
resolved "https://registry.yarnpkg.com/smartfile/-/smartfile-4.2.12.tgz#6acda7f2e7626b7c81280f35f97334a1d856d176"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/fs-extra" "3.x.x"
|
"@types/fs-extra" "3.x.x"
|
||||||
"@types/vinyl" "^2.0.0"
|
"@types/vinyl" "^2.0.0"
|
||||||
@ -844,9 +844,9 @@ smartfile@^4.2.11:
|
|||||||
vinyl "^2.0.2"
|
vinyl "^2.0.2"
|
||||||
vinyl-file "^3.0.0"
|
vinyl-file "^3.0.0"
|
||||||
|
|
||||||
smarthbs@^1.0.12:
|
smarthbs@^1.0.15:
|
||||||
version "1.0.14"
|
version "1.0.15"
|
||||||
resolved "https://registry.yarnpkg.com/smarthbs/-/smarthbs-1.0.14.tgz#448a3f30d8c674dcc060ff8941f23c54c1e3af08"
|
resolved "https://registry.yarnpkg.com/smarthbs/-/smarthbs-1.0.15.tgz#f7c68fbc90f4a03625b52e97cb242dc62bc72359"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/handlebars" "^4.0.32"
|
"@types/handlebars" "^4.0.32"
|
||||||
"@types/lodash" "^4.14.64"
|
"@types/lodash" "^4.14.64"
|
||||||
|
Loading…
Reference in New Issue
Block a user