Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
fix: convert to ESM Module
Browse files Browse the repository at this point in the history
BREAKING CHANGE: convert to ESM Module
  • Loading branch information
salzig authored and eshepelyuk committed Aug 3, 2023
1 parent 8a66eb1 commit 3655830
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
14 changes: 6 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const verifyChart = require('./lib/verifyConditions');
const prepareChart = require('./lib/prepare');
const publishChart = require('./lib/publish');
import verifyChart from './lib/verifyConditions.js';
import prepareChart from './lib/prepare.js';
import publishChart from './lib/publish.js';

let verified = false;
let prepared = false;

async function verifyConditions(pluginConfig, context) {
export async function verifyConditions(pluginConfig, context) {
await verifyChart(pluginConfig, context);
verified = true;
}

async function prepare(pluginConfig, context) {
export async function prepare(pluginConfig, context) {
if (!verified) {
await verifyChart(pluginConfig, context);
}
Expand All @@ -19,7 +19,7 @@ async function prepare(pluginConfig, context) {
prepared = true;
}

async function publish(pluginConfig, context) {
export async function publish(pluginConfig, context) {
if (!verified) {
await verifyChart(pluginConfig, context);
}
Expand All @@ -29,5 +29,3 @@ async function publish(pluginConfig, context) {

await publishChart(pluginConfig, context);
}

module.exports = {verifyConditions, prepare, publish};
8 changes: 4 additions & 4 deletions lib/prepare.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const fsPromises = require('fs').promises;
const execa = require('execa');
const yaml = require('js-yaml');
import fsPromises from 'fs/promises';
import execa from 'execa';
import yaml from 'js-yaml';

module.exports = async (pluginConfig, context) => {
export default async (pluginConfig, context) => {
const {logger, nextRelease: {version}} = context;

const ch = yaml.load(await fsPromises.readFile("./Chart.yaml"));
Expand Down
8 changes: 4 additions & 4 deletions lib/publish.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const fsPromises = require('fs').promises;
const yaml = require('js-yaml');
const execa = require('execa');
import fsPromises from 'fs/promises';
import yaml from 'js-yaml';
import execa from 'execa';

module.exports = async (pluginConfig, context) => {
export default async (pluginConfig, context) => {
const {logger, nextRelease: {version}} = context;

const ch = yaml.load(await fsPromises.readFile("./Chart.yaml"));
Expand Down
8 changes: 4 additions & 4 deletions lib/verifyConditions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { URL } = require('url');
const execa = require('execa');
const SemanticReleaseError = require("@semantic-release/error");
import { URL } from 'url';
import execa from 'execa';
import SemanticReleaseError from "@semantic-release/error";

module.exports = async (pluginConfig, context) => {
export default async (pluginConfig, context) => {
const {env, logger} = context;

const registryURL = parseRegistryURL(pluginConfig.registry, logger);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "0.0.0",
"description": "semantic-release plugin for publishing Helm charts to OCI registries",
"repository": "github:eshepelyuk/semantic-release-helm-oci",
"main": "index.js",
"exports": "./index.js",
"type": "module",
"files": [
"index.js",
"lib/**/*.js"
Expand Down

0 comments on commit 3655830

Please sign in to comment.