Skip to content

Moves to Typescript with yarn latest and tsup #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .babelrc.json

This file was deleted.

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.5.0.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.5.0.cjs
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,42 +42,45 @@ This template ships with the main React configuration files you'll need to get u
A quick look at the top-level files and directories included with this template.

.
├── .yarn
├── node_modules
├── src
├── .babelrc.json
├── .gitignore
├── .prettierignore
├── .prettierrc
├── LICENSE
├── package.json
├── rollup.config.mjs
├── vite.config.js
├── tsup.config.ts
├── vite.config.ts
├── tsconfig.json
├── yarn.lock
└── README.md

1. **`node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages).
1. **`.yarn`**: This directory contains all the configuration, cache, and plugins for Yarn modern.

2. **`src`**: This directory will contain all of the code related to what you will see on your application.
2. **`node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages).

3. **`.babelrc.json`**: This file tells babel which presets and plugins to use when transforming your code.
3. **`src`**: This directory will contain all of the code related to what you will see on your application.

4. **`.gitignore`**: This file tells git which files it should not track or maintain during the development process of your project.
4. **`.gitignore`**: This file tells git which files it should not track or maintain during the development process of your project.

5. **`.prettierignore`**: This file tells prettier which files it should not format.
5. **`.prettierignore`**: This file tells prettier which files it should not format.

6. **`.prettierrc`**: This file tells prettier which rules to use when formatting your code.
6. **`.prettierrc`**: This file tells prettier which rules to use when formatting your code.

7. **`LICENSE`**: The template is licensed under the MIT licence.
7. **`LICENSE`**: The template is licensed under the MIT licence.

8. **`package.json`**: Standard manifest file for Node.js projects, which typically includes project specific metadata (such as the project's name, the author among other information). It's based on this file that npm will know which packages are necessary to the project.
8. **`package.json`**: Standard manifest file for Node.js projects, which typically includes project specific metadata (such as the project's name, the author among other information). It's based on this file that npm will know which packages are necessary to the project.

9. **`rollup.config.mjs`**: This file tells rollup which plugins to use when bundling your code.
9. **`tsup.config.ts`**: This file tells [Tsup](https://tsup.egoist.dev/) which plugins to use when bundling your code.

10. **`yarn.lock`**: This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(Do not change it manually).**

11. **`vite.config.js`**: This file tells [Vite](https://vitejs.dev/) which plugins to use when bundling your code.
11. **`vite.config.ts`**: This file tells [Vite](https://vitejs.dev/) which plugins to use when bundling your code.

12. **`README.md`**: A text file containing useful reference information about the project.
12. **tsconfig.json**: This file tells TypeScript which rules to use when compiling your code.

13. **`README.md`**: A text file containing useful reference information about the project.

## Contribute

Expand Down
83 changes: 50 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,66 @@
"name": "learnstorybook-design-system-template",
"version": "0.1.0",
"private": true,
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
"exports": {
".": {
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
}
}
},
"engines": {
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
},
"files": [
"dist/**/*",
"README.md"
],
"license": "MIT",
"scripts": {
"build": "rollup -c --bundleConfigAsCjs",
"watch": "rollup --watch -c --bundleConfigAsCjs",
"build": "tsup",
"watch": "tsup --watch",
"clean": "rimraf ./dist",
"prebuild": "yarn clean",
"release": "yarn build && auto shipit",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"@babel/core": "^7.22.5",
"@babel/preset-env": "^7.21.5",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.5",
"@emotion/babel-plugin": "^11.11.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.1.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@vitejs/plugin-react": "^3.1.0",
"auto": "^10.3.0",
"boxen": "^5.0.1",
"dedent": "^0.7.0",
"npm-run-all": "^4.1.5",
"@emotion/babel-plugin": "^11.13.5",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@types/node": "18.15.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"auto": "^11.3.0",
"concurrently": "8.0.1",
"eslint": "8.57.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"eslint-plugin-storybook": "^0.11.2",
"polished": "^4.2.2",
"prettier": "^2.8.8",
"prop-types": "^15.8.1",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"prettier": "^3.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^3.0.2",
"rollup": "^3.25.0",
"rollup-plugin-dts": "^5.3.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"vite": "^4.1.4",
"zx": "^1.14.1"
"tsup": "7.2.0",
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.1",
"vite": "^5.4.1"
},
"peerDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"react": ">=17",
"react-dom": ">=17"
},
"peerDependenciesMeta": {
"react": {
Expand All @@ -62,5 +73,11 @@
},
"resolutions": {
"jackspeak": "2.1.1"
},
"packageManager": "[email protected]",
"auto": {
"plugins": [
"npm"
]
}
}
44 changes: 0 additions & 44 deletions rollup.config.mjs

This file was deleted.

18 changes: 0 additions & 18 deletions src/.babelrc.json

This file was deleted.

21 changes: 13 additions & 8 deletions src/Avatar/Avatar.stories.jsx → src/Avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import type { Meta, StoryObj } from '@storybook/react';

import { Avatar } from './Avatar';

export default {
const meta = {
title: 'Design System/Avatar',
component: Avatar,
};
} satisfies Meta<typeof Avatar>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Standard = {
export const Standard: Story = {
args: {
size: 'large',
username: 'Tom Coleman',
src: 'https://avatars2.githubusercontent.com/u/132554',
},
};

export const Sizes = {
export const Sizes: Story = {
args: {
username: 'Tom Coleman',
src: 'https://avatars2.githubusercontent.com/u/132554',
Expand All @@ -28,8 +33,8 @@ export const Sizes = {
),
};

export const Initials = {
render: (args) => (
export const Initials: Story = {
render: () => (
<>
<Avatar username='Tom Coleman' />
<Avatar username='Dominic Nguyen' />
Expand All @@ -39,7 +44,7 @@ export const Initials = {
),
};

export const Loading = {
export const Loading: Story = {
args: {
loading: true,
},
Expand All @@ -53,7 +58,7 @@ export const Loading = {
),
};

export const Large = {
export const Large: Story = {
render: () => (
<>
<Avatar loading size='large' />
Expand Down
Loading