diff --git a/.github/workflows/release-canary.yml b/.github/workflows/release-canary.yml index 57bb876..e213f9a 100644 --- a/.github/workflows/release-canary.yml +++ b/.github/workflows/release-canary.yml @@ -27,9 +27,10 @@ jobs: run: | git config --global user.email "github-action@users.noreply.github.com" git config --global user.name "Github Action" - - name: Set version - run: yarn version --prerelease --preid ${GITHUB_SHA::8} - name: Publish - run: yarn publish --tag canary + run: | + cd dist + yarn version --no-git-tag-version --prerelease --preid ${GITHUB_SHA::8} + yarn publish --tag canary env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 1e3c66f..ce03445 100644 --- a/package.json +++ b/package.json @@ -2,24 +2,21 @@ "name": "gqtx", "version": "0.8.0", "type": "module", - "main": "dist/cjs/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", + "main": "cjs/index.js", + "module": "index.js", + "types": "index.d.ts", "exports": { ".": { - "import": "./dist/index.js", - "require": "./dist/cjs/index.js" + "import": "./index.js", + "require": "./cjs/index.js" }, "./relay": { - "import": "./dist/relay.js", - "require": "./dist/cjs/relay.js" + "import": "./relay.js", + "require": "./cjs/relay.js" }, "./package.json": "./package.json", "./": "./" }, - "files": [ - "/dist" - ], "repository": { "type": "git", "url": "https://github.com/sikanhe/gqtx" diff --git a/rollup.config.js b/rollup.config.js index fa11c52..92ebd42 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,9 +7,13 @@ const commonjsPkgJSONPlugin = () => { return { name: 'commonjsPkgJSONPlugin', writeBundle: async () => { - await fs.writeFile("dist/cjs/package.json", JSON.stringify({ - "type": "commonjs" - })) + if (isCJSBuild === true) { + await fs.writeFile("dist/cjs/package.json", JSON.stringify({ + "type": "commonjs" + })) + } else { + await fs.copyFile("package.json", "dist/package.json") + } } } } @@ -22,6 +26,6 @@ export default { format: isCJSBuild ? 'cjs' : 'esm' } ], - plugins: [ts({ tsconfig: isCJSBuild ? "tsconfig.cjs.json" : "tsconfig.json" }), isCJSBuild ? commonjsPkgJSONPlugin() : undefined].filter(Boolean), + plugins: [ts({ tsconfig: isCJSBuild ? "tsconfig.cjs.json" : "tsconfig.json" }), commonjsPkgJSONPlugin()], external: ["graphql"] }