Skip to content

Commit

Permalink
feat: testing scope package in monorepo+typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
Aqours committed Apr 8, 2024
1 parent d70467f commit 2f2dce9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ save-exact=true

# https://pnpm.io/npmrc
prefer-workspace-packages=true

# https://github.com/pnpm/pnpm/issues/5068
node-linker=hoisted
1 change: 1 addition & 0 deletions apps/react-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"devDependencies": {
"@apex/webpack-config": "workspace:*",
"@types/css-modules": "1.0.5",
"@types/react": "18.2.37",
"@types/react-dom": "18.2.15",
"eslint-plugin-react": "7.34.1",
Expand Down
8 changes: 7 additions & 1 deletion apps/react-demo/src/component/mobx/MobxThemeSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { observer } from 'mobx-react-lite';
import { useEffect } from 'react';
import { useThemeStore } from '../../store/global/theme.store';

// Testing typescript type-check in Monorepo
// Scope package(@types/css-modules) in this project
import styles from '../../style/switch.module.less';

export const MobxThemeSwitch = observer(function MobxThemeSwitch() {
const themeStore = useThemeStore();

Expand All @@ -11,7 +15,9 @@ export const MobxThemeSwitch = observer(function MobxThemeSwitch() {

return (
<p>
<button onClick={() => themeStore.toggle()}>Switch Theme (Global Level)</button>
<button className={styles.button} onClick={() => themeStore.toggle()}>
Switch Theme (Global Level)
</button>
</p>
);
});
3 changes: 3 additions & 0 deletions apps/react-demo/src/style/switch.module.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.button {
color: red;
}
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2f2dce9

Please sign in to comment.