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

fix: splitting compile into separate esm and cjs dists #111

Merged
merged 9 commits into from
Aug 28, 2023

Conversation

aorumbayev
Copy link
Contributor

@aorumbayev aorumbayev commented Aug 24, 2023

Proposed changes

@aorumbayev aorumbayev marked this pull request as ready for review August 24, 2023 20:00
@aorumbayev aorumbayev self-assigned this Aug 24, 2023
tsconfig.cjs.json Outdated Show resolved Hide resolved
tsconfig.esm.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@aorumbayev
Copy link
Contributor Author

@PhearZero thanks for PR review! feel free to check how your comments were addressed,

@tristanmenzel i tested it against generator ts and it works fine but i had to tweak build:3-copy-pkg-json to put paths to dedicated folders for main and types records, also needed to explicitly include exports section otherwise importing from testing folder wouldn't work

Copy link
Member

@PhearZero PhearZero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working example of what ./dist/package.json should look like.

{
  "main": "./cjs/index.js",
  "module": "./esm/index.js",
  "types": "./types/index.d.ts",
  "name": "@algorandfoundation/algokit-utils",
  "version": "0.1.0",
  "private": false,
  "description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
  "author": "Algorand Foundation",
  "typesVersions": {
    "*": {
      ".": [
        "types/index.d.ts"
      ],
      "types/app": [
        "types/types/app.d.ts"
      ],
      "types/app-client": [
        "types/types/app-client.d.ts"
      ],
      "types/app-spec": [
        "types/types/app-spec.d.ts"
      ],
      "types/transaction": [
        "types/types/transaction.d.ts"
      ]
    }
  },
  "license": "MIT",
  "engines": {
    "node": ">=16.0"
  },
  "files": [
    "**/*"
  ],
  "exports": {
    ".": {
      "import": "./esm/index.js",
      "require": "./cjs/index.js",
      "types": "./types/index.d.ts"
    },
    "./testing": {
      "import": "./esm/testing/index.js",
      "require": "./cjs/testing/index.js",
      "types": "./types/testing/index.d.ts"
    },
    "./index.d.ts": "./types/index.d.ts",
    "./package.json": "./package.json"
  },
  "overrides": {
    "semver": "7.5.2"
  },
  "dependencies": {
    "algosdk": "^2.3.0",
    "buffer": "^6.0.3"
  }
}

package.json Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
@aorumbayev aorumbayev requested a review from PhearZero August 25, 2023 15:49
Copy link
Member

@PhearZero PhearZero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🕺🏻

@aorumbayev
Copy link
Contributor Author

thanks @PhearZero will await for @tristanmenzel to take a peek and will merge this early next week 👍

@tristanmenzel
Copy link
Contributor

LGTM @aorumbayev! :shipit:

@aorumbayev aorumbayev merged commit 8867757 into main Aug 28, 2023
@aorumbayev aorumbayev deleted the split_esm_cjs_builds branch August 28, 2023 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants