Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
7375675d7d | |||
68f9221d33 | |||
269e658967 | |||
9008aca718 | |||
74d73a0d21 | |||
5496c8c482 |
16
.gitignore
vendored
16
.gitignore
vendored
@ -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
|
@ -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:
|
||||||
@ -49,14 +49,14 @@ testLTS:
|
|||||||
tags:
|
tags:
|
||||||
- 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
|
||||||
@ -65,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
|
||||||
@ -78,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
|
||||||
@ -109,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
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/websetup",
|
"name": "@pushrocks/websetup",
|
||||||
"version": "1.0.8",
|
"version": "2.0.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
14
package.json
14
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/websetup",
|
"name": "@pushrocks/websetup",
|
||||||
"version": "1.0.8",
|
"version": "2.0.2",
|
||||||
"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"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
22
ts/index.ts
22
ts/index.ts
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
|
||||||
};
|
|
Reference in New Issue
Block a user