Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/storage/collab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function saveCollab(data: CollabSchema): void {
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true });
}
writeFileSync(collabPath, JSON.stringify(data, null, 2));
writeFileSync(collabPath, JSON.stringify(data, null, 2) + '\n');
}

export const collabStorage = {
Expand Down
2 changes: 1 addition & 1 deletion src/storage/snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function loadMeta(problemId: string): SnapshotMeta {

function saveMeta(problemId: string, meta: SnapshotMeta): void {
ensureSnapshotDir(problemId);
writeFileSync(getMetaPath(problemId), JSON.stringify(meta, null, 2));
writeFileSync(getMetaPath(problemId), JSON.stringify(meta, null, 2) + '\n');
}

export const snapshotStorage = {
Expand Down
2 changes: 1 addition & 1 deletion src/storage/timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function saveTimer(data: TimerSchema): void {
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true });
}
writeFileSync(timerPath, JSON.stringify(data, null, 2));
writeFileSync(timerPath, JSON.stringify(data, null, 2) + '\n');
}

export const timerStorage = {
Expand Down
2 changes: 1 addition & 1 deletion src/storage/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function loadCache(): VersionCache | null {

function saveCache(cache: VersionCache): void {
ensureDir();
writeFileSync(VERSION_FILE, JSON.stringify(cache, null, 2));
writeFileSync(VERSION_FILE, JSON.stringify(cache, null, 2) + '\n');
}

export const versionStorage = {
Expand Down
10 changes: 5 additions & 5 deletions src/storage/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function loadRegistry(): WorkspaceRegistry {

function saveRegistry(registry: WorkspaceRegistry): void {
ensureDir(LEETCODE_DIR);
writeFileSync(WORKSPACES_FILE, JSON.stringify(registry, null, 2));
writeFileSync(WORKSPACES_FILE, JSON.stringify(registry, null, 2) + '\n');
}

function normalizeWorkspaceName(name: string): string | null {
Expand Down Expand Up @@ -154,14 +154,14 @@ export const workspaceStorage = {

// Write config
const configPath = join(wsDir, 'config.json');
writeFileSync(configPath, JSON.stringify(config, null, 2));
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');

// Initialize empty timer and collab
writeFileSync(
join(wsDir, 'timer.json'),
JSON.stringify({ solveTimes: {}, activeTimer: null }, null, 2)
JSON.stringify({ solveTimes: {}, activeTimer: null }, null, 2) + '\n'
);
writeFileSync(join(wsDir, 'collab.json'), JSON.stringify({ session: null }, null, 2));
writeFileSync(join(wsDir, 'collab.json'), JSON.stringify({ session: null }, null, 2) + '\n');

// Update registry
registry.workspaces.push(wsName);
Expand Down Expand Up @@ -233,7 +233,7 @@ export const workspaceStorage = {
const currentConfig = this.getConfig(wsName);
const newConfig = { ...currentConfig, ...config };

writeFileSync(join(wsDir, 'config.json'), JSON.stringify(newConfig, null, 2));
writeFileSync(join(wsDir, 'config.json'), JSON.stringify(newConfig, null, 2) + '\n');
},

/**
Expand Down
Loading