From 322287c3da6e62542f6a2e5fe2f1839cb495d420 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Mon, 3 Oct 2022 21:16:09 +0000 Subject: [PATCH] [BUG] Plugin helpers fix related to fs promises module In Node v10, there was no dedicated module for fs/promises. Causing the plugin helpers to fail while building out plugins. Solved by importing promises from fs then using the desired methods. Issue Resolved: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2485 Signed-off-by: Kawika Avilla --- CHANGELOG.md | 2 ++ packages/osd-plugin-helpers/src/tasks/update_versions.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfb9dfa9cc02..71bce27c18f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### 🐛 Bug Fixes +* Plugin helpers fix related to fs promises module ([#2486](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2486)) + ### 🚞 Infrastructure ### 📝 Documentation diff --git a/packages/osd-plugin-helpers/src/tasks/update_versions.ts b/packages/osd-plugin-helpers/src/tasks/update_versions.ts index 0acfa12c9091..d9009c3afeca 100644 --- a/packages/osd-plugin-helpers/src/tasks/update_versions.ts +++ b/packages/osd-plugin-helpers/src/tasks/update_versions.ts @@ -4,11 +4,13 @@ */ // @ts-ignore -import { readFile, writeFile } from 'fs/promises'; +import { promises } from 'fs'; import path from 'path'; import { createFailError } from '@osd/dev-utils'; import { FileUpdateContext, ObjectUpdateContext, VersionContext } from '../contexts'; +const { readFile, writeFile } = promises; + export async function updateVersions({ log, sourceDir,