Skip to content

Commit

Permalink
chore(file): rename
Browse files Browse the repository at this point in the history
  • Loading branch information
yxf committed May 19, 2023
1 parent ad46547 commit b075567
Show file tree
Hide file tree
Showing 28 changed files with 53 additions and 12,478 deletions.
3 changes: 2 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"linked": [],
"access": "public",
"updateInternalDependencies": "patch",
"ignore": ["@acme/docs"]
"ignore": ["@soul/docs"],
"baseBranch": "main"
}
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-acme`
extends: ["acme"],
// This tells ESLint to load the config from the package `eslint-config-soul`
extends: ["soul"],
settings: {
next: {
rootDir: ["apps/*/"],
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Node.js 16.x
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16.x

- uses: pnpm/action-setup@v2
with:
version: 7
run_install: false

- name: Install Dependencies
run: yarn
run: pnpm install

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Send a Slack notification if a publish happens
if: steps.changesets.outputs.published == 'true'
# You can do something when a publish happens.
run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!"
run: my-slack-bot send-notification --message "A new version of cushily-design was published!"
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ Using Turborepo simplifies managing your design system monorepo, as you can have
This Turborepo includes the following packages and applications:

- `apps/docs`: Component documentation site with Storybook
- `packages/@acme/core`: Core React components
- `packages/@acme/utils`: Shared React utilities
- `packages/@acme/tsconfig`: Shared `tsconfig.json`s used throughout the Turborepo
- `packages/eslint-config-acme`: ESLint preset
- `packages/@soul/core`: Core React components
- `packages/@soul/utils`: Shared React utilities
- `packages/@soul/tsconfig`: Shared `tsconfig.json`s used throughout the Turborepo
- `packages/eslint-config-soul`: ESLint preset

Each package and app is 100% [TypeScript](https://www.typescriptlang.org/). Workspaces enables us to "hoist" dependencies that are shared between packages to the root `package.json`. This means smaller `node_modules` folders and a better local dev experience. To install a dependency for the entire monorepo, use the `-w` workspaces flag with `pnpm add`.

Expand All @@ -57,17 +57,17 @@ To make the core library code work across all browsers, we need to compile the r

Running `pnpm build` from the root of the Turborepo will run the `build` command defined in each package's `package.json` file. Turborepo runs each `build` in parallel and caches & hashes the output to speed up future builds.

For `acme-core`, the `build` command is the following:
For `soul-core`, the `build` command is the following:

```bash
tsup src/index.tsx --format esm,cjs --dts --external react
```

`tsup` compiles `src/index.tsx`, which exports all of the components in the design system, into both ES Modules and CommonJS formats as well as their TypeScript types. The `package.json` for `acme-core` then instructs the consumer to select the correct format:
`tsup` compiles `src/index.tsx`, which exports all of the components in the design system, into both ES Modules and CommonJS formats as well as their TypeScript types. The `package.json` for `soul-core` then instructs the consumer to select the correct format:

```json:acme-core/package.json
```json:soul-core/package.json
{
"name": "@acme/core",
"name": "@soul/core",
"version": "0.0.0",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -76,10 +76,10 @@ tsup src/index.tsx --format esm,cjs --dts --external react
}
```

Run `pnpm build` to confirm compilation is working correctly. You should see a folder `acme-core/dist` which contains the compiled output.
Run `pnpm build` to confirm compilation is working correctly. You should see a folder `soul-core/dist` which contains the compiled output.

```bash
acme-core
soul-core
└── dist
├── index.d.ts <-- Types
├── index.js <-- CommonJS version
Expand All @@ -88,9 +88,9 @@ acme-core

## Components

Each file inside of `acme-core/src` is a component inside our design system. For example:
Each file inside of `soul-core/src` is a component inside our design system. For example:

```tsx:acme-core/src/Button.tsx
```tsx:soul-core/src/Button.tsx
import * as React from 'react';

export interface ButtonProps {
Expand All @@ -106,7 +106,7 @@ Button.displayName = 'Button';

When adding a new file, ensure the component is also exported from the entry `index.tsx` file:

```tsx:acme-core/src/index.tsx
```tsx:soul-core/src/index.tsx
import * as React from "react";
export { Button, type ButtonProps } from "./Button";
// Add new component exports here
Expand All @@ -118,13 +118,13 @@ Storybook provides us with an interactive UI playground for our components. This

- Use Vite to bundle stories instantly (in milliseconds)
- Automatically find any stories inside the `stories/` folder
- Support using module path aliases like `@acme-core` for imports
- Support using module path aliases like `@soul-core` for imports
- Write MDX for component documentation pages

For example, here's the included Story for our `Button` component:

```js:apps/docs/stories/button.stories.mdx
import { Button } from '@acme-core/src';
import { Button } from '@soul-core/src';
import { Meta, Story, Preview, Props } from '@storybook/addon-docs/blocks';

<Meta title="Components/Button" component={Button} />
Expand Down Expand Up @@ -177,10 +177,10 @@ When you push your code to GitHub, the [GitHub Action](https://github.com/change
turbo run build --filter=docs^... && changeset publish
```

Turborepo runs the `build` script for all publishable packages (excluding docs) and publishes the packages to npm. By default, this example includes `acme` as the npm organization. To change this, do the following:
Turborepo runs the `build` script for all publishable packages (excluding docs) and publishes the packages to npm. By default, this example includes `soul` as the npm organization. To change this, do the following:

- Rename folders in `packages/*` to replace `acme` with your desired scope
- Search and replace `acme` with your desired scope
- Rename folders in `packages/*` to replace `soul` with your desired scope
- Search and replace `soul` with your desired scope
- Re-run `pnpm install`

To publish packages to a private npm organization scope, **remove** the following from each of the `package.json`'s
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: ["acme"],
extends: ["soul"],
};
4 changes: 2 additions & 2 deletions apps/docs/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ module.exports = {
resolve: {
alias: [
{
find: "@acme/core",
find: "@soul/core",
replacement: path.resolve(
__dirname,
"../../../packages/acme-core/"
"../../../packages/soul-core/"
),
},
],
Expand Down
8 changes: 4 additions & 4 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@acme/docs",
"name": "@soul/docs",
"version": "0.0.0",
"private": true,
"scripts": {
Expand All @@ -9,20 +9,20 @@
"clean": "rm -rf .turbo && rm -rf node_modules"
},
"dependencies": {
"@acme/core": "workspace:0.0.0",
"@soul/core": "workspace:0.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@acme/tsconfig": "workspace:0.0.0",
"@soul/tsconfig": "workspace:0.0.0",
"@storybook/addon-actions": "^6.5.14",
"@storybook/addon-docs": "^6.5.14",
"@storybook/addon-essentials": "^6.5.14",
"@storybook/addon-links": "^6.5.14",
"@storybook/builder-vite": "^0.1.41",
"@storybook/react": "^6.5.14",
"@vitejs/plugin-react": "^1.3.2",
"eslint-config-acme": "workspace:0.0.0",
"eslint-config-soul": "workspace:0.0.0",
"serve": "^13.0.4",
"typescript": "^4.9.3",
"vite": "^2.9.15"
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/stories/button.stories.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button } from "@acme/core/src";
import { Button } from "@soul/core/src";
import { Meta, Story, Canvas, ArgsTable } from "@storybook/addon-docs";

<Meta title="Components/Button" component={Button} />
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"devDependencies": {
"@changesets/cli": "^2.25.2",
"eslint": "^8.29.0",
"eslint-config-acme": "workspace:0.0.0",
"eslint-config-soul": "workspace:0.0.0",
"prettier": "^2.8.0",
"turbo": "latest"
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "eslint-config-acme",
"name": "eslint-config-soul",
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: ["acme"],
extends: ["soul"],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@acme/core",
"name": "@soul/core",
"version": "0.0.0",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -16,11 +16,11 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
},
"devDependencies": {
"@acme/tsconfig": "workspace:*",
"@soul/tsconfig": "workspace:*",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.4",
"eslint": "^8.15.0",
"eslint-config-acme": "workspace:*",
"eslint-config-soul": "workspace:*",
"react": "^18.1.0",
"tsup": "^5.10.1",
"typescript": "^4.5.3"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@acme/tsconfig/react-library.json",
"extends": "@soul/tsconfig/react-library.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@acme/tsconfig",
"name": "@soul/tsconfig",
"version": "0.0.0",
"private": true,
"license": "MIT",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: ["acme"],
extends: ["soul"],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@acme/utils",
"name": "@soul/utils",
"version": "0.0.0",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -16,11 +16,11 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
},
"devDependencies": {
"@acme/tsconfig": "workspace:*",
"@soul/tsconfig": "workspace:*",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.4",
"eslint": "^8.15.0",
"eslint-config-acme": "workspace:*",
"eslint-config-soul": "workspace:*",
"react": "^18.1.0",
"tsup": "^5.10.1",
"typescript": "^4.5.3"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@acme/tsconfig/react-library.json",
"extends": "@soul/tsconfig/react-library.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}
Loading

0 comments on commit b075567

Please sign in to comment.