Skip to content

Commit

Permalink
use atomically instead of write-file-atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Jun 15, 2022
1 parent ef49aa2 commit ce35111
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
6 changes: 3 additions & 3 deletions app/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from 'mz/fs'
import * as path from 'path'
import * as yaml from 'js-yaml'
import { app } from 'electron'
import writeFileAtomic from 'write-file-atomic'
import { writeFile } from 'atomically'


export function migrateConfig (): void {
Expand Down Expand Up @@ -30,6 +30,6 @@ export function loadConfig (): any {
const configPath = path.join(app.getPath('userData'), 'config.yaml')

export async function saveConfig (content: string): Promise<void> {
await writeFileAtomic(configPath, content, { encoding: 'utf8' })
await writeFileAtomic(configPath + '.backup', content, { encoding: 'utf8' })
await writeFile(configPath, content, { encoding: 'utf8' })
await writeFile(configPath + '.backup', content, { encoding: 'utf8' })
}
5 changes: 2 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@
"devDependencies": {
"@types/mz": "2.7.4",
"@types/node": "16.0.1",
"@types/write-file-atomic": "^4.0.0",
"atomically": "^1.7.0",
"ngx-filesize": "^2.0.16",
"patch-package": "^6.4.7",
"write-file-atomic": "^4.0.1"
"patch-package": "^6.4.7"
},
"peerDependencies": {
"tabby-community-color-schemes": "*",
Expand Down
25 changes: 5 additions & 20 deletions app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,6 @@
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.9.tgz#152c6c20a7688c30b967ec1841d31ace569863fc"
integrity sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ==

"@types/write-file-atomic@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/write-file-atomic/-/write-file-atomic-4.0.0.tgz#ffcedcb1ae027e0a28ddfe218b72b3573797b5bc"
integrity sha512-piEKt2KKBUtye+feTlfdPjtW7uPFsAaLNX3/f6AJD+Y1T1YPTFwnqtlO9Y+gy9qGshrvxKa/Kay9vqbyVIuhwQ==
dependencies:
"@types/node" "*"

"@yarnpkg/lockfile@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31"
Expand Down Expand Up @@ -317,6 +310,11 @@ asynckit@^0.4.0:
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=

atomically@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/atomically/-/atomically-1.7.0.tgz#c07a0458432ea6dbc9a3506fffa424b48bccaafe"
integrity sha512-Xcz9l0z7y9yQ9rdDaxlmaI4uJHf/T8g9hOEzJcsEqX2SjCj4J20uK7+ldkDHMbpJDK76wF7xEIgxc/vSlsfw5w==

aws-sign2@~0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz"
Expand Down Expand Up @@ -3308,11 +3306,6 @@ signal-exit@^3.0.0, signal-exit@^3.0.2:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz"
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==

signal-exit@^3.0.7:
version "3.0.7"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==

simple-concat@^1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz"
Expand Down Expand Up @@ -3946,14 +3939,6 @@ write-file-atomic@^2.0.0, write-file-atomic@^2.3.0, write-file-atomic@^2.4.3:
imurmurhash "^0.1.4"
signal-exit "^3.0.2"

write-file-atomic@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.1.tgz#9faa33a964c1c85ff6f849b80b42a88c2c537c8f"
integrity sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ==
dependencies:
imurmurhash "^0.1.4"
signal-exit "^3.0.7"

x11@^2.3.0:
version "2.3.0"
resolved "https://registry.npmjs.org/x11/-/x11-2.3.0.tgz"
Expand Down

0 comments on commit ce35111

Please sign in to comment.