forked from vanilla-extract-css/vanilla-extract
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy-next-plugin.ts
More file actions
32 lines (27 loc) · 846 Bytes
/
copy-next-plugin.ts
File metadata and controls
32 lines (27 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { glob } from 'fast-glob';
import { existsSync } from 'fs';
import fs from 'fs/promises';
import path from 'path';
// We need to use distinct next plugins for each next fixutre
// due to different next versions / mini-css-extract-plugin serializer registration
(async () => {
const nextPluginDistDir = path.join(
__dirname,
'../packages/next-plugin/dist',
);
if (!existsSync(nextPluginDistDir)) {
throw new Error('packages/next-plugin/dist is missing.');
}
const nextFixtureDirs = await glob('fixtures/next-*', {
onlyDirectories: true,
absolute: true,
});
if (nextFixtureDirs.length === 0) {
throw new Error('No next fixtures found.');
}
for (const dir of nextFixtureDirs) {
await fs.cp(nextPluginDistDir, path.join(dir, 'next-plugin', 'dist'), {
recursive: true,
});
}
})();