Skip to content

Commit

Permalink
chore(deps): use yaml rather than js-yaml
Browse files Browse the repository at this point in the history
it has a more similar API to JSON.stringify etc., and its serialization is closer to our yaml style
  • Loading branch information
marcelgerber committed May 17, 2024
1 parent 4dfae78 commit 1263993
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions adminSiteClient/EditorHistoryTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ChartEditor, Log } from "./ChartEditor.js"
import { Section, Timeago } from "./Forms.js"
import { computed, action, observable } from "mobx"
import { copyToClipboard } from "@ourworldindata/utils"
import { dump } from "js-yaml"
import YAML from "yaml"
import { notification, Modal } from "antd"
import ReactDiffViewer, { DiffMethod } from "react-diff-viewer"

Expand Down Expand Up @@ -136,7 +136,7 @@ export class EditorHistoryTab extends React.Component<{ editor: ChartEditor }> {
delete chartConfigObject.dimensions
delete chartConfigObject.version
delete chartConfigObject.isPublished
const chartConfigAsYaml = dump(chartConfigObject)
const chartConfigAsYaml = YAML.stringify(chartConfigObject)
void copyToClipboard(chartConfigAsYaml)
notification["success"]({
message: "Copied YAML to clipboard",
Expand Down
4 changes: 2 additions & 2 deletions adminSiteClient/VariableEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
autorun,
IReactionDisposer,
} from "mobx"
import { dump } from "js-yaml"
import YAML from "yaml"
import * as lodash from "lodash"
import { Prompt, Redirect } from "react-router-dom"
import { AdminLayout } from "./AdminLayout.js"
Expand Down Expand Up @@ -368,7 +368,7 @@ class VariableEditor extends React.Component<{ variable: VariablePageData }> {
label="Grapher Config ETL"
field="v"
store={{
v: dump(
v: YAML.stringify(
newVariable.presentation
.grapherConfigETL
),
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@
"instantsearch.js": "^4.68.0",
"js-base64": "^3.7.2",
"js-cookie": "^3.0.1",
"js-yaml": "^4.1.0",
"json8-pointer": "^1.0.6",
"jsonwebtoken": "^9.0.0",
"knex": "^3.1.0",
Expand Down Expand Up @@ -216,7 +215,8 @@
"url-parse": "^1.5.10",
"url-slug": "^3.0.2",
"webfontloader": "^1.6.28",
"workerpool": "^6.2.0"
"workerpool": "^6.2.0",
"yaml": "^2.4.2"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240512.0",
Expand All @@ -227,7 +227,6 @@
"@types/indefinite": "^2.3.2",
"@types/ini": "^4",
"@types/jest": "^29.5.5",
"@types/js-yaml": "^4.0.5",
"@types/topojson-server": "^3.0.1",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
Expand Down
21 changes: 11 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5026,13 +5026,6 @@ __metadata:
languageName: node
linkType: hard

"@types/js-yaml@npm:^4.0.5":
version: 4.0.5
resolution: "@types/js-yaml@npm:4.0.5"
checksum: 10/6fff5f47d97070f1a01022517ce4bd81a0cfac7cd30f9dbc7222dc5f8db4bfe5f5c8cba3f4b02bdbd6f31f691050db97395b33c8df66d1e7c4f66096b41a3df6
languageName: node
linkType: hard

"@types/jsdom@npm:^20.0.0":
version: 20.0.0
resolution: "@types/jsdom@npm:20.0.0"
Expand Down Expand Up @@ -11049,7 +11042,6 @@ __metadata:
"@types/ini": "npm:^4"
"@types/jest": "npm:^29.5.5"
"@types/js-cookie": "npm:^3.0.2"
"@types/js-yaml": "npm:^4.0.5"
"@types/jsonwebtoken": "npm:^9.0.0"
"@types/lodash": "npm:^4.17.0"
"@types/md5": "npm:^2.3.2"
Expand Down Expand Up @@ -11127,7 +11119,6 @@ __metadata:
jest-environment-jsdom: "npm:^29.7.0"
js-base64: "npm:^3.7.2"
js-cookie: "npm:^3.0.1"
js-yaml: "npm:^4.1.0"
json8-pointer: "npm:^1.0.6"
jsonwebtoken: "npm:^9.0.0"
knex: "npm:^3.1.0"
Expand Down Expand Up @@ -11208,6 +11199,7 @@ __metadata:
webfontloader: "npm:^1.6.28"
workerpool: "npm:^6.2.0"
wrangler: "npm:3.55.0"
yaml: "npm:^2.4.2"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -20788,7 +20780,7 @@ __metadata:
languageName: node
linkType: hard

"yaml@npm:2.3.4, yaml@npm:^2.1.1":
"yaml@npm:2.3.4":
version: 2.3.4
resolution: "yaml@npm:2.3.4"
checksum: 10/f8207ce43065a22268a2806ea6a0fa3974c6fde92b4b2fa0082357e487bc333e85dc518910007e7ac001b532c7c84bd3eccb6c7757e94182b564028b0008f44b
Expand All @@ -20802,6 +20794,15 @@ __metadata:
languageName: node
linkType: hard

"yaml@npm:^2.1.1, yaml@npm:^2.4.2":
version: 2.4.2
resolution: "yaml@npm:2.4.2"
bin:
yaml: bin.mjs
checksum: 10/6eafbcd68dead734035f6f72af21bd820c29214caf7d8e40c595671a3c908535cef8092b9660a1c055c5833aa148aa640e0c5fa4adb5af2dacd6d28296ccd81c
languageName: node
linkType: hard

"yargs-parser@npm:20.2.4":
version: 20.2.4
resolution: "yargs-parser@npm:20.2.4"
Expand Down

0 comments on commit 1263993

Please sign in to comment.