Compare commits

...

14 Commits

Author SHA1 Message Date
5318408037 2.0.3 2019-07-24 11:43:20 +02:00
16ef41ae20 fix(core): update 2019-07-24 11:43:20 +02:00
7375675d7d 2.0.2 2019-07-16 18:54:33 +02:00
68f9221d33 fix(core): update 2019-07-16 18:54:33 +02:00
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
c748c5102c 1.0.8 2019-03-27 14:58:24 +01:00
308133fe4f fix(core): update 2019-03-27 14:58:24 +01:00
cb80b4df75 1.0.7 2019-03-27 14:46:42 +01:00
74ed988da0 fix(core): update 2019-03-27 14:46:41 +01:00
d1793f9084 1.0.6 2019-03-27 14:40:07 +01:00
4a45262124 fix(core): update 2019-03-27 14:40:06 +01:00
12 changed files with 93 additions and 76 deletions

16
.gitignore vendored
View File

@ -1,8 +1,22 @@
.nogit/ .nogit/
node_modules/
# artifacts
coverage/ coverage/
public/ public/
pages/ pages/
# installs
node_modules/
# caches
.yarn/ .yarn/
.cache/ .cache/
.rpt2_cache
# builds
dist/ dist/
dist_web/
dist_serve/
dist_ts_web/
# custom

View File

@ -1,5 +1,5 @@
# gitzone standard # gitzone ci_default
image: hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
@ -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
# ==================== # ====================
@ -72,13 +50,13 @@ testLTS:
- docker - docker
- notpriv - notpriv
testSTABLE: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install stable - npmci node install lts
- npmci npm install - npmci npm install
- npmci npm test - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
@ -87,7 +65,7 @@ testSTABLE:
release: release:
stage: release stage: release
script: script:
- npmci node install stable - npmci node install lts
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
@ -100,19 +78,11 @@ release:
# ==================== # ====================
codequality: codequality:
stage: metadata stage: metadata
image: docker:stable
allow_failure: true allow_failure: true
services:
- docker:stable-dind
script: script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - npmci command npm install -g tslint typescript
- docker run - npmci npm install
--env SOURCE_CODE="$PWD" - npmci command "tslint -c tslint.json ./ts/**/*.ts"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags: tags:
- docker - docker
- priv - priv
@ -131,10 +101,10 @@ pages:
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
stage: metadata stage: metadata
script: script:
- npmci command npm install -g typedoc typescript - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/ - npmci command tsdoc
tags: tags:
- docker - docker
- notpriv - notpriv

View File

@ -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
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/websetup", "name": "@pushrocks/websetup",
"version": "1.0.5", "version": "2.0.3",
"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.5", "version": "2.0.3",
"private": false, "private": false,
"description": "setup basic page properties", "description": "setup basic page properties",
"main": "dist/index.js", "main": "dist/index.js",
@ -9,7 +9,7 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "(tsbuild)", "build": "(tsbuild --web)",
"format": "(gitzone format)" "format": "(gitzone format)"
}, },
"keywords": [ "keywords": [
@ -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"
]
} }

26
readme.md Normal file
View 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
[![build status](https://gitlab.com/pushrocks/websetup/badges/master/build.svg)](https://gitlab.com/pushrocks/websetup/commits/master)
[![coverage report](https://gitlab.com/pushrocks/websetup/badges/master/coverage.svg)](https://gitlab.com/pushrocks/websetup/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/websetup.svg)](https://www.npmjs.com/package/@pushrocks/websetup)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/websetup/badge.svg)](https://snyk.io/test/npm/@pushrocks/websetup)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![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/)
## 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)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)

View File

@ -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('Waiting for proper puppeteer support here'); console.log('Waiting for proper puppeteer support here');
}) });
tap.start(); tap.start();

View File

@ -2,36 +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() {
if(optionsArg.serviceworker) { await setupMetaInformation(this.options.metaObject);
await setupServiceWoker()
if (this.options.googleAnalyticsCode) {
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,9 +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);
};

View File

@ -28,6 +28,7 @@ export const setupFullStory = async (fsCodeArg: string) => {
o = n.createElement(t); o = n.createElement(t);
o.async = 1; o.async = 1;
o.src = 'https://' + window._fs_host + '/s/fs.js'; o.src = 'https://' + window._fs_host + '/s/fs.js';
o.crossorigin = 'anonymous';
y = n.getElementsByTagName(t)[0]; y = n.getElementsByTagName(t)[0];
y.parentNode.insertBefore(o, y); y.parentNode.insertBefore(o, y);
// tslint:disable-next-line: only-arrow-functions // tslint:disable-next-line: only-arrow-functions

View File

@ -22,6 +22,7 @@ export const setupGoogleAnalytics = async (gaCode: string) => {
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]); (a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1; a.async = 1;
a.src = g; a.src = g;
a.crossorigin = 'anonymous';
m.parentNode.insertBefore(a, m); m.parentNode.insertBefore(a, m);
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'analytics'); })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'analytics');

View File

@ -1,4 +1,2 @@
const removeme = {}; const removeme = {};
export { export { removeme };
removeme
}