Compare commits

..

57 Commits
1.2.0 ... main

Author SHA1 Message Date
8d532d08b5 1.3.3 2022-11-25 22:23:23 +01:00
66a989b154
Merge pull request #25 from lucaspalomodevelop/fix/renderFile
fixing rendering file wothout template-path
2022-11-25 22:16:32 +01:00
f97e535877 fixing rendering file wothout template-path 2022-11-25 20:10:30 +01:00
99934228da change npm-publish.yml 2022-11-24 16:31:18 +01:00
85a51d9003 change package-version 2022-11-23 20:21:45 +01:00
1c681f06fc add npm install 2022-11-23 20:13:58 +01:00
a61ff94799
Merge pull request #24 from lucaspalomodevelop/dev
change npm-publish.yml
2022-11-23 20:02:54 +01:00
1275514b3f change npm-publish.yml 2022-11-23 20:00:12 +01:00
4dcd9ff32f
Create npm-publish.yml 2022-11-23 19:50:03 +01:00
7aceb84bcc
Merge pull request #23 from lucaspalomodevelop/cmd
change readme.md
2022-11-22 17:51:45 +01:00
91ebab68d1 Merge branch 'dev' into cmd 2022-11-22 17:48:54 +01:00
ea79d7915c change readme.md 2022-11-22 17:48:10 +01:00
6d54150ca2
Merge pull request #22 from lucaspalomodevelop/dev
Dev
2022-11-21 19:41:35 +01:00
a60fe69c77 Merge branch 'cmd' into dev 2022-11-21 14:00:10 +01:00
7778fbd1fe add cli.js 2022-11-21 13:59:30 +01:00
63f84f72d2
Merge pull request #21 from lucaspalomodevelop/cmd
Cmd
2022-11-20 19:34:42 +01:00
a4e0e11b79 Merge branch 'cmd' of github.com:lucaspalomodevelop/JSSTE into cmd 2022-11-20 19:29:07 +01:00
99234c865c rename cmd in cli 2022-11-20 19:28:47 +01:00
21c704eaff add jsste as cli tool 2022-11-20 19:27:34 +01:00
240e2fa60c
Merge pull request #20 from lucaspalomodevelop/dev
Dev
2022-11-20 03:36:23 +01:00
f1f5ce44bc
Merge pull request #19 from lucaspalomodevelop/main
Merge pull request #17 from lucaspalomodevelop/cmd
2022-11-20 03:33:56 +01:00
af2da3ec80
Merge pull request #18 from lucaspalomodevelop/main
Merge pull request #17 from lucaspalomodevelop/cmd
2022-11-20 03:32:51 +01:00
d5d1b23546 add commandline params to readme 2022-11-20 03:30:24 +01:00
69d86e44f3
Merge pull request #17 from lucaspalomodevelop/cmd
Cmd
2022-11-19 17:42:31 +01:00
1e6645d90a comment cmd 2022-11-19 00:06:15 +01:00
0a81571827 prettify 2022-11-18 22:18:36 +01:00
1c221ef048 add -info to cmd 2022-11-18 22:09:29 +01:00
4daba83eeb added direct code input in cmd 2022-11-18 21:43:31 +01:00
ac53995608 add jsste_info to cmd 2022-11-18 20:53:08 +01:00
1bddfdd4fd modify cmd | add templatefile to renderFile 2022-11-18 19:05:05 +01:00
60e26ffb37 add log mode in cmd 2022-11-18 16:58:42 +01:00
91ae19c049
Merge pull request #16 from lucaspalomodevelop/15-add-config-manipulation-in-cmd
add jsconfig
2022-11-18 16:50:30 +01:00
479feb029c add jsconfig 2022-11-18 16:49:20 +01:00
6294fe702c
Merge pull request #14 from lucaspalomodevelop/13-cmd-js
add cmd.js
2022-11-18 16:43:36 +01:00
794d6b5550 add cmd.js 2022-11-18 16:37:10 +01:00
908058bce6
Merge pull request #12 from lucaspalomodevelop/dependabot/npm_and_yarn/nanoid-and-mocha-3.3.3
Bump nanoid and mocha
2022-11-03 19:45:34 +01:00
dependabot[bot]
3552a43714
Bump nanoid and mocha
Bumps [nanoid](https://github.com/ai/nanoid) to 3.3.3 and updates ancestor dependency [mocha](https://github.com/mochajs/mocha). These dependencies need to be updated together.


Updates `nanoid` from 3.1.20 to 3.3.3
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.1.20...3.3.3)

Updates `mocha` from 8.4.0 to 10.1.0
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v8.4.0...v10.1.0)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
- dependency-name: mocha
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-03 18:43:20 +00:00
445d669815
Merge pull request #11 from lucaspalomodevelop/dependabot/npm_and_yarn/glob-parent-5.1.2
Bump glob-parent from 3.1.0 to 5.1.2
2022-11-03 19:42:29 +01:00
dependabot[bot]
df2fd6a888
Bump glob-parent from 3.1.0 to 5.1.2
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 3.1.0 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-03 18:40:14 +00:00
71bfe7a22e new version 1.2.3 2022-11-03 19:29:11 +01:00
496ad727f2 fix state 2022-11-03 19:27:13 +01:00
477570b4e5 version 1.2.2 2022-11-03 18:58:44 +01:00
6cdef37326
Merge pull request #10 from lucaspalomodevelop/refactoring
Refactoring
2022-11-03 18:56:25 +01:00
347e83f7f6 add StateFunction to README 2022-10-31 18:05:31 +01:00
dab7c7e78e add State-Codes to README 2022-10-31 17:59:52 +01:00
6e371c15f0 add comments 2022-10-31 15:53:48 +01:00
da12e94818 removing uncomment code 2022-10-31 13:44:50 +01:00
36225ac7e8
Merge pull request #8 from lucaspalomodevelop/7-remove-typechecker
remove checker dependecy
2022-10-31 13:37:02 +01:00
96d4b4ee12 remove typechecker from engine.js 2022-10-31 13:33:40 +01:00
828667c3f3 remove checker dependecy 2022-10-31 13:24:22 +01:00
9f131a1702 add states in index.js 2022-10-31 12:58:45 +01:00
71e3e44e3d add more states 2022-10-31 12:33:35 +01:00
c20047b95c remove console.log's 2022-10-31 12:09:48 +01:00
8e3b25722b add Statefunctionality 2022-10-30 18:12:47 +01:00
4fd34232a2 remove dependencies and tsc script 2022-10-29 19:14:38 +02:00
f4636b3946 change package.json 2022-10-28 17:38:16 +02:00
9d20956804 add examples-repo to readme.md 2022-10-28 16:44:20 +02:00
16 changed files with 1283 additions and 13030 deletions

37
.github/workflows/npm-publish.yml vendored Normal file
View File

@ -0,0 +1,37 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Node.js Package
on:
# push:
# tags:
# - "*"
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npm install
- run: npm test
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
testfiles
planning
.vscode
built

View File

@ -72,6 +72,58 @@ let result = Jsste.render(pagecode, templatecode);
- `_TEMPLATE_` -> Defines the path to the temp file
- `_STYLES_` -> Defines a list of CSS files that will be implemented
### Include States
You can include an Callbackfunction that will be called when the state is change
```javascript
jsste.setStateFunction(({ status, statusMSG }) => {
yourstatus = status;
yourstatusMSG = statusMSG;
});
```
### States-Codes
| Code | Meaning |
| :--- | :-----: |
| 0 | OK |
| 1 | ERROR |
| 2 | WARNING |
| 3 | INFO |
| 4 | DEBUG |
## Commandline
## Installation
```sh
npm install jsste -g
```
or
```sh
yarn install jsste -g
```
## excuting
```sh
jsste <argument>
```
| arguemnt | description | Example |
| :--------- | :--------------------------------------: | :-----: |
| -log | show jsste log | |
| -Jsconfig= | set jsste config as json | |
| -pageFile= | set pageFile path | |
| -page= | set pageFile as json | |
| -tempFile= | set tempFile path | |
| -temp= | set pageFile as code | |
| -info | show jsste.info | |
| -out | write rendered code into the commandling | |
#### Example
```javascript
@ -105,3 +157,5 @@ let result = Jsste.render(pagecode, templatecode);
// </html>
```
#### Examples on [https://github.com/lucaspalomodevelop/JSSTE-Examples](https://github.com/lucaspalomodevelop/JSSTE-Examples)

9859
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,14 @@
{
"name": "jsste",
"version": "1.1.3",
"description": "A Javascript Static Template Emgine",
"version": "1.3.3",
"description": "A Javascript Static Template Engine",
"main": "src/index.js",
"directories": {
"test": "test"
},
"bin": {
"jsste": "./src/cli.js"
},
"files": [
"src",
"package.json",
@ -15,7 +18,7 @@
"scripts": {
"test": "mocha ./test/test.test.js",
"publish": "npm publish --access publish",
"compile": "tsc"
"cmd": "node ./src/cli.js"
},
"repository": {
"type": "git",
@ -23,30 +26,21 @@
},
"keywords": [
"engine",
"templateengine"
"templateengine",
"jsste"
],
"author": "lucas palomo",
"author": "Lucas Palomo Lauterbach",
"license": "GPL",
"bugs": {
"url": "https://github.com/lucaspalomodevelop/JSSTE/issues"
},
"homepage": "https://github.com/lucaspalomodevelop/JSSTE#readme",
"dependencies": {
"typechecker": "^7.18.0",
"yarn": "^1.22.19"
},
"dependencies": {},
"engines": {
"node": ">= 0.10.0"
},
"devDependencies": {
"assert": "^2.0.0",
"chai": "^4.3.4",
"express": "^4.17.1",
"gulp": "^4.0.2",
"gulp-minify": "^3.1.0",
"gulp-typescript": "^6.0.0-alpha.1",
"mocha": "^8.4.0",
"typescript": "^4.5.4",
"urldecode": "^1.0.1"
"mocha": "^10.1.0"
}
}

99
src/cli.js Normal file
View File

@ -0,0 +1,99 @@
#!/usr/bin/env node
let jsste = require("./index");
let myargs = process.argv.slice(2);
let output = "";
let pagefile, tempfile;
let path = require("path");
let fs = require("fs");
var currentPath = process.cwd();
jsste.__config.set("templatePath",currentPath)
jsste.__config.set("pagePath",currentPath)
/**
* this function filters the prefix and call the callback with the param
* @param {prefix, args } settings
* @param {*} callback
*/
let addCommand = ({ prefix, args = myargs }, callback) => {
myargs.forEach((elem) => {
if (elem.startsWith(prefix)) {
elem = elem.replace(prefix, "");
callback(elem);
}
});
};
/**
* -log | show jsste log
*/
addCommand({ prefix: "-log" }, (arg) => {
jsste.setStateFunction((state) => {
console.log(state);
});
});
/**
* -Jsconfig | set jsste config as json
*/
addCommand({ prefix: "-Jsconfig=" }, (arg) => {
jsste.__config.setConfig(arg);
});
/**
* -pageFile | set pageFile path
*/
addCommand({ prefix: "-pageFile=" }, (arg) => {
jsste.setState({ status: 4, statusMSG: currentPath })
pagefile = JSON.parse(fs.readFileSync(path.join(currentPath, arg), "utf8"));
pagefile["_SELFPATH_"] = path.dirname(arg);
});
/**
* -pageFile | set pageFile as json
*/
addCommand({ prefix: "-page=" }, (arg) => {
pagefile = JSON.parse(arg);
pagefile["_SELFPATH_"] = path.dirname(arg);
});
/**
* -tempFile | set tempFile path
*/
addCommand({ prefix: "-tempFile=" }, (arg) => {
tempfile = fs.readFileSync(arg, "utf8");
});
/**
* -pageFile | set pageFile as code
*/
addCommand({ prefix: "-temp=" }, (arg) => {
tempfile = arg;
});
/**
* rendering
*/
output = jsste.render(pagefile || undefined, tempfile || undefined);
/**
* -info | show jsste.info
*/
addCommand({ prefix: "-info" }, (arg) => {
if (arg == "?json") {
console.log(JSON.stringify(jsste.info));
} else {
Object.keys(jsste.info).forEach((key) => {
console.log(key + " : " + jsste.info[key]);
});
}
});
/**
* -out | write rendered code into the commandling
*/
addCommand({ prefix: "-out" }, (arg) => {
console.log(output);
});

View File

@ -6,14 +6,27 @@ let configvar = {
stylesheets: __dirname + "\\src\\styles",
};
/**
* get config var by key
* @param {*} key
* @returns
*/
config.get = function (key) {
return configvar[key];
};
/**
* get full config
* @returns
*/
config.getConfig = function () {
return configvar;
};
/**
* set full config
* @param {*} param0
*/
config.setConfig = function ({
templatePath,
pagePath,
@ -26,6 +39,11 @@ config.setConfig = function ({
configvar.stylesheets = stylesheets;
};
/**
* set config via key
* @param {*} key
* @param {*} value
*/
config.set = function (key, value) {
configvar[key] = value;
};

View File

@ -1,22 +1,38 @@
const fs = require("fs");
const checker = require("typechecker");
const path = require("path");
const jsonmerger = require("./jsonMerger");
//let appdir = path.join(__dirname, "..");
let app = {};
app.__config = require("./config");
app.config = app.__config.getConfig();
//function to escape regex
/**
* function to escape regex
* @param {*} string
* @returns
*/
function escapeRegExp(string) {
return string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
}
/**
* replace all placeholder in a string
* @param {*} str
* @param {*} find
* @param {*} replace
* @returns
*/
function replaceAll(str, find, replace) {
return str.replace(new RegExp(escapeRegExp(find), "g"), replace);
}
/**
* function to handle consts
* @param {*} pagecode
* @param {*} constant
* @param {*} callback
* @returns
*/
app.CONST = function (pagecode, constant, callback) {
if (pagecode[constant] !== undefined) {
callback(pagecode, pagecode[constant]);
@ -25,30 +41,55 @@ app.CONST = function (pagecode, constant, callback) {
}
};
/**
* renders Pagecode in Templatecode
* @param {*} pagecode
* @param {*} templatecode
* @returns
*/
app.render = function (pagecode, templatecode) {
//let result = "";
//if (!pagecode == JSON) pagecode = JSON.parse(pagecode);
app.setState({ status: 0, statusMSG: "Render Page" });
if (
(pagecode != null || pagecode != undefined) &&
checker.isString(pagecode)
typeof pagecode === "string"
) {
pagecode = JSON.parse(pagecode);
app.setState({ status: 0, statusMSG: "Parse Pagecode" });
} else {
if (typeof pagecode === "object") {
app.setState({ status: 0, statusMSG: "Pagecode is an object" });
} else {
app.setState({ status: 1, statusMSG: "Pagecode is undefined" });
}
}
//TODO
if (!templatecode) {
try {
app.setState({ status: 0, statusMSG: "Load Templatecode" });
app.setState({
status: 4,
statusMSG: path.join(
app.config.templatePath,
pagecode["_TEMPLATE_"] + ".tjsste"
),
});
templatecode = fs.readFileSync(
path.join(app.config.templatePath, pagecode["_TEMPLATE_"] + ".tjsste"),
"utf-8"
);
} catch (error) {
app.setState({ status: 1, statusMSG: "Cant load Templatecode" });
return 404;
}
}
/**
* Dissolve Fileimports
* @param {*} _pagecode
* @param {*} imports
*/
let DissolveImports = function (_pagecode, imports) {
app.setState({ status: 0, statusMSG: "Dissolve Imports" });
let ImportSet = new Set();
let recursive = function (importNames) {
@ -57,11 +98,10 @@ app.render = function (pagecode, templatecode) {
let importPath = importName.startsWith(".")
? path.join(_pagecode["_SELFPATH_"].toString(), importName.toString())
: path.join(app.config.pagePath, importName);
console.log(importPath);
console.log(_pagecode);
try {
importCodeString = fs.readFileSync(importPath, "utf-8");
} catch (error) {
app.setState({ status: 1, statusMSG: "Import File Failed" });
return "Ups... Import File Failed";
}
@ -75,12 +115,11 @@ app.render = function (pagecode, templatecode) {
recursive(imports);
//console.log(ImportSet);
let currentPagecode = _pagecode;
ImportSet.forEach(function (importPath) {
console.log(importPath);
app.setState({ status: 0, statusMSG: "Import Importfiles" });
let importCodeString = fs.readFileSync(importPath, "utf-8");
let importCode = JSON.parse(importCodeString);
currentPagecode = jsonmerger.mergeJson(currentPagecode, importCode);
@ -88,10 +127,12 @@ app.render = function (pagecode, templatecode) {
pagecode = currentPagecode;
};
//TODO Killed Root Import
// Handle _IMPORTS_ const
app.CONST(pagecode, "_IMPORTS_", DissolveImports);
//console.log(pagecode);
// Handle _STYLES_ const
app.CONST(pagecode, "_STYLES_", (pagecode, value) => {
app.setState({ status: 0, statusMSG: "Import Styles" });
let rex = /<head>(.|\n|\t|\r)*?<\/head>/;
let header = templatecode.match(rex);
header = header[0].replace("</head>", "");
@ -100,23 +141,28 @@ app.render = function (pagecode, templatecode) {
});
header += "\n</head>";
// console.log(header);
templatecode = templatecode.replace(/<head>(.|\n|\t|\r)*?<\/head>/, header);
// replaceAll(templatecode,rex,value)
});
app.setState({ status: 0, statusMSG: "Set vars" });
for (let i in pagecode) {
app.setState({ status: 0, statusMSG: "Set " + pagecode[i] });
let value = undefined;
if (new RegExp(/\d*_([A-Z]*|[a-z])\w*_/g).test(i)) continue;
if (new RegExp(/\/\//g).test(i)) continue;
if (new RegExp(/js\$([A-Z]*|[a-z]*)\w+/g).test(i)) {
app.setState({ status: 0, statusMSG: "Execute Serverside Script" });
let SE = require("./scriptExecuter");
pagecode[i] = SE(pagecode[i]);
}
value = pagecode[i].toString();
templatecode = replaceAll(templatecode, "<[" + i + "]>", value);
}
app.setState({ status: 0, statusMSG: "Delete unused Placeholder" });
templatecode = templatecode.replace(
new RegExp(/<\[([A-Z]*|[a-z]*)\w*\]>/g),
""
@ -129,6 +175,7 @@ app.render = function (pagecode, templatecode) {
templatecode = templatecode.replace(new RegExp(/<\[\/\/]\>/g), "");
app.setState({ status: 0, statusMSG: "Return HTML" });
return templatecode;
};

View File

@ -6,45 +6,57 @@ var app = {};
app.render = engine.render;
app.CONST = engine.CONST;
app.renderFile = (filePath) => {
let pj = require("../package.json");
app.info = {};
app.info["version"] = pj.version;
app.info["license"] = pj.license;
/**
* Render File
* @param {*} filePath
* @returns
*/
app.renderFile = (filePath, templatePath) => {
app.setState({ status: 0, statusMSG: "read file" });
let file = fs.readFileSync(filePath, "utf8");
app.setState({ status: 0, statusMSG: "parse file" });
file = JSON.parse(file);
app.setState({ status: 0, statusMSG: "set Selfpath" });
file["_SELFPATH_"] = path.dirname(filePath);
return engine.render(file);
if (!(templatePath == undefined)) {
app.setState({ status: 0, statusMSG: "read template" });
let temp = fs.readFileSync(templatePath, "utf8");
return engine.render(file, temp);
} else {
return engine.render(file);
}
};
// engine.config = app.config;
/**
* set State
* @param {*} param0
*/
app.setState = ({ status, statusMSG }) => {
if (app.stateCallback != undefined) {
app.stateCallback({ status, statusMSG });
}
};
/**
* Set function that would called by new state
* @param {*} callback
*/
app.setStateFunction = function (callback) {
app.stateCallback = callback;
app.setState({ status: 0, statusMSG: "set Statefunction" });
app.setState({ status: 0, statusMSG: "JSSTE is ready" });
};
app.__config = require("./config");
app.config = app.__config.getConfig();
engine.config = app.config;
// app.expressEngine = (
// config = {
// templatePath: "templates",
// pagePath: "pages",
// }
// ) => {
// config = mergeJson.mergeJson(app.config, config);
// let hasrendered = false;
// return (filePath, options, callback) => {
// if (!hasrendered) {
// app.config.templatePath = path.join(
// options.settings.views,
// config.templatePath
// );
// app.config.pagePath = path.join(options.settings.views, config.pagePath);
// hasrendered = true;
// }
// // define the template engine
// fs.readFile(filePath, function (err, content) {
// content = content.toString();
// // content = mergeJson.mergeJson(JSON.parse(content), options);
// if (err) return callback(new Error(err));
// // this is an extremely simple template engine
// var rendered = app.render(content);
// return callback(null, rendered);
// });
// };
// };
engine.log = app.log;
engine.setState = app.setState;
module.exports = app;

View File

@ -1,12 +1,15 @@
const checker = require("typechecker");
/**
* merge two JSONs
* @param {*} org
* @param {*} ext
* @returns
*/
function mergeJson(org, ext) {
// let placeholder = undefined;
if (!checker.isObject(org)) {
if (!(typeof org === 'object' && org !== null)) {
org = JSON.parse(org);
}
if (!checker.isObject(ext)) {
if (!(typeof ext === 'object' && ext !== null)) {
ext = JSON.parse(ext);
}
@ -30,6 +33,12 @@ function mergeJson(org, ext) {
return org;
}
/**
* Merge multiple JSONs
* @param {*} org
* @param {...any} ext
* @returns
*/
function mergeJsons(org, ...ext) {
ext.forEach((element) => {
org = mergeJson(org, element);

View File

@ -1,5 +1,18 @@
/**
* that functions defines functions to use it in JSSTE JS var (js$varname)
*/
function Added() {
let outString = "";
//[jsste_info]
function jsste_info()
{
let jssteinfo = jsste_input_file
result = `\tINFOS\n\t${Object.keys(jssteinfo).map((key) => key + " : " + jssteinfo[key] ).join("\n\t") }`
return result;
}
function out(arg) {
outString += arg;
@ -8,11 +21,13 @@ function Added() {
function outLine(arg) {
outString += "\n" + arg;
}
}
/**
* exectue JSSTE JS var (js$varname)
* @param {*} script
* @returns
*/
function exec(script) {
let result = undefined;
@ -21,6 +36,8 @@ function exec(script) {
script
);
script = script.replace("//[jsste_info]",`let jsste_input_file = ${JSON.stringify(require("./index").info)}`),
script += "\n return outString;";
try {

View File

@ -1,9 +1,11 @@
let core_render = require("./core.render.test");
let core_scriptexec = require("./scriptexec.jsste.test");
let core_includeJSSTE = require("./includeJSSTE.test");
let core_state = require("./core.state.test");
function test() {
describe("JSSTE CORE", function () {
core_state();
core_render();
core_scriptexec();
core_includeJSSTE();

View File

@ -38,27 +38,27 @@ function test() {
result.should.equal("EXAMPLEEXAMPLE");
});
it.skip("blub", function () {
let result = JSSTE_Engine.render(
{
js$test: `out('<h1>'+ Date.now().toString() + '</h1>')`,
test: "hallo",
js$test2: `test2`,
_STYLES_: ["./test/style"],
},
`<html>
<head>
<title><[test]></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<[js$test2]>
</body>
</html>`
);
console.log(result);
});
// it.only("blub", function () {
// let result = JSSTE_Engine.render(
// {
// js$test: `out('<h1>'+ Date.now().toString() + '</h1>')`,
// test: "hallo",
// js$test2: ` retrun "test2"`,
// _STYLES_: ["./test/style"],
// },
// `<html>
// <head>
// <title><[test]></title>
// <meta charset="UTF-8">
// <meta name="viewport" content="width=device-width, initial-scale=1.0">
// </head>
// <body>
// <[js$test2]>
// </body>
// </html>`
// );
// console.log(result);
// });
it("should not rendern _VAR_", function () {
let template = "<[_VAR_]>";

17
test/core.state.test.js Normal file
View File

@ -0,0 +1,17 @@
let libfolder = "../src/";
let JSSTE_Engine = require(libfolder);
const { assert } = require("chai");
function test() {
describe("test State", function () {
it(" set stateFunction", function () {
JSSTE_Engine.setStateFunction(({ status, statusMSG }) => {});
assert.typeOf(JSSTE_Engine.setStateFunction, "function");
});
it(" is setState a function", function () {
assert.typeOf(JSSTE_Engine.setState,"function")
});
});
}
module.exports = test;

View File

@ -1,4 +1,5 @@
require("chai").should();
const {assert} = require("chai");
let test_jsonMerger = require("./jsonMerger.test");
let test_core = require("./core.jsste.test");

3952
yarn.lock

File diff suppressed because it is too large Load Diff