From b2435cf5ea126059c17c14ef0fe8eba72738db6f Mon Sep 17 00:00:00 2001 From: pike Date: Sun, 3 Dec 2023 19:29:59 +0100 Subject: [PATCH 1/2] feat: Divide src/core to models and services --- src/auth/FacebookAuth.ts | 4 ++-- src/auth/InstagramAuth.ts | 4 ++-- src/auth/LinkedInAuth.ts | 4 ++-- src/auth/OAuth2Client.ts | 2 +- src/auth/RedditAuth.ts | 4 ++-- src/auth/TwitterAuth.ts | 4 ++-- src/cli.ts | 6 +++--- src/{core => models}/Feed.ts | 4 ++-- src/{core => models}/Folder.ts | 2 +- src/{core => models}/Platform.ts | 2 +- src/{core => models}/Post.ts | 2 +- src/platforms/Ayrshare.ts | 12 ++++++------ src/platforms/Ayrshare/AsFacebook.ts | 4 ++-- src/platforms/Ayrshare/AsInstagram.ts | 6 +++--- src/platforms/Ayrshare/AsLinkedIn.ts | 6 +++--- src/platforms/Ayrshare/AsReddit.ts | 6 +++--- src/platforms/Ayrshare/AsTikTok.ts | 4 ++-- src/platforms/Ayrshare/AsTwitter.ts | 6 +++--- src/platforms/Ayrshare/AsYouTube.ts | 4 ++-- src/platforms/Facebook.ts | 12 ++++++------ src/platforms/Instagram.ts | 12 ++++++------ src/platforms/LinkedIn.ts | 12 ++++++------ src/platforms/Reddit.ts | 10 +++++----- src/platforms/Twitter.ts | 10 +++++----- src/{core => services}/Fairpost.ts | 16 +++++++++++----- src/{core => services}/Logger.ts | 0 src/{core => services}/Storage.ts | 0 27 files changed, 82 insertions(+), 76 deletions(-) rename src/{core => models}/Feed.ts (99%) rename src/{core => models}/Folder.ts (98%) rename src/{core => models}/Platform.ts (99%) rename src/{core => models}/Post.ts (98%) rename src/{core => services}/Fairpost.ts (82%) rename src/{core => services}/Logger.ts (100%) rename src/{core => services}/Storage.ts (100%) diff --git a/src/auth/FacebookAuth.ts b/src/auth/FacebookAuth.ts index af33161..f389494 100644 --- a/src/auth/FacebookAuth.ts +++ b/src/auth/FacebookAuth.ts @@ -1,6 +1,6 @@ import OAuth2Client from "./OAuth2Client"; -import Logger from "../core/Logger"; -import Storage from "../core/Storage"; +import Logger from "../services/Logger"; +import Storage from "../services/Storage"; export default class FacebookAuth extends OAuth2Client { GRAPH_API_VERSION: string = "v18.0"; diff --git a/src/auth/InstagramAuth.ts b/src/auth/InstagramAuth.ts index 35ebe69..b89781b 100644 --- a/src/auth/InstagramAuth.ts +++ b/src/auth/InstagramAuth.ts @@ -1,6 +1,6 @@ import FacebookAuth from "./FacebookAuth"; -import Logger from "../core/Logger"; -import Storage from "../core/Storage"; +import Logger from "../services/Logger"; +import Storage from "../services/Storage"; export default class InstagramAuth extends FacebookAuth { async setup() { diff --git a/src/auth/LinkedInAuth.ts b/src/auth/LinkedInAuth.ts index a7cbe07..63f0b68 100644 --- a/src/auth/LinkedInAuth.ts +++ b/src/auth/LinkedInAuth.ts @@ -1,6 +1,6 @@ import OAuth2Client from "./OAuth2Client"; -import Logger from "../core/Logger"; -import Storage from "../core/Storage"; +import Logger from "../services/Logger"; +import Storage from "../services/Storage"; export default class LinkedInAuth extends OAuth2Client { API_VERSION = "v2"; diff --git a/src/auth/OAuth2Client.ts b/src/auth/OAuth2Client.ts index efc5813..0556f79 100644 --- a/src/auth/OAuth2Client.ts +++ b/src/auth/OAuth2Client.ts @@ -1,7 +1,7 @@ import * as fs from "fs"; import * as http from "http"; import * as url from "url"; -import Storage from "../core/Storage"; +import Storage from "../services/Storage"; class DeferredResponseQuery { promise: Promise<{ [key: string]: string | string[] }>; diff --git a/src/auth/RedditAuth.ts b/src/auth/RedditAuth.ts index 1972c6b..09998d8 100644 --- a/src/auth/RedditAuth.ts +++ b/src/auth/RedditAuth.ts @@ -1,6 +1,6 @@ import OAuth2Client from "./OAuth2Client"; -import Logger from "../core/Logger"; -import Storage from "../core/Storage"; +import Logger from "../services/Logger"; +import Storage from "../services/Storage"; export default class RedditAuth extends OAuth2Client { API_VERSION = "v1"; diff --git a/src/auth/TwitterAuth.ts b/src/auth/TwitterAuth.ts index 0066e25..bc871b1 100644 --- a/src/auth/TwitterAuth.ts +++ b/src/auth/TwitterAuth.ts @@ -1,8 +1,8 @@ import { TwitterApi } from "twitter-api-v2"; import OAuth2Client from "./OAuth2Client"; -import Logger from "../core/Logger"; -import Storage from "../core/Storage"; +import Logger from "../services/Logger"; +import Storage from "../services/Storage"; export default class TwitterAuth extends OAuth2Client { async setup() { diff --git a/src/cli.ts b/src/cli.ts index c848b96..8d44f1d 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -5,9 +5,9 @@ import * as path from "path"; import "./bootstrap-cli"; -import Fairpost from "./core/Fairpost"; -import Logger from "./core/Logger"; -import { PostStatus } from "./core/Post"; +import Fairpost from "./services/Fairpost"; +import Logger from "./services/Logger"; +import { PostStatus } from "./models/Post"; import { PlatformId } from "./platforms"; // arguments diff --git a/src/core/Feed.ts b/src/models/Feed.ts similarity index 99% rename from src/core/Feed.ts rename to src/models/Feed.ts index 658b0e9..1e584f1 100644 --- a/src/core/Feed.ts +++ b/src/models/Feed.ts @@ -1,6 +1,6 @@ import * as fs from "fs"; -import Logger from "./Logger"; -import Storage from "./Storage"; +import Logger from "../services/Logger"; +import Storage from "../services/Storage"; import Platform from "./Platform"; import Folder from "./Folder"; import Post from "./Post"; diff --git a/src/core/Folder.ts b/src/models/Folder.ts similarity index 98% rename from src/core/Folder.ts rename to src/models/Folder.ts index 111ea24..0987069 100644 --- a/src/core/Folder.ts +++ b/src/models/Folder.ts @@ -1,6 +1,6 @@ import * as fs from "fs"; import * as path from "path"; -import Logger from "./Logger"; +import Logger from "../services/Logger"; /** * Folder - a folder within a feed diff --git a/src/core/Platform.ts b/src/models/Platform.ts similarity index 99% rename from src/core/Platform.ts rename to src/models/Platform.ts index 121753a..af0b444 100644 --- a/src/core/Platform.ts +++ b/src/models/Platform.ts @@ -1,5 +1,5 @@ import * as fs from "fs"; -import Logger from "./Logger"; +import Logger from "../services/Logger"; import Folder from "./Folder"; import Post from "./Post"; import { PostStatus } from "./Post"; diff --git a/src/core/Post.ts b/src/models/Post.ts similarity index 98% rename from src/core/Post.ts rename to src/models/Post.ts index a9e39e0..16ea65f 100644 --- a/src/core/Post.ts +++ b/src/models/Post.ts @@ -1,5 +1,5 @@ import * as fs from "fs"; -import Logger from "./Logger"; +import Logger from "../services/Logger"; import Folder from "./Folder"; import Platform from "./Platform"; diff --git a/src/platforms/Ayrshare.ts b/src/platforms/Ayrshare.ts index c424f55..ead73e0 100644 --- a/src/platforms/Ayrshare.ts +++ b/src/platforms/Ayrshare.ts @@ -1,13 +1,13 @@ -import Logger from "../core/Logger"; -import Storage from "../core/Storage"; +import Logger from "../services/Logger"; +import Storage from "../services/Storage"; import * as fs from "fs"; import * as path from "path"; import { randomUUID } from "crypto"; import { PlatformId } from "."; -import Platform from "../core/Platform"; -import Folder from "../core/Folder"; -import Post from "../core/Post"; -import { PostStatus } from "../core/Post"; +import Platform from "../models/Platform"; +import Folder from "../models/Folder"; +import Post from "../models/Post"; +import { PostStatus } from "../models/Post"; /** * Ayrshare base class to extend all ayrshare platforms on diff --git a/src/platforms/Ayrshare/AsFacebook.ts b/src/platforms/Ayrshare/AsFacebook.ts index d566f32..9e9cd6e 100644 --- a/src/platforms/Ayrshare/AsFacebook.ts +++ b/src/platforms/Ayrshare/AsFacebook.ts @@ -1,7 +1,7 @@ import Ayrshare from "../Ayrshare"; import { PlatformId } from ".."; -import Folder from "../../core/Folder"; -import Post from "../../core/Post"; +import Folder from "../../models/Folder"; +import Post from "../../models/Post"; import * as fs from "fs"; import * as sharp from "sharp"; diff --git a/src/platforms/Ayrshare/AsInstagram.ts b/src/platforms/Ayrshare/AsInstagram.ts index f1ca349..571e2c3 100644 --- a/src/platforms/Ayrshare/AsInstagram.ts +++ b/src/platforms/Ayrshare/AsInstagram.ts @@ -1,8 +1,8 @@ -import Logger from "../../core/Logger"; +import Logger from "../../services/Logger"; import Ayrshare from "../Ayrshare"; import { PlatformId } from ".."; -import Folder from "../../core/Folder"; -import Post from "../../core/Post"; +import Folder from "../../models/Folder"; +import Post from "../../models/Post"; import * as sharp from "sharp"; /** diff --git a/src/platforms/Ayrshare/AsLinkedIn.ts b/src/platforms/Ayrshare/AsLinkedIn.ts index 47d291e..0c9fa86 100644 --- a/src/platforms/Ayrshare/AsLinkedIn.ts +++ b/src/platforms/Ayrshare/AsLinkedIn.ts @@ -1,8 +1,8 @@ -import Logger from "../../core/Logger"; +import Logger from "../../services/Logger"; import Ayrshare from "../Ayrshare"; import { PlatformId } from ".."; -import Folder from "../../core/Folder"; -import Post from "../../core/Post"; +import Folder from "../../models/Folder"; +import Post from "../../models/Post"; import * as fs from "fs"; import * as sharp from "sharp"; diff --git a/src/platforms/Ayrshare/AsReddit.ts b/src/platforms/Ayrshare/AsReddit.ts index 5df142c..55c01c2 100644 --- a/src/platforms/Ayrshare/AsReddit.ts +++ b/src/platforms/Ayrshare/AsReddit.ts @@ -1,8 +1,8 @@ import Ayrshare from "../Ayrshare"; import { PlatformId } from ".."; -import Storage from "../../core/Storage"; -import Folder from "../../core/Folder"; -import Post from "../../core/Post"; +import Storage from "../../services/Storage"; +import Folder from "../../models/Folder"; +import Post from "../../models/Post"; /** * AsReddit: support for reddit platform through Ayrshare diff --git a/src/platforms/Ayrshare/AsTikTok.ts b/src/platforms/Ayrshare/AsTikTok.ts index 6d220d9..350480a 100644 --- a/src/platforms/Ayrshare/AsTikTok.ts +++ b/src/platforms/Ayrshare/AsTikTok.ts @@ -1,7 +1,7 @@ import Ayrshare from "../Ayrshare"; import { PlatformId } from ".."; -import Folder from "../../core/Folder"; -import Post from "../../core/Post"; +import Folder from "../../models/Folder"; +import Post from "../../models/Post"; /** * AsTikTok: support for tiktok platform through Ayrshare diff --git a/src/platforms/Ayrshare/AsTwitter.ts b/src/platforms/Ayrshare/AsTwitter.ts index 9da8acb..d6930bc 100644 --- a/src/platforms/Ayrshare/AsTwitter.ts +++ b/src/platforms/Ayrshare/AsTwitter.ts @@ -1,8 +1,8 @@ -import Logger from "../../core/Logger"; +import Logger from "../../services/Logger"; import Ayrshare from "../Ayrshare"; import { PlatformId } from ".."; -import Folder from "../../core/Folder"; -import Post from "../../core/Post"; +import Folder from "../../models/Folder"; +import Post from "../../models/Post"; import * as fs from "fs"; import * as sharp from "sharp"; diff --git a/src/platforms/Ayrshare/AsYouTube.ts b/src/platforms/Ayrshare/AsYouTube.ts index f7f20af..6c01786 100644 --- a/src/platforms/Ayrshare/AsYouTube.ts +++ b/src/platforms/Ayrshare/AsYouTube.ts @@ -1,7 +1,7 @@ import Ayrshare from "../Ayrshare"; import { PlatformId } from ".."; -import Folder from "../../core/Folder"; -import Post from "../../core/Post"; +import Folder from "../../models/Folder"; +import Post from "../../models/Post"; /** * AsYouTube: support for youtube platform through Ayrshare diff --git a/src/platforms/Facebook.ts b/src/platforms/Facebook.ts index 9738396..f1f7f72 100644 --- a/src/platforms/Facebook.ts +++ b/src/platforms/Facebook.ts @@ -1,10 +1,10 @@ -import Storage from "../core/Storage"; -import Logger from "../core/Logger"; -import Platform from "../core/Platform"; +import Storage from "../services/Storage"; +import Logger from "../services/Logger"; +import Platform from "../models/Platform"; import { PlatformId } from "."; -import Folder from "../core/Folder"; -import Post from "../core/Post"; -import { PostStatus } from "../core/Post"; +import Folder from "../models/Folder"; +import Post from "../models/Post"; +import { PostStatus } from "../models/Post"; import FacebookAuth from "../auth/FacebookAuth"; import * as fs from "fs"; import * as path from "path"; diff --git a/src/platforms/Instagram.ts b/src/platforms/Instagram.ts index d79634f..58bd9a9 100644 --- a/src/platforms/Instagram.ts +++ b/src/platforms/Instagram.ts @@ -1,11 +1,11 @@ -import Storage from "../core/Storage"; -import Logger from "../core/Logger"; -import Platform from "../core/Platform"; +import Storage from "../services/Storage"; +import Logger from "../services/Logger"; +import Platform from "../models/Platform"; import InstagramAuth from "../auth/InstagramAuth"; import { PlatformId } from "."; -import Folder from "../core/Folder"; -import Post from "../core/Post"; -import { PostStatus } from "../core/Post"; +import Folder from "../models/Folder"; +import Post from "../models/Post"; +import { PostStatus } from "../models/Post"; import * as fs from "fs"; import * as path from "path"; import * as sharp from "sharp"; diff --git a/src/platforms/LinkedIn.ts b/src/platforms/LinkedIn.ts index 90b348b..4a1b270 100644 --- a/src/platforms/LinkedIn.ts +++ b/src/platforms/LinkedIn.ts @@ -1,11 +1,11 @@ -import Logger from "../core/Logger"; -import Storage from "../core/Storage"; -import Platform from "../core/Platform"; +import Logger from "../services/Logger"; +import Storage from "../services/Storage"; +import Platform from "../models/Platform"; import { PlatformId } from "."; -import Folder from "../core/Folder"; -import Post from "../core/Post"; +import Folder from "../models/Folder"; +import Post from "../models/Post"; import LinkedInAuth from "../auth/LinkedInAuth"; -import { PostStatus } from "../core/Post"; +import { PostStatus } from "../models/Post"; import * as fs from "fs"; //import * as path from "path"; import * as sharp from "sharp"; diff --git a/src/platforms/Reddit.ts b/src/platforms/Reddit.ts index 882d16c..87d8bcc 100644 --- a/src/platforms/Reddit.ts +++ b/src/platforms/Reddit.ts @@ -1,10 +1,10 @@ -import Storage from "../core/Storage"; -import Logger from "../core/Logger"; +import Storage from "../services/Storage"; +import Logger from "../services/Logger"; import RedditAuth from "../auth/RedditAuth"; import { PlatformId } from "."; -import Platform from "../core/Platform"; -import Folder from "../core/Folder"; -import Post, { PostStatus } from "../core/Post"; +import Platform from "../models/Platform"; +import Folder from "../models/Folder"; +import Post, { PostStatus } from "../models/Post"; import * as fs from "fs"; import * as path from "path"; import { XMLParser } from "fast-xml-parser"; diff --git a/src/platforms/Twitter.ts b/src/platforms/Twitter.ts index 1b46ecc..bfce2ec 100644 --- a/src/platforms/Twitter.ts +++ b/src/platforms/Twitter.ts @@ -1,11 +1,11 @@ import { TwitterApi } from "twitter-api-v2"; -import Storage from "../core/Storage"; -import Logger from "../core/Logger"; +import Storage from "../services/Storage"; +import Logger from "../services/Logger"; import TwitterAuth from "../auth/TwitterAuth"; import { PlatformId } from "."; -import Platform from "../core/Platform"; -import Folder from "../core/Folder"; -import Post, { PostStatus } from "../core/Post"; +import Platform from "../models/Platform"; +import Folder from "../models/Folder"; +import Post, { PostStatus } from "../models/Post"; import * as fs from "fs"; import * as sharp from "sharp"; diff --git a/src/core/Fairpost.ts b/src/services/Fairpost.ts similarity index 82% rename from src/core/Fairpost.ts rename to src/services/Fairpost.ts index 2b65923..6eaba60 100644 --- a/src/core/Fairpost.ts +++ b/src/services/Fairpost.ts @@ -1,7 +1,7 @@ import * as fs from "fs"; import * as path from "path"; -import Feed from "./Feed"; -import Platform from "./Platform"; +import Feed from "../models/Feed"; +import Platform from "../models/Platform"; import Storage from "./Storage"; import Logger from "./Logger"; import * as platforms from "../platforms"; @@ -9,8 +9,8 @@ import * as platforms from "../platforms"; /** * Fairpost - singleton service for fairpost app * - * - provides getFeed() - * all the fairpost logic comes from a feed + * - provides the feed, that contains + * all the fairpost logic */ class Fairpost { @@ -56,8 +56,14 @@ class Fairpost { return new Feed(this.platforms.filter((p) => p.active)); } - public fatal(msg: string) { + public error(msg: string) { + Logger.error(msg); + throw new Error(msg); + } + + public fatal(msg: string, code = 1) { Logger.fatal(msg); + process.exitCode = code; throw new Error(msg); } } diff --git a/src/core/Logger.ts b/src/services/Logger.ts similarity index 100% rename from src/core/Logger.ts rename to src/services/Logger.ts diff --git a/src/core/Storage.ts b/src/services/Storage.ts similarity index 100% rename from src/core/Storage.ts rename to src/services/Storage.ts From bb88c108783137aca788f3cb31b460b7bbb21445 Mon Sep 17 00:00:00 2001 From: pike Date: Sun, 3 Dec 2023 19:36:54 +0100 Subject: [PATCH 2/2] chore: Sort imports --- src/cli.ts | 6 ++++-- src/models/Feed.ts | 7 ++++--- src/models/Folder.ts | 1 + src/models/Platform.ts | 5 +++-- src/models/Post.ts | 3 ++- src/platforms/Ayrshare.ts | 11 ++++++----- src/platforms/Ayrshare/AsFacebook.ts | 7 ++++--- src/platforms/Ayrshare/AsInstagram.ts | 7 ++++--- src/platforms/Ayrshare/AsLinkedIn.ts | 9 +++++---- src/platforms/Ayrshare/AsReddit.ts | 4 ++-- src/platforms/Ayrshare/AsTikTok.ts | 2 +- src/platforms/Ayrshare/AsTwitter.ts | 9 +++++---- src/platforms/Ayrshare/AsYouTube.ts | 2 +- src/platforms/Facebook.ts | 13 +++++++------ src/platforms/Instagram.ts | 13 +++++++------ src/platforms/LinkedIn.ts | 13 +++++++------ src/platforms/Reddit.ts | 18 ++++++++++-------- src/platforms/Twitter.ts | 18 ++++++++++-------- src/services/Fairpost.ts | 5 +++-- 19 files changed, 86 insertions(+), 67 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 8d44f1d..dda8c75 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -3,12 +3,14 @@ Fairpost cli handler */ -import * as path from "path"; import "./bootstrap-cli"; + +import * as path from "path"; + import Fairpost from "./services/Fairpost"; import Logger from "./services/Logger"; -import { PostStatus } from "./models/Post"; import { PlatformId } from "./platforms"; +import { PostStatus } from "./models/Post"; // arguments const COMMAND = process.argv[2] ?? "help"; diff --git a/src/models/Feed.ts b/src/models/Feed.ts index 1e584f1..847b873 100644 --- a/src/models/Feed.ts +++ b/src/models/Feed.ts @@ -1,11 +1,12 @@ import * as fs from "fs"; + +import Folder from "./Folder"; import Logger from "../services/Logger"; -import Storage from "../services/Storage"; import Platform from "./Platform"; -import Folder from "./Folder"; +import { PlatformId } from "../platforms"; import Post from "./Post"; import { PostStatus } from "./Post"; -import { PlatformId } from "../platforms"; +import Storage from "../services/Storage"; /** * Feed - the core handler of fairpost diff --git a/src/models/Folder.ts b/src/models/Folder.ts index 0987069..747b11f 100644 --- a/src/models/Folder.ts +++ b/src/models/Folder.ts @@ -1,5 +1,6 @@ import * as fs from "fs"; import * as path from "path"; + import Logger from "../services/Logger"; /** diff --git a/src/models/Platform.ts b/src/models/Platform.ts index af0b444..df44e36 100644 --- a/src/models/Platform.ts +++ b/src/models/Platform.ts @@ -1,9 +1,10 @@ import * as fs from "fs"; -import Logger from "../services/Logger"; + import Folder from "./Folder"; +import Logger from "../services/Logger"; +import { PlatformId } from "../platforms"; import Post from "./Post"; import { PostStatus } from "./Post"; -import { PlatformId } from "../platforms"; /** * Platform base class to extend all platforms on diff --git a/src/models/Post.ts b/src/models/Post.ts index 16ea65f..4664fe7 100644 --- a/src/models/Post.ts +++ b/src/models/Post.ts @@ -1,6 +1,7 @@ import * as fs from "fs"; -import Logger from "../services/Logger"; + import Folder from "./Folder"; +import Logger from "../services/Logger"; import Platform from "./Platform"; /** diff --git a/src/platforms/Ayrshare.ts b/src/platforms/Ayrshare.ts index ead73e0..e08c1a6 100644 --- a/src/platforms/Ayrshare.ts +++ b/src/platforms/Ayrshare.ts @@ -1,13 +1,14 @@ -import Logger from "../services/Logger"; -import Storage from "../services/Storage"; import * as fs from "fs"; import * as path from "path"; -import { randomUUID } from "crypto"; -import { PlatformId } from "."; -import Platform from "../models/Platform"; + import Folder from "../models/Folder"; +import Logger from "../services/Logger"; +import Platform from "../models/Platform"; +import { PlatformId } from "."; import Post from "../models/Post"; import { PostStatus } from "../models/Post"; +import Storage from "../services/Storage"; +import { randomUUID } from "crypto"; /** * Ayrshare base class to extend all ayrshare platforms on diff --git a/src/platforms/Ayrshare/AsFacebook.ts b/src/platforms/Ayrshare/AsFacebook.ts index 9e9cd6e..031c6ca 100644 --- a/src/platforms/Ayrshare/AsFacebook.ts +++ b/src/platforms/Ayrshare/AsFacebook.ts @@ -1,9 +1,10 @@ +import * as fs from "fs"; +import * as sharp from "sharp"; + import Ayrshare from "../Ayrshare"; -import { PlatformId } from ".."; import Folder from "../../models/Folder"; +import { PlatformId } from ".."; import Post from "../../models/Post"; -import * as fs from "fs"; -import * as sharp from "sharp"; /** * AsFacebook: support for facebook platform through Ayrshare diff --git a/src/platforms/Ayrshare/AsInstagram.ts b/src/platforms/Ayrshare/AsInstagram.ts index 571e2c3..d95d552 100644 --- a/src/platforms/Ayrshare/AsInstagram.ts +++ b/src/platforms/Ayrshare/AsInstagram.ts @@ -1,9 +1,10 @@ -import Logger from "../../services/Logger"; +import * as sharp from "sharp"; + import Ayrshare from "../Ayrshare"; -import { PlatformId } from ".."; import Folder from "../../models/Folder"; +import Logger from "../../services/Logger"; +import { PlatformId } from ".."; import Post from "../../models/Post"; -import * as sharp from "sharp"; /** * AsInstagram: support for instagram platform through Ayrshare diff --git a/src/platforms/Ayrshare/AsLinkedIn.ts b/src/platforms/Ayrshare/AsLinkedIn.ts index 0c9fa86..4c662b9 100644 --- a/src/platforms/Ayrshare/AsLinkedIn.ts +++ b/src/platforms/Ayrshare/AsLinkedIn.ts @@ -1,10 +1,11 @@ -import Logger from "../../services/Logger"; +import * as fs from "fs"; +import * as sharp from "sharp"; + import Ayrshare from "../Ayrshare"; -import { PlatformId } from ".."; import Folder from "../../models/Folder"; +import Logger from "../../services/Logger"; +import { PlatformId } from ".."; import Post from "../../models/Post"; -import * as fs from "fs"; -import * as sharp from "sharp"; /** * AsLinkedIn: support for linkedin platform through Ayrshare diff --git a/src/platforms/Ayrshare/AsReddit.ts b/src/platforms/Ayrshare/AsReddit.ts index 55c01c2..054394b 100644 --- a/src/platforms/Ayrshare/AsReddit.ts +++ b/src/platforms/Ayrshare/AsReddit.ts @@ -1,8 +1,8 @@ import Ayrshare from "../Ayrshare"; -import { PlatformId } from ".."; -import Storage from "../../services/Storage"; import Folder from "../../models/Folder"; +import { PlatformId } from ".."; import Post from "../../models/Post"; +import Storage from "../../services/Storage"; /** * AsReddit: support for reddit platform through Ayrshare diff --git a/src/platforms/Ayrshare/AsTikTok.ts b/src/platforms/Ayrshare/AsTikTok.ts index 350480a..2c571c4 100644 --- a/src/platforms/Ayrshare/AsTikTok.ts +++ b/src/platforms/Ayrshare/AsTikTok.ts @@ -1,6 +1,6 @@ import Ayrshare from "../Ayrshare"; -import { PlatformId } from ".."; import Folder from "../../models/Folder"; +import { PlatformId } from ".."; import Post from "../../models/Post"; /** diff --git a/src/platforms/Ayrshare/AsTwitter.ts b/src/platforms/Ayrshare/AsTwitter.ts index d6930bc..ac307d2 100644 --- a/src/platforms/Ayrshare/AsTwitter.ts +++ b/src/platforms/Ayrshare/AsTwitter.ts @@ -1,10 +1,11 @@ -import Logger from "../../services/Logger"; +import * as fs from "fs"; +import * as sharp from "sharp"; + import Ayrshare from "../Ayrshare"; -import { PlatformId } from ".."; import Folder from "../../models/Folder"; +import Logger from "../../services/Logger"; +import { PlatformId } from ".."; import Post from "../../models/Post"; -import * as fs from "fs"; -import * as sharp from "sharp"; /** * AsTwitter: support for twitter platform through Ayrshare diff --git a/src/platforms/Ayrshare/AsYouTube.ts b/src/platforms/Ayrshare/AsYouTube.ts index 6c01786..16f19ab 100644 --- a/src/platforms/Ayrshare/AsYouTube.ts +++ b/src/platforms/Ayrshare/AsYouTube.ts @@ -1,6 +1,6 @@ import Ayrshare from "../Ayrshare"; -import { PlatformId } from ".."; import Folder from "../../models/Folder"; +import { PlatformId } from ".."; import Post from "../../models/Post"; /** diff --git a/src/platforms/Facebook.ts b/src/platforms/Facebook.ts index f1f7f72..f2918d8 100644 --- a/src/platforms/Facebook.ts +++ b/src/platforms/Facebook.ts @@ -1,14 +1,15 @@ -import Storage from "../services/Storage"; +import * as fs from "fs"; +import * as path from "path"; +import * as sharp from "sharp"; + +import FacebookAuth from "../auth/FacebookAuth"; +import Folder from "../models/Folder"; import Logger from "../services/Logger"; import Platform from "../models/Platform"; import { PlatformId } from "."; -import Folder from "../models/Folder"; import Post from "../models/Post"; import { PostStatus } from "../models/Post"; -import FacebookAuth from "../auth/FacebookAuth"; -import * as fs from "fs"; -import * as path from "path"; -import * as sharp from "sharp"; +import Storage from "../services/Storage"; /** * Facebook: support for facebook platform. diff --git a/src/platforms/Instagram.ts b/src/platforms/Instagram.ts index 58bd9a9..e1e2e6c 100644 --- a/src/platforms/Instagram.ts +++ b/src/platforms/Instagram.ts @@ -1,14 +1,15 @@ -import Storage from "../services/Storage"; +import * as fs from "fs"; +import * as path from "path"; +import * as sharp from "sharp"; + +import Folder from "../models/Folder"; +import InstagramAuth from "../auth/InstagramAuth"; import Logger from "../services/Logger"; import Platform from "../models/Platform"; -import InstagramAuth from "../auth/InstagramAuth"; import { PlatformId } from "."; -import Folder from "../models/Folder"; import Post from "../models/Post"; import { PostStatus } from "../models/Post"; -import * as fs from "fs"; -import * as path from "path"; -import * as sharp from "sharp"; +import Storage from "../services/Storage"; /** * Instagram: support for instagram platform. diff --git a/src/platforms/LinkedIn.ts b/src/platforms/LinkedIn.ts index 4a1b270..a5d0ac5 100644 --- a/src/platforms/LinkedIn.ts +++ b/src/platforms/LinkedIn.ts @@ -1,14 +1,15 @@ +import * as fs from "fs"; +//import * as path from "path"; +import * as sharp from "sharp"; + +import Folder from "../models/Folder"; +import LinkedInAuth from "../auth/LinkedInAuth"; import Logger from "../services/Logger"; -import Storage from "../services/Storage"; import Platform from "../models/Platform"; import { PlatformId } from "."; -import Folder from "../models/Folder"; import Post from "../models/Post"; -import LinkedInAuth from "../auth/LinkedInAuth"; import { PostStatus } from "../models/Post"; -import * as fs from "fs"; -//import * as path from "path"; -import * as sharp from "sharp"; +import Storage from "../services/Storage"; export default class LinkedIn extends Platform { id: PlatformId = PlatformId.LINKEDIN; diff --git a/src/platforms/Reddit.ts b/src/platforms/Reddit.ts index 87d8bcc..2dfd851 100644 --- a/src/platforms/Reddit.ts +++ b/src/platforms/Reddit.ts @@ -1,15 +1,17 @@ -import Storage from "../services/Storage"; -import Logger from "../services/Logger"; -import RedditAuth from "../auth/RedditAuth"; -import { PlatformId } from "."; -import Platform from "../models/Platform"; -import Folder from "../models/Folder"; -import Post, { PostStatus } from "../models/Post"; import * as fs from "fs"; import * as path from "path"; -import { XMLParser } from "fast-xml-parser"; import * as sharp from "sharp"; +import Post, { PostStatus } from "../models/Post"; + +import Folder from "../models/Folder"; +import Logger from "../services/Logger"; +import Platform from "../models/Platform"; +import { PlatformId } from "."; +import RedditAuth from "../auth/RedditAuth"; +import Storage from "../services/Storage"; +import { XMLParser } from "fast-xml-parser"; + /** * Reddit: support for reddit platform */ diff --git a/src/platforms/Twitter.ts b/src/platforms/Twitter.ts index bfce2ec..a10bb81 100644 --- a/src/platforms/Twitter.ts +++ b/src/platforms/Twitter.ts @@ -1,14 +1,16 @@ -import { TwitterApi } from "twitter-api-v2"; -import Storage from "../services/Storage"; -import Logger from "../services/Logger"; -import TwitterAuth from "../auth/TwitterAuth"; -import { PlatformId } from "."; -import Platform from "../models/Platform"; -import Folder from "../models/Folder"; -import Post, { PostStatus } from "../models/Post"; import * as fs from "fs"; import * as sharp from "sharp"; +import Post, { PostStatus } from "../models/Post"; + +import Folder from "../models/Folder"; +import Logger from "../services/Logger"; +import Platform from "../models/Platform"; +import { PlatformId } from "."; +import Storage from "../services/Storage"; +import { TwitterApi } from "twitter-api-v2"; +import TwitterAuth from "../auth/TwitterAuth"; + /** * Twitter: support for twitter platform */ diff --git a/src/services/Fairpost.ts b/src/services/Fairpost.ts index 6eaba60..db8080e 100644 --- a/src/services/Fairpost.ts +++ b/src/services/Fairpost.ts @@ -1,10 +1,11 @@ import * as fs from "fs"; import * as path from "path"; +import * as platforms from "../platforms"; + import Feed from "../models/Feed"; +import Logger from "./Logger"; import Platform from "../models/Platform"; import Storage from "./Storage"; -import Logger from "./Logger"; -import * as platforms from "../platforms"; /** * Fairpost - singleton service for fairpost app