Compare commits

..

4 Commits

Author SHA1 Message Date
269e658967 2.0.1 2019-07-16 18:54:19 +02:00
9008aca718 fix(core): update 2019-07-16 18:54:19 +02:00
74d73a0d21 2.0.0 2019-07-16 18:49:16 +02:00
5496c8c482 BREAKING CHANGE(core): remove serviceworker 2019-07-16 18:49:15 +02:00
5 changed files with 22 additions and 29 deletions

View File

@ -1,4 +1,4 @@
# gitzone standard # gitzone ci_default
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
cache: cache:

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/websetup", "name": "@pushrocks/websetup",
"version": "1.0.8", "version": "2.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/websetup", "name": "@pushrocks/websetup",
"version": "1.0.8", "version": "2.0.1",
"private": false, "private": false,
"description": "setup basic page properties", "description": "setup basic page properties",
"main": "dist/index.js", "main": "dist/index.js",
@ -23,5 +23,15 @@
"tslint": "^5.11.0", "tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": {} "dependencies": {},
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"assets/*",
"cli.js",
"npmextra.json",
"readme.md"
]
} }

View File

@ -2,38 +2,32 @@ 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'; import { IMetaObject, setupMetaInformation } from './meta';
export interface IWebSetupConstructorOptions { export interface IWebSetupConstructorOptions {
googleAnalyticsCode?: string; googleAnalyticsCode?: string;
fsCode?: string; fsCode?: string;
metaObject: IMetaObject; metaObject: IMetaObject;
serviceworker?: boolean;
} }
/** /**
* the main WebSetup class * the main WebSetup class
*/ */
export class WebSetup { export class WebSetup {
public options: IWebSetupConstructorOptions;
constructor(optionsArg: IWebSetupConstructorOptions) { constructor(optionsArg: IWebSetupConstructorOptions) {
// most important, lets get the meta information in place this.options = optionsArg;
this.setup(optionsArg);
} }
async setup(optionsArg: IWebSetupConstructorOptions) { public async setup() {
await setupMetaInformation(optionsArg.metaObject); await setupMetaInformation(this.options.metaObject);
if (optionsArg.serviceworker) { if (this.options.googleAnalyticsCode) {
await setupServiceWoker(); await setupGoogleAnalytics(this.options.googleAnalyticsCode);
} }
if (optionsArg.googleAnalyticsCode) { if (this.options.fsCode) {
await setupGoogleAnalytics(optionsArg.googleAnalyticsCode); await setupFullStory(this.options.fsCode);
}
if (optionsArg.fsCode) {
await setupFullStory(optionsArg.fsCode);
} }
} }
} }

View File

@ -1,11 +0,0 @@
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);
};