diff --git a/package-lock.json b/package-lock.json index bd135ad..00ba0e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5171,6 +5171,14 @@ "pend": "~1.2.0" } }, + "feed": { + "version": "4.2.1", + "resolved": "https://verdaccio.lossless.one/feed/-/feed-4.2.1.tgz", + "integrity": "sha512-l28KKcK1J/u3iq5dRDmmoB2p7dtBfACC2NqJh4dI2kFptxH0asfjmOfcxqh5Sv8suAlVa73gZJ4REY5RrafVvg==", + "requires": { + "xml-js": "^1.6.11" + } + }, "figures": { "version": "3.2.0", "resolved": "https://verdaccio.lossless.one/figures/-/figures-3.2.0.tgz", @@ -9430,8 +9438,7 @@ "sax": { "version": "1.2.4", "resolved": "https://verdaccio.lossless.one/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "saxes": { "version": "3.1.11", @@ -10931,6 +10938,14 @@ "async-limiter": "~1.0.0" } }, + "xml-js": { + "version": "1.6.11", + "resolved": "https://verdaccio.lossless.one/xml-js/-/xml-js-1.6.11.tgz", + "integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==", + "requires": { + "sax": "^1.2.4" + } + }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://verdaccio.lossless.one/xml-name-validator/-/xml-name-validator-3.0.0.tgz", diff --git a/package.json b/package.json index c5178c8..334ade2 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,9 @@ "tslint": "^6.1.3", "tslint-config-prettier": "^1.15.0" }, - "dependencies": {}, + "dependencies": { + "feed": "^4.2.1" + }, "browserslist": [ "last 1 chrome versions" ], diff --git a/test/test.ts b/test/test.ts index 43568a3..9b413ca 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,8 +1,11 @@ import { expect, tap } from '@pushrocks/tapbundle'; import * as smartfeed from '../ts/index'; -tap.test('first test', async () => { - console.log(smartfeed.standardExport); +let testSmartFeed: smartfeed.Smartfeed; + +tap.test('should create a feedVersion', async () => { + testSmartFeed = new smartfeed.Smartfeed(); + expect(testSmartFeed).to.be.instanceOf(smartfeed.Smartfeed); }); tap.start(); diff --git a/ts/index.ts b/ts/index.ts index a96f22c..d8d3021 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,3 +1,9 @@ +import { Feed, IFeedOptions } from './smartfeed.classes.feed'; import * as plugins from './smartfeed.plugins'; -export let standardExport = 'Hi there! :) This is an exported string'; +export class Smartfeed { + public createFeed(optionsArg: IFeedOptions) { + const feedVersion = new Feed(optionsArg); + return feedVersion; + } +} \ No newline at end of file diff --git a/ts/smartfeed.classes.feed.ts b/ts/smartfeed.classes.feed.ts new file mode 100644 index 0000000..2b4a5d7 --- /dev/null +++ b/ts/smartfeed.classes.feed.ts @@ -0,0 +1,40 @@ +import * as plugins from './smartfeed.plugins'; + +export interface IFeedOptions { + domain: string; + title: string; + description: string; + company: string; + companyEmail: string; + companyDomain: string; +} + +export interface IFeedItem {} + +export class Feed { + options: IFeedOptions; + items: IFeedOptions[]; + constructor(optionsArg: IFeedOptions) { + this.options = optionsArg; + } + + public addItem() { + + } + + public exportRssFeed() { + const feed = new plugins.feed.Feed({ + copyright: `All rights reserved, ${this.options.company}`, + id: this.options.domain, + title: this.options.title, + author: { + name: this.options.company, + email: this.options.companyEmail, + link: this.options.companyEmail + }, + description: this.options.description, + generator: '@pushrocks/smartfeed', + language: "en" + }); + } +} \ No newline at end of file diff --git a/ts/smartfeed.plugins.ts b/ts/smartfeed.plugins.ts index 29aa9da..d675152 100644 --- a/ts/smartfeed.plugins.ts +++ b/ts/smartfeed.plugins.ts @@ -1,2 +1,6 @@ -const removeme = {}; -export { removeme }; +// third party scope +import * as feed from 'feed'; + +export { + feed +};