update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 18:04:25 +02:00
parent 46a70d55c5
commit 48989c17c7
4 changed files with 144 additions and 30 deletions

View File

@ -5,17 +5,28 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartntml",
"description": "lit-html for the backend",
"description": "Provides lit-html rendering capabilities for backend applications.",
"npmPackagename": "@push.rocks/smartntml",
"license": "MIT",
"projectDomain": "push.rocks"
"projectDomain": "push.rocks",
"keywords": [
"backend rendering",
"lit-html",
"template rendering",
"server-side rendering",
"html template",
"web components",
"happy-dom",
"indexeddb",
"typescript"
]
}
},
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"tsdocs": {
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartntml",
"version": "2.0.4",
"private": false,
"description": "lit-html for the backend",
"description": "Provides lit-html rendering capabilities for backend applications.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
@ -42,5 +42,16 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"keywords": [
"backend rendering",
"lit-html",
"template rendering",
"server-side rendering",
"html template",
"web components",
"happy-dom",
"indexeddb",
"typescript"
]
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

143
readme.md
View File

@ -1,37 +1,128 @@
# @pushrocks/smartntml
# @push.rocks/smartntml
lit-html for the backend
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartntml)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartntml)
* [github.com (source mirror)](https://github.com/pushrocks/smartntml)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartntml/)
## Install
## Status for master
To install `@push.rocks/smartntml`, you need Node.js and npm installed on your machine. If you have them ready, open your terminal and run the following command:
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartntml/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartntml/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartntml)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartntml)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartntml)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartntml)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartntml)](https://lossless.cloud)
```bash
npm install @push.rocks/smartntml --save
```
This will add `@push.rocks/smartntml` as a dependency to your project and you're ready to use lit-html in your backend applications.
## Usage
Use TypeScript for best in class intellisense
The core idea behind `@push.rocks/smartntml` is to bring the convenience and developer experience of `lit-html` to server-side rendering. This package leverages the power of `lit-html`'s syntax and data-binding capabilities in a Node.js environment, especially focusing on backend applications that require rendering HTML.
## Contribution
To start using `@push.rocks/smartntml`, you need to familiarize yourself with TypeScript and ESM syntax, as this module is designed to offer the best experience within this ecosystem.
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
### Setting Up Your Project with TypeScript and ESM
For further information read the linked docs at the top of this readme.
First and foremost, ensure your project is set up to use TypeScript and ECMAScript Modules (ESM). Your `tsconfig.json` should have the following settings:
## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
```json
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
}
}
```
### Basic Usage
`@push.rocks/smartntml` simplifies the process of creating and rendering templates. The following example demonstrates how to create a template and render it:
1. **Import the necessary modules**
First, import `Smartntml` and any other module you wish to use:
```typescript
import { Smartntml, deesElement } from '@push.rocks/smartntml';
```
`deesElement` is leveraged for its `TemplateResult` type and `html` tag function, allowing us to define our templates with ease.
2. **Create an instance of Smartntml**
```typescript
const smartNTML = new Smartntml();
```
3. **Define a Template**
You can define a template using the `html` function provided by `deesElement`. This function allows you to embed dynamic content in a concise and readable manner.
```typescript
const myTemplate = deesElement.html`
<div>Welcome to Smartntml!</div>
`;
```
4. **Render the Template**
With a template defined, you can render it to a string. This string can then be sent as a response to a client in a web application or stored for later use.
```typescript
async function renderMyTemplate() {
const renderedString = await smartNTML.renderTemplateResult(myTemplate);
console.log(renderedString);
}
renderMyTemplate();
```
### Working with Dynamic Content
`@push.rocks/smartntml` excels in rendering dynamic content. Assume you have an array of items that you want to display in a list:
```typescript
const items = ['Apple', 'Banana', 'Cherry'];
const listTemplate = deesElement.html`
<ul>
${items.map(item => deesElement.html`<li>${item}</li>`)}
</ul>
`;
```
You can dynamically render arrays or any functional JavaScript within your templates, making it incredibly powerful for generating dynamic HTML content.
### Advanced Usage
`@push.rocks/smartntml` can also integrate with other backend services and capabilities. For instance, using it alongside your server-side logic to render user-specific data, handling form submissions, or creating email templates.
**Note:** Always sanitize any user input before rendering it with `smartntml` to prevent XSS (Cross-Site Scripting) attacks.
### Support and Contribution
`@push.rocks/smartntml` is an open-source project and welcomes contributions from the community. Whether it's improving the documentation, adding new features, or reporting bugs, every contribution helps make `smartntml` better for everyone.
Before contributing to the project, make sure to discuss your ideas or issues on the repository's issue tracker. This ensures that your contributions align with the project's goals and don't overlap with existing efforts.
### Final Thoughts
`@push.rocks/smartntml` provides a streamlined and efficient way to use `lit-html`-like syntax for server-rendered templates in Node.js applications. It offers a blend of simplicity and power, enabling developers to create dynamic, data-driven HTML content on the backend with minimal effort. By integrating `@push.rocks/smartntml` into your project, you embrace modern JavaScript practices and significantly enhance your server-side rendering capabilities.
For more detailed usage examples and advanced features, make sure to check out the official documentation and explore the `@push.rocks/smartntml` codebase. Happy coding!
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.