Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
cb80b4df75 | |||
74ed988da0 | |||
d1793f9084 | |||
4a45262124 | |||
f5f51ac1a6 | |||
eb4a4288ed |
@ -34,28 +34,6 @@ snyk:
|
|||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
|
|
||||||
sast:
|
|
||||||
stage: security
|
|
||||||
image: docker:stable
|
|
||||||
variables:
|
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
allow_failure: true
|
|
||||||
services:
|
|
||||||
- docker:stable-dind
|
|
||||||
script:
|
|
||||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
|
||||||
- docker run
|
|
||||||
--env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
|
|
||||||
--volume "$PWD:/code"
|
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
"registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
|
|
||||||
artifacts:
|
|
||||||
reports:
|
|
||||||
sast: gl-sast-report.json
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
# ====================
|
# ====================
|
||||||
|
@ -2,5 +2,15 @@
|
|||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"module": {
|
||||||
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "pushrocks",
|
||||||
|
"gitrepo": "websetup",
|
||||||
|
"shortDescription": "setup basic page properties",
|
||||||
|
"npmPackagename": "@pushrocks/websetup",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/websetup",
|
"name": "@pushrocks/websetup",
|
||||||
"version": "1.0.4",
|
"version": "1.0.7",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/websetup",
|
"name": "@pushrocks/websetup",
|
||||||
"version": "1.0.4",
|
"version": "1.0.7",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "setup basic page properties",
|
"description": "setup basic page properties",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -9,9 +9,13 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild)",
|
"build": "(tsbuild --web)",
|
||||||
"format": "(gitzone format)"
|
"format": "(gitzone format)"
|
||||||
},
|
},
|
||||||
|
"keywords": [
|
||||||
|
"lossless",
|
||||||
|
"websafe"
|
||||||
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.0.22",
|
"@gitzone/tsbuild": "^2.0.22",
|
||||||
"@gitzone/tstest": "^1.0.15",
|
"@gitzone/tstest": "^1.0.15",
|
||||||
|
26
readme.md
Normal file
26
readme.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# @pushrocks/websetup
|
||||||
|
setup basic page properties
|
||||||
|
|
||||||
|
## Availabililty and Links
|
||||||
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/websetup)
|
||||||
|
* [gitlab.com (source)](https://gitlab.com/pushrocks/websetup)
|
||||||
|
* [github.com (source mirror)](https://github.com/pushrocks/websetup)
|
||||||
|
* [docs (typedoc)](https://pushrocks.gitlab.io/websetup/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[](https://gitlab.com/pushrocks/websetup/commits/master)
|
||||||
|
[](https://gitlab.com/pushrocks/websetup/commits/master)
|
||||||
|
[](https://www.npmjs.com/package/@pushrocks/websetup)
|
||||||
|
[](https://snyk.io/test/npm/@pushrocks/websetup)
|
||||||
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
[](https://prettier.io/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
|
[](https://maintainedby.lossless.com)
|
@ -1,8 +1,8 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
import * as websetup from '../ts/index'
|
import * as websetup from '../ts/index';
|
||||||
|
|
||||||
tap.test('first test', async () => {
|
tap.test('first test', async () => {
|
||||||
console.log(websetup.standardExport)
|
console.log('Waiting for proper puppeteer support here');
|
||||||
})
|
});
|
||||||
|
|
||||||
tap.start()
|
tap.start();
|
||||||
|
19
ts/index.ts
19
ts/index.ts
@ -2,10 +2,14 @@ import * as plugins from './websetup.plugins';
|
|||||||
|
|
||||||
import { setupGoogleAnalytics } from './tools/ganalytics';
|
import { setupGoogleAnalytics } from './tools/ganalytics';
|
||||||
import { setupFullStory } from './tools/fullstory';
|
import { setupFullStory } from './tools/fullstory';
|
||||||
|
import { setupServiceWoker } from './serviceworker';
|
||||||
|
import { IMetaObject, setupMetaInformation } from './meta';
|
||||||
|
|
||||||
export interface IWebSetupConstructorOptions {
|
export interface IWebSetupConstructorOptions {
|
||||||
googleAnalyticsCode?: string;
|
googleAnalyticsCode?: string;
|
||||||
fsCode?: string;
|
fsCode?: string;
|
||||||
|
metaObject: IMetaObject;
|
||||||
|
serviceworker?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,12 +17,21 @@ export interface IWebSetupConstructorOptions {
|
|||||||
*/
|
*/
|
||||||
export class WebSetup {
|
export class WebSetup {
|
||||||
constructor(optionsArg: IWebSetupConstructorOptions) {
|
constructor(optionsArg: IWebSetupConstructorOptions) {
|
||||||
|
// most important, lets get the meta information in place
|
||||||
|
this.setup(optionsArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
async setup(optionsArg: IWebSetupConstructorOptions) {
|
||||||
|
if (optionsArg.serviceworker) {
|
||||||
|
await setupServiceWoker();
|
||||||
|
}
|
||||||
|
|
||||||
if (optionsArg.googleAnalyticsCode) {
|
if (optionsArg.googleAnalyticsCode) {
|
||||||
setupGoogleAnalytics(optionsArg.googleAnalyticsCode);
|
await setupGoogleAnalytics(optionsArg.googleAnalyticsCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optionsArg.fsCode) {
|
if (optionsArg.fsCode) {
|
||||||
setupFullStory(optionsArg.fsCode)
|
await setupFullStory(optionsArg.fsCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
ts/meta/index.ts
Normal file
18
ts/meta/index.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
export interface IMetaObject {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const setupMetaInformation = async (metaObjectArg: IMetaObject) => {
|
||||||
|
document.title = metaObjectArg.title;
|
||||||
|
addMetaTag('description', metaObjectArg.description);
|
||||||
|
addMetaTag('google', 'notranslate');
|
||||||
|
addMetaTag('revisited-after', '1 days');
|
||||||
|
};
|
||||||
|
|
||||||
|
const addMetaTag = async (linkNameArg: string, contentArg: string) => {
|
||||||
|
const metaElement = document.createElement('meta');
|
||||||
|
metaElement.name = linkNameArg;
|
||||||
|
metaElement.content = contentArg;
|
||||||
|
document.getElementsByTagName('head')[0].appendChild(metaElement);
|
||||||
|
};
|
11
ts/serviceworker/index.ts
Normal file
11
ts/serviceworker/index.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export const setupServiceWoker = async () => {
|
||||||
|
// serviceworker
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.onload = () => {
|
||||||
|
console.log(
|
||||||
|
'Loaded Serviceworker. The serviceworker helps us with notifications and offline capabilities, so you can also read this site when your device is offline.'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
script.src = 'serviceworker/mainthread.js';
|
||||||
|
document.head.appendChild(script);
|
||||||
|
};
|
@ -1,4 +1,2 @@
|
|||||||
const removeme = {};
|
const removeme = {};
|
||||||
export {
|
export { removeme };
|
||||||
removeme
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user