-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxv.ts
More file actions
61 lines (53 loc) · 1.22 KB
/
xv.ts
File metadata and controls
61 lines (53 loc) · 1.22 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import {
PluginType,
enqueueInstallDependency,
enqueueRemoveDependency,
getMonorepoDirectory,
hasPlugin,
warning,
writePackage,
type PluginArgs,
} from "@mokr/core";
async function install({ directory }: PluginArgs) {
const monorepoDirectory = await getMonorepoDirectory({ directory });
if (!hasPlugin({ directory, name: "typescript" })) {
// @todo: install xv without ts-node
} else {
// Install xv with ts-node
enqueueInstallDependency({
directory,
identifier: ["xv", "ts-node"],
dev: true,
});
}
await writePackage({
directory,
data: {
scripts: {
test: "xv --loader=ts-node/esm test",
},
},
});
if (monorepoDirectory) {
// At monorepo level
await writePackage({
directory: monorepoDirectory,
data: {
scripts: {
test: "yarn workspaces foreach --all --topological --verbose run test",
},
},
});
}
}
async function remove({ directory }: PluginArgs) {
enqueueRemoveDependency({ directory, identifier: ["xv", "ts-node"] });
warning("Please review package.json manually");
}
async function load() {}
export const xv = {
type: PluginType.RepoOrWorkspace,
install,
remove,
load,
};