Skip to content

Commit d1b82da

Browse files
author
Pascal Wegner
committed
Connect core and web packages
1 parent 788a291 commit d1b82da

File tree

6 files changed

+102
-29
lines changed

6 files changed

+102
-29
lines changed

packages/web/craco.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const path = require('path');
2+
3+
const { getLoader, loaderByName } = require('@craco/craco');
4+
const corePackage = path.join(__dirname, '../core');
5+
module.exports = {
6+
webpack: {
7+
alias: {},
8+
plugins: [],
9+
configure: (webpackConfig) => {
10+
const { isFound, match } = getLoader(
11+
webpackConfig,
12+
loaderByName('babel-loader')
13+
);
14+
if (isFound) {
15+
const include = Array.isArray(match.loader.include)
16+
? match.loader.include
17+
: [match.loader.include];
18+
match.loader.include = include.concat[corePackage];
19+
}
20+
return webpackConfig;
21+
},
22+
},
23+
};

packages/web/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"private": true,
55
"homepage": "https://workout-interval-timer.netlify.com",
66
"dependencies": {
7+
"@craco/craco": "^6.1.1",
8+
"@interval-timer/core": "*",
79
"@testing-library/react": "^11.2.5",
810
"@xstate/react": "^0.8.1",
911
"date-fns": "^2.1.0",
@@ -14,12 +16,12 @@
1416
"xstate": "^4.11.0"
1517
},
1618
"scripts": {
17-
"start": "react-scripts start",
18-
"build": "react-scripts build",
19-
"test": "react-scripts test",
19+
"start": "craco start",
20+
"build": "craco build",
21+
"test": "craco test",
2022
"test:coverage": "yarn test --coverage --watchAll=false",
21-
"test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
22-
"eject": "react-scripts eject",
23+
"test:debug": "craco --inspect-brk test --runInBand --no-cache",
24+
"eject": "craco eject",
2325
"lint:fix": "eslint src --fix"
2426
},
2527
"lint-staged": {

packages/web/src/machines/timerMachine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { hasOneSecondElapsed } from '@interval-timer/core';
12
import { getMinutes, getSeconds, subSeconds } from 'date-fns';
23
import { assign, createMachine, send } from 'xstate';
34

45
import { TimerRunningState } from '../model/TimerRunningState.';
56
import { TimerState } from '../model/TimerState';
6-
import { hasOneSecondElapsed } from '../utils/hasOneSecondElapsed';
77
export const timerEvents = {
88
START: 'START',
99
WORK: 'WORK',

packages/web/src/utils/hasOneSecondElapsed.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/web/src/utils/hasOneSecondElapsed.test.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

yarn.lock

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,16 @@
11811181
exec-sh "^0.3.2"
11821182
minimist "^1.2.0"
11831183

1184+
"@craco/craco@^6.1.1":
1185+
version "6.1.1"
1186+
resolved "https://registry.yarnpkg.com/@craco/craco/-/craco-6.1.1.tgz#0233b28d6896b6560379f64b608d3c888874e9fa"
1187+
integrity sha512-4irfOM8RgYNhFJzAXyIuM8CZLju2Jh9GdOem8uqM2/cI2xPulQSxZKU/9q3uiSbFUJfQLi3pomVKii6KzWLu3Q==
1188+
dependencies:
1189+
cross-spawn "^7.0.0"
1190+
lodash "^4.17.15"
1191+
semver "^7.3.2"
1192+
webpack-merge "^4.2.2"
1193+
11841194
"@csstools/convert-colors@^1.4.0":
11851195
version "1.4.0"
11861196
resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7"
@@ -1763,6 +1773,14 @@
17631773
dependencies:
17641774
"@types/istanbul-lib-report" "*"
17651775

1776+
"@types/jest@^26.0.22":
1777+
version "26.0.22"
1778+
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.22.tgz#8308a1debdf1b807aa47be2838acdcd91e88fbe6"
1779+
integrity sha512-eeWwWjlqxvBxc4oQdkueW5OF/gtfSceKk4OnOAGlUSwS/liBRtZppbJuz1YkgbrbfGOoeBHun9fOvXnjNwrSOw==
1780+
dependencies:
1781+
jest-diff "^26.0.0"
1782+
pretty-format "^26.0.0"
1783+
17661784
"@types/json-schema@*", "@types/json-schema@^7.0.3", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.6":
17671785
version "7.0.7"
17681786
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad"
@@ -1778,7 +1796,7 @@
17781796
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21"
17791797
integrity sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==
17801798

1781-
"@types/node@*":
1799+
"@types/node@*", "@types/node@^14.14.37":
17821800
version "14.14.37"
17831801
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.37.tgz#a3dd8da4eb84a996c36e331df98d82abd76b516e"
17841802
integrity sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==
@@ -1798,18 +1816,51 @@
17981816
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.2.3.tgz#ef65165aea2924c9359205bf748865b8881753c0"
17991817
integrity sha512-PijRCG/K3s3w1We6ynUKdxEc5AcuuH3NBmMDP8uvKVp6X43UY7NQlTzczakXP3DJR0F4dfNQIGjU2cUeRYs2AA==
18001818

1819+
"@types/prop-types@*":
1820+
version "15.7.3"
1821+
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7"
1822+
integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==
1823+
18011824
"@types/q@^1.5.1":
18021825
version "1.5.4"
18031826
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24"
18041827
integrity sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==
18051828

1829+
"@types/react-dom@^17.0.3":
1830+
version "17.0.3"
1831+
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.3.tgz#7fdf37b8af9d6d40127137865bb3fff8871d7ee1"
1832+
integrity sha512-4NnJbCeWE+8YBzupn/YrJxZ8VnjcJq5iR1laqQ1vkpQgBiA7bwk0Rp24fxsdNinzJY2U+HHS4dJJDPdoMjdJ7w==
1833+
dependencies:
1834+
"@types/react" "*"
1835+
1836+
"@types/react-helmet@^6.1.0":
1837+
version "6.1.0"
1838+
resolved "https://registry.yarnpkg.com/@types/react-helmet/-/react-helmet-6.1.0.tgz#af586ed685f4905e2adc7462d1d65ace52beee7a"
1839+
integrity sha512-PYRoU1XJFOzQ3BHvWL1T8iDNbRjdMDJMT5hFmZKGbsq09kbSqJy61uwEpTrbTNWDopVphUT34zUSVLK9pjsgYQ==
1840+
dependencies:
1841+
"@types/react" "*"
1842+
1843+
"@types/react@*", "@types/react@^17.0.3":
1844+
version "17.0.3"
1845+
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.3.tgz#ba6e215368501ac3826951eef2904574c262cc79"
1846+
integrity sha512-wYOUxIgs2HZZ0ACNiIayItyluADNbONl7kt8lkLjVK8IitMH5QMyAh75Fwhmo37r1m7L2JaFj03sIfxBVDvRAg==
1847+
dependencies:
1848+
"@types/prop-types" "*"
1849+
"@types/scheduler" "*"
1850+
csstype "^3.0.2"
1851+
18061852
"@types/resolve@0.0.8":
18071853
version "0.0.8"
18081854
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194"
18091855
integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==
18101856
dependencies:
18111857
"@types/node" "*"
18121858

1859+
"@types/scheduler@*":
1860+
version "0.16.1"
1861+
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.1.tgz#18845205e86ff0038517aab7a18a62a6b9f71275"
1862+
integrity sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA==
1863+
18131864
"@types/source-list-map@*":
18141865
version "0.1.2"
18151866
resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9"
@@ -3889,6 +3940,11 @@ cssstyle@^2.3.0:
38893940
dependencies:
38903941
cssom "~0.3.6"
38913942

3943+
csstype@^3.0.2:
3944+
version "3.0.7"
3945+
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.7.tgz#2a5fb75e1015e84dd15692f71e89a1450290950b"
3946+
integrity sha512-KxnUB0ZMlnUWCsx2Z8MUsr6qV6ja1w9ArPErJaJaF8a5SOWoHLIszeCTKGRGRgtLgYrs1E8CHkNSP1VZTTPc9g==
3947+
38923948
cyclist@^1.0.1:
38933949
version "1.0.1"
38943950
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
@@ -6465,7 +6521,7 @@ jest-config@^26.6.3:
64656521
micromatch "^4.0.2"
64666522
pretty-format "^26.6.2"
64676523

6468-
jest-diff@^26.6.2:
6524+
jest-diff@^26.0.0, jest-diff@^26.6.2:
64696525
version "26.6.2"
64706526
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394"
64716527
integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==
@@ -9096,7 +9152,7 @@ pretty-error@^2.1.1:
90969152
lodash "^4.17.20"
90979153
renderkid "^2.0.4"
90989154

9099-
pretty-format@^26.6.0, pretty-format@^26.6.2:
9155+
pretty-format@^26.0.0, pretty-format@^26.6.0, pretty-format@^26.6.2:
91009156
version "26.6.2"
91019157
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93"
91029158
integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==
@@ -11118,6 +11174,11 @@ typedarray@^0.0.6:
1111811174
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
1111911175
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
1112011176

11177+
typescript@^4.2.3:
11178+
version "4.2.3"
11179+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
11180+
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
11181+
1112111182
unbox-primitive@^1.0.0:
1112211183
version "1.0.1"
1112311184
resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471"
@@ -11494,6 +11555,13 @@ webpack-manifest-plugin@2.2.0:
1149411555
object.entries "^1.1.0"
1149511556
tapable "^1.0.0"
1149611557

11558+
webpack-merge@^4.2.2:
11559+
version "4.2.2"
11560+
resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-4.2.2.tgz#a27c52ea783d1398afd2087f547d7b9d2f43634d"
11561+
integrity sha512-TUE1UGoTX2Cd42j3krGYqObZbOD+xF7u28WB7tfUordytSjbWTIjK/8V0amkBfTYN4/pB/GIDlJZZ657BGG19g==
11562+
dependencies:
11563+
lodash "^4.17.15"
11564+
1149711565
webpack-sources@^1.1.0, webpack-sources@^1.3.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3:
1149811566
version "1.4.3"
1149911567
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933"

0 commit comments

Comments
 (0)