fix(core): update
This commit is contained in:
parent
78093e5ade
commit
207183e531
14
package-lock.json
generated
14
package-lock.json
generated
@ -61,9 +61,9 @@
|
||||
}
|
||||
},
|
||||
"@gitzone/tstest": {
|
||||
"version": "1.0.21",
|
||||
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.21.tgz",
|
||||
"integrity": "sha512-bYdU0+H2ZZZtIq5mxM6wql2E/kP33x9okNjU0SVuGi/NuyKLpM04MnGH3n0VaaC+kU2bEz80DL1AkmDMrYCK/w==",
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.22.tgz",
|
||||
"integrity": "sha512-S3Gcyml+Fr4+QYinRcUmedvR8E+MfPik6P7Om4cwI1DyrNvBt0BgCricfxIKrqI8qleY1mtAbJWm8d3BO/ZSww==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@gitzone/tsrun": "^1.2.6",
|
||||
@ -71,7 +71,7 @@
|
||||
"@pushrocks/smartfile": "^7.0.2",
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@pushrocks/smartshell": "^2.0.16",
|
||||
"@pushrocks/smartshell": "^2.0.17",
|
||||
"@types/figures": "^3.0.1",
|
||||
"figures": "^3.0.0"
|
||||
}
|
||||
@ -391,9 +391,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "10.14.7",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-10.14.7.tgz",
|
||||
"integrity": "sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A==",
|
||||
"version": "12.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.0.2.tgz",
|
||||
"integrity": "sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/vinyl": {
|
||||
|
@ -14,9 +14,9 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tstest": "^1.0.15",
|
||||
"@gitzone/tstest": "^1.0.22",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^10.11.7",
|
||||
"@types/node": "^12.0.2",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
|
19
test/test.ts
19
test/test.ts
@ -1,8 +1,19 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as smartmanifest from '../ts/index'
|
||||
import * as smartmanifest from '../ts/index';
|
||||
|
||||
let testSmartManifest: smartmanifest.SmartManifest;
|
||||
|
||||
tap.test('first test', async () => {
|
||||
console.log(smartmanifest.standardExport)
|
||||
})
|
||||
testSmartManifest = new smartmanifest.SmartManifest({
|
||||
name: 'test app',
|
||||
short_name: 'app'
|
||||
});
|
||||
expect(testSmartManifest).to.be.instanceOf(smartmanifest.SmartManifest);
|
||||
});
|
||||
|
||||
tap.start()
|
||||
tap.test('should produce a web app manifest', async () => {
|
||||
const testData = testSmartManifest.getData();
|
||||
console.log(testData);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
55
ts/index.ts
55
ts/index.ts
@ -1,3 +1,56 @@
|
||||
import * as plugins from './smartmanifest.plugins';
|
||||
|
||||
export let standardExport = 'Hi there! :) This is an exported string';
|
||||
export interface ISmartManifestConstructorOptions {
|
||||
name: string;
|
||||
short_name: string;
|
||||
start_url?: '/';
|
||||
display?: string;
|
||||
orientation?: string;
|
||||
background_color?: string;
|
||||
theme_color?: string;
|
||||
icons?: [
|
||||
{
|
||||
src: string;
|
||||
type: string;
|
||||
sizes: string;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
const defaultConstructorOptions: ISmartManifestConstructorOptions = {
|
||||
name: 'UNNAMED APP',
|
||||
short_name: 'UNNAMED',
|
||||
start_url: '/',
|
||||
display: 'standalone',
|
||||
orientation: 'any',
|
||||
background_color: '#fff',
|
||||
theme_color: '#f78f21',
|
||||
icons: [
|
||||
{
|
||||
src: '/assets/icon-large.png',
|
||||
type: 'image/png',
|
||||
sizes: '1024x1024',
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export class SmartManifest {
|
||||
public options: ISmartManifestConstructorOptions;
|
||||
constructor(optionsArg: ISmartManifestConstructorOptions) {
|
||||
this.options = {
|
||||
...defaultConstructorOptions,
|
||||
...optionsArg
|
||||
};
|
||||
}
|
||||
|
||||
public jsonString(): string {
|
||||
return JSON.stringify(this.options);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the manifest data as javascriptObject
|
||||
*/
|
||||
public getData() {
|
||||
return JSON.parse(JSON.stringify(this.options));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user