Compare commits

..

No commits in common. "master" and "v1.0.5" have entirely different histories.

15 changed files with 1906 additions and 4770 deletions

4
.gitignore vendored
View File

@ -15,6 +15,8 @@ node_modules/
# builds # builds
dist/ dist/
dist_*/ dist_web/
dist_serve/
dist_ts_web/
# custom # custom

View File

@ -1,73 +1,66 @@
# gitzone ci_default # gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
- .npmci_cache/ - .npmci_cache/
key: '$CI_BUILD_STAGE' key: "$CI_BUILD_STAGE"
stages: stages:
- security - security
- test - test
- release - release
- metadata - metadata
before_script: # ====================
- pnpm install -g pnpm # security stage
- pnpm install -g @shipzone/npmci # ====================
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
- notpriv
snyk:
stage: security
script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install -g snyk
# ==================== - npmci command npm install --ignore-scripts
# security stage - npmci command snyk test
# ====================
# ====================
# security stage
# ====================
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --prod
tags: tags:
- lossless
- docker - docker
allow_failure: true - notpriv
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --dev
tags:
- lossless
- docker
allow_failure: true
# ==================== # ====================
# test stage # test stage
# ==================== # ====================
testStable: testLTS:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
stage: test
script:
- npmci npm prepare
- npmci node install stable - npmci node install stable
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
testBuild:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci npm build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release: release:
stage: release stage: release
@ -77,7 +70,6 @@ release:
only: only:
- tags - tags
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
@ -87,14 +79,11 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g typescript - npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- lossless
- docker - docker
- priv - priv
@ -105,18 +94,18 @@ trigger:
only: only:
- tags - tags
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
pages: pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata stage: metadata
script: script:
- npmci node install stable - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command npm run buildDocs - npmci command tsdoc
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
only: only:

11
.vscode/launch.json vendored
View File

@ -1,11 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored
View File

@ -1,26 +0,0 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,29 +1,17 @@
{ {
"gitzone": { "gitzone": {
"projectType": "npm",
"module": { "module": {
"githost": "code.foss.global", "githost": "gitlab.com",
"gitscope": "push.rocks", "gitscope": "pushrocks",
"gitrepo": "smartmanifest", "gitrepo": "smartmanifest",
"description": "A toolkit for constructing web application manifests with TypeScript support.", "shortDescription": "a module for creating web app manifests",
"npmPackagename": "@push.rocks/smartmanifest", "npmPackagename": "@pushrocks/smartmanifest",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks", "projectDomain": "push.rocks"
"keywords": [
"web app manifest",
"service worker",
"PWA",
"TypeScript",
"node.js",
"web development"
]
} }
}, },
"npmci": { "npmci": {
"npmGlobalTools": [], "npmGlobalTools": [],
"npmAccessLevel": "public" "npmAccessLevel": "public"
},
"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"
} }
} }

1772
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,52 +1,34 @@
{ {
"name": "@push.rocks/smartmanifest", "name": "@pushrocks/smartmanifest",
"version": "2.0.2", "version": "1.0.5",
"private": false, "private": false,
"description": "A toolkit for constructing web application manifests with TypeScript support.", "description": "a module for creating web app manifests",
"main": "dist_ts/index.js", "main": "dist/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist/index.d.ts",
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "(tsbuild)", "build": "(tsbuild)",
"format": "(gitzone format)", "format": "(gitzone format)"
"buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.66", "@gitzone/tsbuild": "^2.0.22",
"@gitzone/tsrun": "^1.2.42", "@gitzone/tstest": "^1.0.24",
"@gitzone/tstest": "^1.0.74", "@pushrocks/tapbundle": "^3.0.7",
"@pushrocks/tapbundle": "^5.0.4", "@types/node": "^12.0.8",
"@types/node": "^20.3.0" "tslint": "^5.17.0",
"tslint-config-prettier": "^1.15.0"
}, },
"dependencies": {},
"files": [ "files": [
"ts/**/*", "ts/*",
"ts_web/**/*", "ts_web/*",
"dist/**/*", "dist/*",
"dist_*/**/*", "dist_web/*",
"dist_ts/**/*", "assets/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
], ]
"type": "module",
"browserslist": [
"last 1 chrome versions"
],
"keywords": [
"web app manifest",
"service worker",
"PWA",
"TypeScript",
"node.js",
"web development"
],
"homepage": "https://code.foss.global/push.rocks/smartmanifest",
"repository": {
"type": "git",
"url": "https://code.foss.global/push.rocks/smartmanifest.git"
}
} }

4441
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@

128
readme.md
View File

@ -1,118 +1,26 @@
# @push.rocks/smartmanifest # @pushrocks/smartmanifest
a module for creating web app manifests a module for creating web app manifests
## Install ## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartmanifest)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartmanifest)
* [github.com (source mirror)](https://github.com/pushrocks/smartmanifest)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartmanifest/)
To start using `@push.rocks/smartmanifest`, first, you need to install it through npm or yarn. Heres how you can do it using npm: ## Status for master
[![build status](https://gitlab.com/pushrocks/smartmanifest/badges/master/build.svg)](https://gitlab.com/pushrocks/smartmanifest/commits/master)
```sh [![coverage report](https://gitlab.com/pushrocks/smartmanifest/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartmanifest/commits/master)
npm install @push.rocks/smartmanifest --save [![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartmanifest.svg)](https://www.npmjs.com/package/@pushrocks/smartmanifest)
``` [![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartmanifest/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartmanifest)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Or, if you are using yarn, you can do: [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
```sh
yarn add @push.rocks/smartmanifest
```
This will add `@push.rocks/smartmanifest` to your project dependencies and you're ready to start using it to generate web app manifests with ease.
## Usage ## Usage
The `@push.rocks/smartmanifest` module simplifies the creation of web app manifests, providing a straightforward TypeScript interface to construct and output manifest files, which are essential for modern web applications. Heres how to get started: For further information read the linked docs at the top of this readme.
### Basic Example > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
Create an instance of `SmartManifest` by importing the module and configuring it with essential manifest properties: [![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)
```typescript
// Import the module
import { SmartManifest, ISmartManifestConstructorOptions } from '@push.rocks/smartmanifest';
// Define manifest options
const manifestOptions: ISmartManifestConstructorOptions = {
name: 'Your App Name',
short_name: 'AppName',
start_url: '/',
display: 'standalone',
theme_color: '#000000',
background_color: '#ffffff',
icons: [
{
src: 'icons/icon-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'icons/icon-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
};
// Create SmartManifest instance
const yourAppManifest = new SmartManifest(manifestOptions);
// Output the manifest as a JSON string
console.log(yourAppManifest.jsonString());
```
This example shows the creation of a simple web app manifest using `@push.rocks/smartmanifest`. Essential attributes such as `name`, `short_name`, `start_url`, `display`, `theme_color`, `background_color`, and `icons` are specified in the `ISmartManifestConstructorOptions`.
### Advanced Configuration
The module also allows for more advanced configuration of the manifest, supporting fields for orientation, related applications, and even custom extensions. For example, setting the manifest to encourage the application to be shown in a fullscreen mode with a specific orientation or setting related applications for app stores:
```typescript
import { SmartManifest, ISmartManifestConstructorOptions } from '@push.rocks/smartmanifest';
const advancedManifestOptions: ISmartManifestConstructorOptions = {
name: 'Advanced App',
short_name: 'AdvApp',
display: 'fullscreen',
orientation: 'landscape',
related_applications: [
{
platform: 'play',
id: 'com.example.app'
}
],
// Further customization here
};
const advancedAppManifest = new SmartManifest(advancedManifestOptions);
console.log(advancedAppManifest.jsonString());
```
### Working with Icons
The icons field in the manifest is particularly important for ensuring your application has a compelling presence on the user's home screen and within task switchers across various platforms. `@push.rocks/smartmanifest` allows you to specify multiple icons, different dimensions, and purposes (for example, any, maskable, or monochrome).
### Using the Output
Once you have generated the JSON string representation of your web app's manifest, you can write this to a `manifest.json` file at the root of your web project or serve it dynamically via a web server. Ensuring the manifest is correctly linked within your application's `<head>` section with `<link rel="manifest" href="/manifest.json">` is crucial for the web app to be recognized as such by browsers and platforms.
### Conclusion
By leveraging `@push.rocks/smartmanifest`, developers can streamline the generation of web app manifests, ensuring their applications meet the criteria for progressive web apps (PWAs) and providing a superior user experience across devices and platforms. The use of TypeScript for configuration encapsulates the complexity of manifest generation, making the process more intuitive and error-free.
## 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.

View File

@ -1,14 +1,14 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as smartmanifest from '../ts/index.js'; import * as smartmanifest from '../ts/index';
let testSmartManifest: smartmanifest.SmartManifest; let testSmartManifest: smartmanifest.SmartManifest;
tap.test('first test', async () => { tap.test('first test', async () => {
testSmartManifest = new smartmanifest.SmartManifest({ testSmartManifest = new smartmanifest.SmartManifest({
name: 'test app', name: 'test app',
short_name: 'app', short_name: 'app'
}); });
expect(testSmartManifest).toBeInstanceOf(smartmanifest.SmartManifest); expect(testSmartManifest).to.be.instanceOf(smartmanifest.SmartManifest);
}); });
tap.test('should produce a web app manifest', async () => { tap.test('should produce a web app manifest', async () => {

View File

@ -1,8 +0,0 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smartmanifest',
version: '2.0.2',
description: 'a module for creating web app manifests'
}

View File

@ -1,26 +1,20 @@
import * as plugins from './smartmanifest.plugins.js'; import * as plugins from './smartmanifest.plugins';
export interface ISmartManifestConstructorOptions { export interface ISmartManifestConstructorOptions {
name: string; name: string;
short_name: string; short_name: string;
start_url?: '/'; start_url?: '/';
display?: 'standalone'; display?: string;
orientation?: 'any'; orientation?: string;
background_color?: string; background_color?: string;
theme_color?: string; theme_color?: string;
icons?: Array<{ icons?: [
{
src: string; src: string;
type: string; type: string;
sizes: string; sizes: string;
purpose?: 'any' | 'maskable' | 'monochrome'; }
}>; ];
related_applications?: Array<{
platform: 'play' | string;
id: string;
}>;
scope: string;
lang: string;
display_override: 'window-controls-overlay'[];
} }
const defaultConstructorOptions: ISmartManifestConstructorOptions = { const defaultConstructorOptions: ISmartManifestConstructorOptions = {
@ -29,30 +23,15 @@ const defaultConstructorOptions: ISmartManifestConstructorOptions = {
start_url: '/', start_url: '/',
display: 'standalone', display: 'standalone',
orientation: 'any', orientation: 'any',
background_color: '#000000', background_color: '#fff',
theme_color: '#000000', theme_color: '#f78f21',
icons: [ icons: [
{ {
src: '/assetbroker/manifest/icon-large.png', src: '/assets/icon-large.png',
type: 'image/png', type: 'image/png',
sizes: '1024x1024', sizes: '1024x1024'
purpose: 'any', }
}, ]
{
src: '/assetbroker/manifest/icon-144x144.png',
sizes: '144x144',
type: 'image/png',
},
{
src: '/assetbroker/manifest/icon-512x512.png',
sizes: '512x512',
type: 'image/png',
},
],
related_applications: [],
scope: '/',
lang: 'en',
display_override: ['window-controls-overlay'],
}; };
export class SmartManifest { export class SmartManifest {
@ -60,7 +39,7 @@ export class SmartManifest {
constructor(optionsArg: ISmartManifestConstructorOptions) { constructor(optionsArg: ISmartManifestConstructorOptions) {
this.options = { this.options = {
...defaultConstructorOptions, ...defaultConstructorOptions,
...optionsArg, ...optionsArg
}; };
} }

View File

@ -1,14 +0,0 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
}

17
tslint.json Normal file
View File

@ -0,0 +1,17 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}