Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include dual ESM/CJS package exports #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dist
.eslintcache
*.log*
*.env*
.idea/
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
Expand Down
13 changes: 7 additions & 6 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ describe("nanotar", () => {
it("createTar", async () => {
const data = await createTarGzip(fixture);
expect(data).toBeInstanceOf(Uint8Array);
expect(execSync("tar -ctvf-", { input: data }).toString())
const create = process.platform === "win32" ? "-tvf-" : "-ctvf-";
expect(execSync(`tar ${create}`, { input: data }).toString())
.toMatchInlineSnapshot(`
"-rw-rw-r-- 0 1000 1000 12 Nov 14 23:13 hello.txt
drwxrwxr-x 0 1001 1001 0 Nov 14 23:13 test
-rw-rw-r-- 0 1000 1000 12 Nov 14 23:13 foo/bar.txt
"
`);
"-rw-rw-r-- 0 1000 1000 12 nov. 14 23:13 hello.txt
drwxrwxr-x 0 1001 1001 0 nov. 14 23:13 test
-rw-rw-r-- 0 1000 1000 12 nov. 14 23:13 foo/bar.txt
"
`);
});

it("parseTar", async () => {
Expand Down