Skip to content

Commit

Permalink
Add warning before importing data
Browse files Browse the repository at this point in the history
  • Loading branch information
Siilwyn committed Dec 8, 2023
1 parent 366cc02 commit 7c35ddf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/import-spaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import fs from "node:fs/promises";
import * as readline from "node:readline/promises";
import { stderr, stdin, stdout } from "node:process";
import { parse } from "csv-parse/sync";
import { buildClient } from "@datocms/cma-client-node";
import * as dotenv from "dotenv";
Expand Down Expand Up @@ -69,6 +71,13 @@ fs.readFile("./src/data/studieplekken.csv")
}),
)
.then(async (parsedData) => {
const terminalInterface = readline.createInterface({ input: stdin, output: stdout });
await terminalInterface.question(`
Are you sure you want to import all CSV data to the environment "${datocmsEnvironment}"?
Press Enter to continue.
`);
terminalInterface.close();

const spaceModelId = "2040795";
const buildings = await client.items.list({
filter: { type: "building" },
Expand Down

0 comments on commit 7c35ddf

Please sign in to comment.