social-light 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,9 +19,6 @@ An AI-powered social media scheduling tool for Bluesky with CLI and web interfac
19
19
 
20
20
  [Node.js/npm](https://nodejs.org) must be installed on your system
21
21
 
22
- > [!WARNING]
23
- > There's a know issues with the latest version of Node.js (v23) and 'better-sqlite3'. Please use Node.js v22 (LTS) or lower.
24
-
25
22
  ## Accounts
26
23
 
27
24
  You will need an account on [blue sky](https://bsky.app) and an [OpenAI](https://openai.com) account to use the AI features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-light",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "AI-powered social media scheduling tool",
5
5
  "main": "src/index.mjs",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "ai": "^2.2.31",
27
- "better-sqlite3": "^9.3.0",
27
+ "better-sqlite3": "^11.9.1",
28
28
  "chalk": "^5.3.0",
29
29
  "cors": "^2.8.5",
30
30
  "dotenv": "^16.3.1",
@@ -3,7 +3,6 @@ import ora from "ora";
3
3
  import inquirer from "inquirer";
4
4
  import fs from "fs-extra";
5
5
  import path from "path";
6
- import os from "os";
7
6
  import dotenv from "dotenv";
8
7
 
9
8
  import {
@@ -0,0 +1,114 @@
1
+ import chalk from "chalk";
2
+ import ora from "ora";
3
+ import inquirer from "inquirer";
4
+ import fs from "fs-extra";
5
+ import path from "path";
6
+ import dotenv from "dotenv";
7
+ import os from "os";
8
+
9
+ import { configExists } from "../utils/config.mjs";
10
+
11
+ // Load environment variables
12
+ dotenv.config();
13
+
14
+ /**
15
+ * Remove the Social Light application configuration
16
+ * @example
17
+ * await uninitialize();
18
+ */
19
+ export const uninitialize = async () => {
20
+ const spinner = ora("Removing Social Light...").start();
21
+ const deletedFiles = [];
22
+
23
+ try {
24
+ const exists = configExists();
25
+
26
+ // If config already prompt for confirmation
27
+ if (exists) {
28
+ spinner.stop();
29
+
30
+ const { confirm } = await inquirer.prompt([
31
+ {
32
+ type: "confirm",
33
+ name: "confirm",
34
+ message: "Delete Social Light configuration?",
35
+ default: false,
36
+ },
37
+ ]);
38
+
39
+ if (!confirm) {
40
+ console.log(chalk.yellow("Unitialization cancelled."));
41
+ return;
42
+ }
43
+
44
+ spinner.start("Removing Social Light configuration...");
45
+
46
+ // Remove configuration file in current directory
47
+ const configPath = path.join(process.cwd(), "config.json");
48
+ if (fs.existsSync(configPath)) {
49
+ fs.removeSync(configPath);
50
+ deletedFiles.push(configPath);
51
+ spinner.text = "Configuration file removed...";
52
+ }
53
+
54
+ // Remove database files
55
+ const dbDir = path.join(process.cwd(), "data");
56
+ if (fs.existsSync(dbDir)) {
57
+ fs.removeSync(dbDir);
58
+ deletedFiles.push(dbDir);
59
+ spinner.text = "Database files removed...";
60
+ }
61
+
62
+ // Remove configuration in $HOME/.social-light directory
63
+ const homeSocialLightDir = path.join(os.homedir(), ".social-light");
64
+ if (fs.existsSync(homeSocialLightDir)) {
65
+ // Get list of files before deletion for reporting
66
+ const configFiles = fs
67
+ .readdirSync(homeSocialLightDir)
68
+ .map((file) => path.join(homeSocialLightDir, file));
69
+
70
+ // Add them to deleted files list
71
+ deletedFiles.push(...configFiles);
72
+
73
+ // Remove the directory and all contents
74
+ fs.removeSync(homeSocialLightDir);
75
+ spinner.text = "Home social-light directory removed...";
76
+ }
77
+
78
+ // Clean environment variables related to Social Light
79
+ const envPath = path.join(process.cwd(), ".env");
80
+ if (fs.existsSync(envPath)) {
81
+ fs.removeSync(envPath);
82
+ deletedFiles.push(envPath);
83
+ spinner.text = "Environment file removed...";
84
+ }
85
+
86
+ spinner.succeed("Social Light configuration removed successfully!");
87
+
88
+ // Print list of deleted files
89
+ console.log(
90
+ chalk.green("\n✓ All Social Light configurations have been removed.")
91
+ );
92
+
93
+ if (deletedFiles.length > 0) {
94
+ console.log(chalk.cyan("\nDeleted files and directories:"));
95
+ deletedFiles.forEach((file) => {
96
+ console.log(chalk.gray(` • ${file}`));
97
+ });
98
+ }
99
+
100
+ console.log(
101
+ chalk.cyan("\nYou can reinitialize anytime with:"),
102
+ chalk.cyan("social-light init")
103
+ );
104
+ return;
105
+ }
106
+
107
+ spinner.info("Not initialized. No configuration to remove.");
108
+ return;
109
+ } catch (error) {
110
+ spinner.fail(`Unintialization failed: ${error.message}`);
111
+ console.error(chalk.red("Error details:"), error);
112
+ process.exit(1);
113
+ }
114
+ };
package/src/index.mjs CHANGED
@@ -10,6 +10,7 @@ import { hideBin } from "yargs/helpers";
10
10
  import chalk from "chalk";
11
11
 
12
12
  import { initialize } from "./commands/init.mjs";
13
+ import { uninitialize } from "./commands/uninit.mjs";
13
14
  import { createPost } from "./commands/create.mjs";
14
15
 
15
16
  import { list } from "./commands/list.mjs";
@@ -41,6 +42,7 @@ const main = async () => {
41
42
  console.log(NPMPackage.version);
42
43
  })
43
44
  .command("init", "Initialize Social Light configuration", {}, initialize)
45
+ .command("uninit", "Remove Social Light configuration", {}, uninitialize)
44
46
  .command(
45
47
  "create",
46
48
  "Create a new social media post",