diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e05127b..1dee367 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,7 +15,7 @@ jobs: run: | yarn npx lerna bootstrap - yarn build + yarn build:all-targets yarn build:storybook yarn build:docs mv ./packages/stories/storybook-static/index.html ./packages/stories/storybook-static/index.htm diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 4dae668..efcc82c 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -14,7 +14,7 @@ jobs: npx lerna bootstrap - name: Build run: | - yarn build + yarn build:all-targets yarn build:storybook yarn build:docs - name: Lint diff --git a/.gitignore b/.gitignore index 971a24c..0a13708 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /packages/*/out +/packages/*/lib .idea node_modules storybook-static diff --git a/config/tsconfig.json b/config/tsconfig.json index fbfebe1..a508f46 100644 --- a/config/tsconfig.json +++ b/config/tsconfig.json @@ -6,7 +6,8 @@ "jsx": "react", "declaration": true, "module": "CommonJS", - "skipLibCheck": true + "skipLibCheck": true, + "moduleResolution": "Node" }, "exclude": ["node_modules", "../**/*.spec.ts", "../**/*.spec.tsx"] } diff --git a/package.json b/package.json index 696f2ec..b48a090 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "storybook": "lerna run storybook --parallel --npm-client=yarn", "build:storybook": "lerna run build:storybook --parallel --npm-client=yarn", "build": "lerna run build --npm-client=yarn", + "build:all-targets": "lerna run build:all --npm-client=yarn", "test": "lerna run test --npm-client=yarn --stream", "prettier:check": "prettier --check .", "prettier:write": "prettier --write .", diff --git a/packages/synergies/package.json b/packages/synergies/package.json index 9a07a44..e442f0d 100644 --- a/packages/synergies/package.json +++ b/packages/synergies/package.json @@ -10,13 +10,20 @@ "author": "Lukas Bach", "license": "MIT", "private": false, - "main": "out/index.js", - "typings": "out/index.d.ts", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", + "esnext": "lib/esnext/index.js", + "typings": "lib/esm/index.d.ts", "scripts": { - "start": "tsc -w", "build": "tsc", - "test": "jest --passWithNoTests", - "prepublish": "tsc && jest && cpy \"../../README.md\" ." + "build:all": "run-p \"build:cjs\" \"build:esm\" \"build:esnext\" \"build:types\"", + "build:cjs": "tsc -m commonjs --outDir lib/cjs", + "build:types": "tsc --declaration true --emitDeclarationOnly --outDir lib/types", + "build:esm": "tsc -m es2015 --outDir lib/esm", + "build:esnext": "tsc -m esnext --outDir lib/esnext", + "start": "tsc -w", + "test": "jest", + "prepublish": "yarn build:all && yarn test && cpy \"../../README.md\" ." }, "devDependencies": { "@babel/preset-env": "^7.12.11", @@ -34,7 +41,8 @@ "jest": "^26.6.3", "react-test-renderer": "^17.0.1", "ts-jest": "^26.4.4", - "typescript": "^4.1.2" + "typescript": "^4.1.2", + "npm-run-all": "^4.1.5" }, "peerDependencies": { "immer": "*", diff --git a/packages/synergies/tsconfig.json b/packages/synergies/tsconfig.json index e5ca1e8..b9cbc2e 100644 --- a/packages/synergies/tsconfig.json +++ b/packages/synergies/tsconfig.json @@ -2,7 +2,8 @@ "extends": "../../config/tsconfig.json", "include": ["src"], "compilerOptions": { - "outDir": "out", - "esModuleInterop": true + "outDir": "lib/cjs", + "esModuleInterop": true, + "declaration": false } } diff --git a/yarn.lock b/yarn.lock index ef20f30..fabf345 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8056,7 +8056,7 @@ cross-fetch@^3.1.5: dependencies: node-fetch "2.6.7" -cross-spawn@^6.0.0: +cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== @@ -13080,6 +13080,11 @@ memory-fs@^0.5.0: errno "^0.1.3" readable-stream "^2.0.1" +memorystream@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" + integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI= + meow@^10.1.1: version "10.1.2" resolved "https://registry.yarnpkg.com/meow/-/meow-10.1.2.tgz#62951cb69afa69594142c8250806bc30a3912e4d" @@ -13865,6 +13870,21 @@ npm-pick-manifest@^3.0.0: npm-package-arg "^6.0.0" semver "^5.4.1" +npm-run-all@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.5.tgz#04476202a15ee0e2e214080861bff12a51d98fba" + integrity sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ== + dependencies: + ansi-styles "^3.2.1" + chalk "^2.4.1" + cross-spawn "^6.0.5" + memorystream "^0.3.1" + minimatch "^3.0.4" + pidtree "^0.3.0" + read-pkg "^3.0.0" + shell-quote "^1.6.1" + string.prototype.padend "^3.0.0" + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" @@ -14614,6 +14634,11 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.0, picomatc resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== +pidtree@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.1.tgz#ef09ac2cc0533df1f3250ccf2c4d366b0d12114a" + integrity sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA== + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -16817,7 +16842,7 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -shell-quote@^1.7.3: +shell-quote@^1.6.1, shell-quote@^1.7.3: version "1.7.3" resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.3.tgz#aa40edac170445b9a431e17bb62c0b881b9c4123" integrity sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==