From 5db681854253ef392de1ea9077cb06cab166d96e Mon Sep 17 00:00:00 2001 From: dessant Date: Fri, 10 Nov 2023 05:09:37 +0200 Subject: [PATCH] chore: migrate package to ESM --- package.json | 1 + src/data.js | 2 +- src/index.js | 12 ++++++------ src/schema.js | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index cfc0af2..5e8ad5c 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "bugs": { "url": "https://github.com/dessant/label-actions/issues" }, + "type": "module", "main": "src/index.js", "scripts": { "build": "ncc build src/index.js -o dist", diff --git a/src/data.js b/src/data.js index 7da2f0f..a6008ad 100644 --- a/src/data.js +++ b/src/data.js @@ -118,7 +118,7 @@ mutation ($lockableId: ID!) { } `; -module.exports = { +export { addDiscussionCommentQuery, getLabelQuery, createLabelQuery, diff --git a/src/index.js b/src/index.js index 1261711..8c2579e 100644 --- a/src/index.js +++ b/src/index.js @@ -1,9 +1,9 @@ -const core = require('@actions/core'); -const github = require('@actions/github'); -const yaml = require('js-yaml'); +import core from '@actions/core'; +import github from '@actions/github'; +import yaml from 'js-yaml'; -const {configSchema, actionSchema} = require('./schema'); -const { +import {configSchema, actionSchema} from './schema.js'; +import { addDiscussionCommentQuery, getLabelQuery, createLabelQuery, @@ -14,7 +14,7 @@ const { reopenDiscussionQuery, lockLockableQuery, unlockLockableQuery -} = require('./data'); +} from './data.js'; async function run() { try { diff --git a/src/schema.js b/src/schema.js index db244e4..815e642 100644 --- a/src/schema.js +++ b/src/schema.js @@ -1,4 +1,4 @@ -const Joi = require('joi'); +import Joi from 'joi'; const extendedJoi = Joi.extend(joi => { return { @@ -144,4 +144,4 @@ const actionSchema = Joi.object() .min(1) .max(200); -module.exports = {configSchema, actionSchema}; +export {configSchema, actionSchema};