Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ jobs:
needs: build
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3.7.0
uses: actions/setup-node@v4
with:
node-version: "18.x"
node-version: "22.x"
- name: Installing dependencies
run: npm install
- name: Download dist
Expand Down
25 changes: 2 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-launch",
"version": "1.5.0",
"version": "1.5.1",
"description": "Launch related operations",
"author": "Contentstack CLI",
"bin": {
Expand Down Expand Up @@ -32,7 +32,6 @@
"chalk": "^4.1.2",
"cross-fetch": "^3.1.8",
"dotenv": "^16.4.7",
"esm": "^3.2.25",
"express": "^4.21.1",
"form-data": "^4.0.0",
"graphql": "^16.9.0",
Expand All @@ -45,7 +44,6 @@
"@oclif/test": "^4.1.3",
"@types/adm-zip": "^0.5.7",
"@types/chai": "^4.3.20",
"@types/esm": "^3.2.2",
"@types/ini": "^1.3.34",
"@types/lodash": "^4.17.13",
"@types/mocha": "^10.0.10",
Expand Down
10 changes: 3 additions & 7 deletions src/util/cloud-function/cloud-functions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import dotenv from 'dotenv';
import esm from 'esm';
import express, {
Request,
Response,
Expand Down Expand Up @@ -70,13 +69,11 @@ export class CloudFunctions {
cloudFunctionResources: CloudFunctionResource[],
app: Express
): Promise<void> {
const loadAsESM = esm(module);

await Promise.all(
cloudFunctionResources.map(async (cloudFunctionResource) => {
const handler = loadAsESM(
const handler = await import(
`${cloudFunctionResource.cloudFunctionFilePath}`
).default;
);
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

Expand Down Expand Up @@ -182,12 +179,11 @@ export class CloudFunctions {

private async checkDefaultExport(filepath: string): Promise<boolean> {
const exportType = "function";
const loadAsESM = esm(module);
const fullPath = normalize(path.resolve(process.cwd(), filepath)).replace(
/^(\.\.(\/|\\|$))+/,
""
);
const handler = await loadAsESM(fullPath);
const handler = await import(fullPath);

return typeof handler.default === exportType;
}
Expand Down