Skip to content

Commit

Permalink
Only compile CJS
Browse files Browse the repository at this point in the history
Fix ESM tests
  • Loading branch information
jtsmedley committed Feb 2, 2024
1 parent 4a49af3 commit 0bcfccb
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dist
node_modules
documentation
.env
.env
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"import": "./src/index.mjs",
"types": "./dist/index.d.ts"
}
},
"files": [
"dist",
"src"
],
"engines": {
"node": ">=16.0.0",
"npm": ">=8.0.0"
},
"scripts": {
"build": "tsup src/index.js --format cjs,esm --dts --clean",
"build": "tsup src/index.js --format cjs --dts --clean",
"test": "node --test",
"doc": "jsdoc -c jsdoc.json"
},
Expand Down
3 changes: 3 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
8 changes: 4 additions & 4 deletions test/bucketManager.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import test from "node:test";
import assert from "node:assert/strict";
import { BucketManager } from "../dist/index.mjs";
import { BucketManager } from "../src/index.js";

const TEST_PREFIX = Date.now();

test("create bucket", async (t) => {
test("create bucket", async () => {
// Initialize BucketManager
const bucketManager = new BucketManager(
process.env.TEST_S3_KEY || process.env.TEST_KEY,
Expand Down Expand Up @@ -51,7 +51,7 @@ test("list buckets", async () => {
);
});

test("delete bucket", async (t) => {
test("delete bucket", async () => {
// Initialize BucketManager
const bucketManager = new BucketManager(
process.env.TEST_S3_KEY || process.env.TEST_KEY,
Expand Down Expand Up @@ -82,7 +82,7 @@ test("delete bucket", async (t) => {
assert.equal(typeof deletedBucket, "undefined");
});

test("set bucket privacy to public", async (t) => {
test("set bucket privacy to public", async () => {
// Initialize BucketManager
const bucketManager = new BucketManager(
process.env.TEST_S3_KEY || process.env.TEST_KEY,
Expand Down
2 changes: 1 addition & 1 deletion test/gatewayManager.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { GatewayManager } from "../dist/index.mjs";
import { GatewayManager } from "../src/index.js";

const TEST_PREFIX = Date.now();

Expand Down
2 changes: 1 addition & 1 deletion test/nameManager.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { NameManager } from "../dist/index.mjs";
import { NameManager } from "../src/index.js";

const TEST_CID = process.env.TEST_NAME_CID,
TEST_PRIVATE_KEY = process.env.TEST_NAME_PRIVATE_KEY,
Expand Down
2 changes: 1 addition & 1 deletion test/objectManager.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { ObjectManager, BucketManager } from "../dist/index.mjs";
import { ObjectManager, BucketManager } from "../src/index.js";
import * as Path from "node:path";
import { writeFile } from "node:fs/promises";
import { v4 as uuidv4 } from "uuid";
Expand Down
3 changes: 3 additions & 0 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
2 changes: 1 addition & 1 deletion test/pinManager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { v4 as uuidv4 } from "uuid";
import Path from "node:path";
import os from "node:os";
import { writeFile } from "node:fs/promises";
import { BucketManager } from "../dist/index.mjs";
import { BucketManager } from "../src/index.js";

const TEST_CID_1 = "QmSEu6zGwKgkQA3ZKaDnvkrwre1kkQa7eRFCbQi7waNwTT",
TEST_CID_2 = "QmNXcMdXadLRTxLpHJMsGnaeKz26d2F6NgUDVWScp54EfC",
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export default defineConfig({
sourcemap: false,
noExternal: ['@ipld/car', '@helia/car', '@helia/unixfs', 'blockstore-fs'],
dts: true,
format: ['cjs', 'esm'],
format: ['cjs'],
clean: true,
})

0 comments on commit 0bcfccb

Please sign in to comment.