-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cde2d51
commit ad68313
Showing
4 changed files
with
332 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,164 +1,161 @@ | ||
import path from 'node:path' | ||
import { candidate, css, html, js, json, test, yaml } from '../utils' | ||
// test( | ||
// 'production build', | ||
// { | ||
// fs: { | ||
// 'package.json': json`{}`, | ||
// 'pnpm-workspace.yaml': yaml` | ||
// # | ||
// packages: | ||
// - project-a | ||
// `, | ||
// 'project-a/package.json': json` | ||
// { | ||
// "dependencies": { | ||
// "postcss": "^8", | ||
// "postcss-cli": "^10", | ||
// "tailwindcss": "workspace:^", | ||
// "@tailwindcss/postcss": "workspace:^" | ||
// } | ||
// } | ||
// `, | ||
// 'project-a/postcss.config.js': js` | ||
// module.exports = { | ||
// plugins: { | ||
// '@tailwindcss/postcss': {}, | ||
// }, | ||
// } | ||
// `, | ||
// 'project-a/index.html': html` | ||
// <div | ||
// class="underline 2xl:font-bold hocus:underline inverted:flex" | ||
// ></div> | ||
// `, | ||
// 'project-a/plugin.js': js` | ||
// module.exports = function ({ addVariant }) { | ||
// addVariant('inverted', '@media (inverted-colors: inverted)') | ||
// addVariant('hocus', ['&:focus', '&:hover']) | ||
// } | ||
// `, | ||
// 'project-a/src/index.css': css` | ||
// @import 'tailwindcss/utilities'; | ||
// @source '../../project-b/src/**/*.js'; | ||
// @plugin '../plugin.js'; | ||
// `, | ||
// 'project-a/src/index.js': js` | ||
// const className = "content-['a/src/index.js']" | ||
// module.exports = { className } | ||
// `, | ||
// 'project-b/src/index.js': js` | ||
// const className = "content-['b/src/index.js']" | ||
// module.exports = { className } | ||
// `, | ||
// }, | ||
// }, | ||
// async ({ root, fs, exec }) => { | ||
// await exec('pnpm postcss src/index.css --output dist/out.css', { | ||
// cwd: path.join(root, 'project-a'), | ||
// }) | ||
|
||
test( | ||
'production build', | ||
{ | ||
fs: { | ||
'package.json': json`{}`, | ||
'pnpm-workspace.yaml': yaml` | ||
# | ||
packages: | ||
- project-a | ||
`, | ||
'project-a/package.json': json` | ||
{ | ||
"dependencies": { | ||
"postcss": "^8", | ||
"postcss-cli": "^10", | ||
"tailwindcss": "workspace:^", | ||
"@tailwindcss/postcss": "workspace:^" | ||
} | ||
} | ||
`, | ||
'project-a/postcss.config.js': js` | ||
module.exports = { | ||
plugins: { | ||
'@tailwindcss/postcss': {}, | ||
}, | ||
} | ||
`, | ||
'project-a/index.html': html` | ||
<div | ||
class="underline 2xl:font-bold hocus:underline inverted:flex" | ||
></div> | ||
`, | ||
'project-a/plugin.js': js` | ||
module.exports = function ({ addVariant }) { | ||
addVariant('inverted', '@media (inverted-colors: inverted)') | ||
addVariant('hocus', ['&:focus', '&:hover']) | ||
} | ||
`, | ||
'project-a/src/index.css': css` | ||
@import 'tailwindcss/utilities'; | ||
@source '../../project-b/src/**/*.js'; | ||
@plugin '../plugin.js'; | ||
`, | ||
'project-a/src/index.js': js` | ||
const className = "content-['a/src/index.js']" | ||
module.exports = { className } | ||
`, | ||
'project-b/src/index.js': js` | ||
const className = "content-['b/src/index.js']" | ||
module.exports = { className } | ||
`, | ||
}, | ||
}, | ||
async ({ root, fs, exec }) => { | ||
await exec('pnpm postcss src/index.css --output dist/out.css', { | ||
cwd: path.join(root, 'project-a'), | ||
}) | ||
// await fs.expectFileToContain('project-a/dist/out.css', [ | ||
// candidate`underline`, | ||
// candidate`content-['a/src/index.js']`, | ||
// candidate`content-['b/src/index.js']`, | ||
// candidate`inverted:flex`, | ||
// candidate`hocus:underline`, | ||
// ]) | ||
// }, | ||
// ) | ||
|
||
await fs.expectFileToContain('project-a/dist/out.css', [ | ||
candidate`underline`, | ||
candidate`content-['a/src/index.js']`, | ||
candidate`content-['b/src/index.js']`, | ||
candidate`inverted:flex`, | ||
candidate`hocus:underline`, | ||
]) | ||
}, | ||
) | ||
// test( | ||
// 'watch mode', | ||
// { | ||
// fs: { | ||
// 'package.json': json`{}`, | ||
// 'pnpm-workspace.yaml': yaml` | ||
// # | ||
// packages: | ||
// - project-a | ||
// `, | ||
// 'project-a/package.json': json` | ||
// { | ||
// "dependencies": { | ||
// "postcss": "^8", | ||
// "postcss-cli": "^10", | ||
// "tailwindcss": "workspace:^", | ||
// "@tailwindcss/postcss": "workspace:^" | ||
// } | ||
// } | ||
// `, | ||
// 'project-a/postcss.config.js': js` | ||
// module.exports = { | ||
// plugins: { | ||
// '@tailwindcss/postcss': {}, | ||
// }, | ||
// } | ||
// `, | ||
// 'project-a/index.html': html` | ||
// <div | ||
// class="underline 2xl:font-bold hocus:underline inverted:flex" | ||
// ></div> | ||
// `, | ||
// 'project-a/plugin.js': js` | ||
// module.exports = function ({ addVariant }) { | ||
// addVariant('inverted', '@media (inverted-colors: inverted)') | ||
// addVariant('hocus', ['&:focus', '&:hover']) | ||
// } | ||
// `, | ||
// 'project-a/src/index.css': css` | ||
// @import 'tailwindcss/utilities'; | ||
// @source '../../project-b/src/**/*.js'; | ||
// @plugin '../plugin.js'; | ||
// `, | ||
// 'project-a/src/index.js': js` | ||
// const className = "content-['a/src/index.js']" | ||
// module.exports = { className } | ||
// `, | ||
// 'project-b/src/index.js': js` | ||
// const className = "content-['b/src/index.js']" | ||
// module.exports = { className } | ||
// `, | ||
// }, | ||
// }, | ||
// async ({ root, fs, spawn }) => { | ||
// let process = await spawn( | ||
// 'pnpm postcss src/index.css --output dist/out.css --watch --verbose', | ||
// { cwd: path.join(root, 'project-a') }, | ||
// ) | ||
// await process.onStderr((message) => message.includes('Waiting for file changes...')) | ||
|
||
test( | ||
'watch mode', | ||
{ | ||
fs: { | ||
'package.json': json`{}`, | ||
'pnpm-workspace.yaml': yaml` | ||
# | ||
packages: | ||
- project-a | ||
`, | ||
'project-a/package.json': json` | ||
{ | ||
"dependencies": { | ||
"postcss": "^8", | ||
"postcss-cli": "^10", | ||
"tailwindcss": "workspace:^", | ||
"@tailwindcss/postcss": "workspace:^" | ||
} | ||
} | ||
`, | ||
'project-a/postcss.config.js': js` | ||
module.exports = { | ||
plugins: { | ||
'@tailwindcss/postcss': {}, | ||
}, | ||
} | ||
`, | ||
'project-a/index.html': html` | ||
<div | ||
class="underline 2xl:font-bold hocus:underline inverted:flex" | ||
></div> | ||
`, | ||
'project-a/plugin.js': js` | ||
module.exports = function ({ addVariant }) { | ||
addVariant('inverted', '@media (inverted-colors: inverted)') | ||
addVariant('hocus', ['&:focus', '&:hover']) | ||
} | ||
`, | ||
'project-a/src/index.css': css` | ||
@import 'tailwindcss/utilities'; | ||
@source '../../project-b/src/**/*.js'; | ||
@plugin '../plugin.js'; | ||
`, | ||
'project-a/src/index.js': js` | ||
const className = "content-['a/src/index.js']" | ||
module.exports = { className } | ||
`, | ||
'project-b/src/index.js': js` | ||
const className = "content-['b/src/index.js']" | ||
module.exports = { className } | ||
`, | ||
}, | ||
}, | ||
async ({ root, fs, spawn }) => { | ||
let process = await spawn( | ||
'pnpm postcss src/index.css --output dist/out.css --watch --verbose', | ||
{ cwd: path.join(root, 'project-a') }, | ||
) | ||
await process.onStderr((message) => message.includes('Waiting for file changes...')) | ||
// await fs.expectFileToContain('project-a/dist/out.css', [ | ||
// candidate`underline`, | ||
// candidate`content-['a/src/index.js']`, | ||
// candidate`content-['b/src/index.js']`, | ||
// candidate`inverted:flex`, | ||
// candidate`hocus:underline`, | ||
// ]) | ||
|
||
await fs.expectFileToContain('project-a/dist/out.css', [ | ||
candidate`underline`, | ||
candidate`content-['a/src/index.js']`, | ||
candidate`content-['b/src/index.js']`, | ||
candidate`inverted:flex`, | ||
candidate`hocus:underline`, | ||
]) | ||
// await fs.write( | ||
// 'project-a/src/index.js', | ||
// js` | ||
// const className = "[.changed_&]:content-['project-a/src/index.js']" | ||
// module.exports = { className } | ||
// `, | ||
// ) | ||
|
||
await fs.write( | ||
'project-a/src/index.js', | ||
js` | ||
const className = "[.changed_&]:content-['project-a/src/index.js']" | ||
module.exports = { className } | ||
`, | ||
) | ||
// await fs.expectFileToContain('project-a/dist/out.css', [ | ||
// candidate`[.changed_&]:content-['project-a/src/index.js']`, | ||
// ]) | ||
|
||
await fs.expectFileToContain('project-a/dist/out.css', [ | ||
candidate`[.changed_&]:content-['project-a/src/index.js']`, | ||
]) | ||
// await fs.write( | ||
// 'project-b/src/index.js', | ||
// js` | ||
// const className = "[.changed_&]:content-['project-b/src/index.js']" | ||
// module.exports = { className } | ||
// `, | ||
// ) | ||
|
||
await fs.write( | ||
'project-b/src/index.js', | ||
js` | ||
const className = "[.changed_&]:content-['project-b/src/index.js']" | ||
module.exports = { className } | ||
`, | ||
) | ||
|
||
await fs.expectFileToContain('project-a/dist/out.css', [ | ||
candidate`[.changed_&]:content-['project-b/src/index.js']`, | ||
]) | ||
}, | ||
) | ||
// await fs.expectFileToContain('project-a/dist/out.css', [ | ||
// candidate`[.changed_&]:content-['project-b/src/index.js']`, | ||
// ]) | ||
// }, | ||
// ) |
Oops, something went wrong.