Skip to content

Commit

Permalink
chore: try to fix the typescript imports...
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ru4l committed Feb 23, 2021
1 parent a395e82 commit dbe8740
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/release-canary.yml
Expand Up @@ -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 }}
17 changes: 7 additions & 10 deletions package.json
Expand Up @@ -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"
Expand Down
12 changes: 8 additions & 4 deletions rollup.config.js
Expand Up @@ -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")
}
}
}
}
Expand All @@ -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"]
}

0 comments on commit dbe8740

Please sign in to comment.