Skip to content

Commit 7c2999c

Browse files
committed
chore: soucemap enable at dev
1 parent ea40daa commit 7c2999c

File tree

6 files changed

+17
-74
lines changed

6 files changed

+17
-74
lines changed

README.md

+5-69
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,9 @@
1-
# pnpm-turbo-monorepo-template
1+
# tailwindcss-mangle
22

3-
This is a empty pnpm starter turborepo for me.
3+
A util for mangle tailwindcss
44

5-
## What's inside?
5+
## Repos
66

7-
This turborepo uses [pnpm](https://pnpm.io) as a package manager. It includes the following packages/apps:
7+
[tailwindcss-patch](./packages/tailwindcss-patch)
88

9-
### Apps and Packages
10-
11-
- `docs`: a [Next.js](https://nextjs.org/) app
12-
- `web`: another [Next.js](https://nextjs.org/) app
13-
- `ui`: a stub React component library shared by both `web` and `docs` applications
14-
- `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
15-
- `tsconfig`: `tsconfig.json`s used throughout the monorepo
16-
17-
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
18-
19-
### Utilities
20-
21-
This turborepo has some additional tools already setup for you:
22-
23-
- [TypeScript](https://www.typescriptlang.org/) for static type checking
24-
- [ESLint](https://eslint.org/) for code linting
25-
- [Prettier](https://prettier.io) for code formatting
26-
27-
### Build
28-
29-
To build all apps and packages, run the following command:
30-
31-
```
32-
cd my-turborepo
33-
pnpm run build
34-
```
35-
36-
### Develop
37-
38-
To develop all apps and packages, run the following command:
39-
40-
```
41-
cd my-turborepo
42-
pnpm run dev
43-
```
44-
45-
### Remote Caching
46-
47-
Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
48-
49-
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
50-
51-
```
52-
cd my-turborepo
53-
pnpm dlx turbo login
54-
```
55-
56-
This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).
57-
58-
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your turborepo:
59-
60-
```
61-
pnpm dlx turbo link
62-
```
63-
64-
## Useful Links
65-
66-
Learn more about the power of Turborepo:
67-
68-
- [Pipelines](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks)
69-
- [Caching](https://turbo.build/repo/docs/core-concepts/caching)
70-
- [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching)
71-
- [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering)
72-
- [Configuration Options](https://turbo.build/repo/docs/reference/configuration)
73-
- [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference)
9+
[unplugin-tailwindcss-mangle](./packages/unplugin-tailwindcss-mangle)

packages/tailwindcss-patch/rollup.config.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createRollupConfig, legacyOutputOptions } from '@icebreakers/rollup'
2-
2+
const isDev = process.env.NODE_ENV === 'development'
33
export default createRollupConfig({
44
input: {
55
index: 'src/index.ts',
@@ -9,6 +9,7 @@ export default createRollupConfig({
99
{
1010
dir: 'dist',
1111
format: 'cjs',
12+
sourcemap: isDev,
1213
...legacyOutputOptions
1314
}
1415
]

packages/unplugin-tailwindcss-mangle/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"dev:tsc": "tsc -p tsconfig.json --sourceMap",
5050
"build:tsc": "tsc -p tsconfig.json",
5151
"test": "jest",
52-
"preinstall": "npx only-allow pnpm"
52+
"preinstall": "npx only-allow pnpm",
53+
"prepare": "tw-patch"
5354
},
5455
"files": [
5556
"dist"

packages/unplugin-tailwindcss-mangle/rollup.config.mjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createRollupConfig, legacyOutputOptions } from '@icebreakers/rollup'
2-
2+
const isDev = process.env.NODE_ENV === 'development'
33
export default createRollupConfig({
44
input: {
55
index: 'src/index.ts',
@@ -15,11 +15,13 @@ export default createRollupConfig({
1515
format: 'cjs',
1616
entryFileNames: '[name].cjs',
1717
chunkFileNames: '[name]-[hash].cjs',
18+
sourcemap: isDev,
1819
...legacyOutputOptions
1920
},
2021
{
2122
dir: 'dist',
2223
format: 'esm',
24+
sourcemap: isDev,
2325
...legacyOutputOptions
2426
}
2527
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const pluginName = 'unplugin-tailwindcss-mangle'
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { createUnplugin } from 'unplugin'
22
import type { Options } from './types'
3+
import { pluginName } from './constants'
34

45
export default createUnplugin<Options | undefined>((options) => ({
5-
name: 'unplugin-starter',
6+
name: pluginName,
7+
enforce: 'post',
68
transformInclude(id) {
79
return id.endsWith('main.ts')
810
},
9-
transform(code) {
11+
transform(code, id) {
1012
return code.replace('__UNPLUGIN__', `Hello Unplugin! ${options}`)
1113
}
1214
}))

0 commit comments

Comments
 (0)