update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 18:06:20 +02:00
parent 851d8e075b
commit 7745d63184
4 changed files with 97 additions and 37 deletions

View File

@ -12,12 +12,22 @@
"githost": "code.foss.global", "githost": "code.foss.global",
"gitscope": "push.rocks", "gitscope": "push.rocks",
"gitrepo": "smartopen", "gitrepo": "smartopen",
"description": "open things", "description": "A library for opening URLs or files in the default application",
"npmPackagename": "@push.rocks/smartopen", "npmPackagename": "@push.rocks/smartopen",
"license": "MIT" "license": "MIT",
"keywords": [
"URL opening",
"file handling",
"cross-platform",
"typescript",
"node.js",
"web development",
"automation",
"external resources"
]
} }
}, },
"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" "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

@ -1,7 +1,7 @@
{ {
"name": "@push.rocks/smartopen", "name": "@push.rocks/smartopen",
"version": "2.0.0", "version": "2.0.0",
"description": "open things", "description": "A library for opening URLs or files in the default application",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"type": "module", "type": "module",
@ -14,7 +14,14 @@
"url": "git+ssh://git@gitlab.com/pushrocks/smartopen.git" "url": "git+ssh://git@gitlab.com/pushrocks/smartopen.git"
}, },
"keywords": [ "keywords": [
"open" "URL opening",
"file handling",
"cross-platform",
"typescript",
"node.js",
"web development",
"automation",
"external resources"
], ],
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

106
readme.md
View File

@ -1,48 +1,90 @@
# @pushrocks/smartopen # @push.rocks/smartopen
open things open things
## Availabililty and Links ## Install
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartopen)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartopen)
* [github.com (source mirror)](https://github.com/pushrocks/smartopen)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartopen/)
## Status for master To start using `@push.rocks/smartopen`, you'll first need to install it using npm. In your terminal, navigate to your project directory and run:
Status Category | Status Badge ```bash
-- | -- npm install @push.rocks/smartopen --save
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartopen/badges/master/pipeline.svg)](https://lossless.cloud) ```
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartopen/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartopen)](https://lossless.cloud) This command will add `@push.rocks/smartopen` as a dependency to your project, allowing you to use it in your TypeScript applications.
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartopen)](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/smartopen)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartopen)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartopen)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage
Use TypeScript for best in class instellisense. ### Getting Started with SmartOpen
`@push.rocks/smartopen` provides an easy way to programmatically open URLs using Node.js. This can be particularly useful in desktop applications or server-side scripts where you want to trigger opening a web page in the default browser. Below, you'll find comprehensive examples to get you started.
Before diving into the examples, ensure you have TypeScript setup in your project. TypeScript provides strong types for JavaScript, which enhances development through type checking and better tooling support.
### Basic Usage
Here is the simplest way to open a URL:
```typescript ```typescript
import * as smartopen from '@pushrocks/smartopen'; import { openUrl } from '@push.rocks/smartopen';
const run = async () => {
await smartopen.openUrl('https://lossless.com'); async function openWebPage() {
}; await openUrl('https://example.com');
run(); }
openWebPage().then(() => {
console.log('Web page opened successfully');
}).catch((error) => {
console.error('Failed to open web page:', error);
});
``` ```
This function imports the `openUrl` method from `@push.rocks/smartopen` and executes it with a URL string. It opens the provided URL in the default web browser.
## Contribution ### Advanced Usage: Handling in Continuous Integration Environments
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). :) `@push.rocks/smartopen` intelligently detects if it's running in a Continuous Integration (CI) environment and avoids opening the browser in such cases. This is practical for automated testing or deployment scripts where opening a browser window would be unnecessary or problematic.
For further information read the linked docs at the top of this readme. Here's how you can utilize `@push.rocks/smartopen` in an environment-aware manner:
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) ```typescript
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) import { openUrl } from '@push.rocks/smartopen';
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) async function openLinkConditionally(url: string) {
const result = await openUrl(url);
if(result === null) {
console.log('Environment detected as CI, skipping browser opening.');
} else {
console.log('Browser should open shortly:', url);
}
}
openLinkConditionally('https://example.com')
.catch((error) => console.error('An error occurred:', error));
```
In this example, the `openUrl` function returns `null` if it detects that it's being run in a CI environment, allowing the calling code to handle this scenario appropriately.
### Conclusion
`@push.rocks/smartopen` provides a straightforward and effective solution for opening URLs from Node.js scripts, with smart handling for CI environments. Whether you're building a desktop application, developing a server-side application that interacts with web services, or creating automation scripts that open web pages, `@push.rocks/smartopen` offers a reliable method to achieve your goals.
Remember, the examples above demonstrate the basic and advanced usage of `@push.rocks/smartopen`. Depending on your specific needs, you might need to adjust the logic or combine it with other modules to create more complex and powerful applications.
## 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.