-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathlage.config.js
More file actions
110 lines (107 loc) · 3.29 KB
/
lage.config.js
File metadata and controls
110 lines (107 loc) · 3.29 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// @ts-check
/** @import { ConfigOptions, CacheOptions, NpmScriptTargetOptions, TargetConfig, WorkerTargetOptions } from 'lage' */
const os = require("os");
const path = require("path");
const fastGlob = require("fast-glob");
/** @type {TargetConfig} */
const baseTestTarget = {
type: "worker",
weight: (target) => {
return fastGlob.sync("src/__tests__/**/*.test.ts", { cwd: target.cwd }).length;
},
options: /** @satisfies {WorkerTargetOptions} */ ({
worker: path.join(__dirname, "scripts/worker/jest.js"),
}),
dependsOn: ["build"],
};
/**
* Lage config (the types are slightly incorrect about what's required/optional)
* @type {Partial<Omit<ConfigOptions, 'cacheOptions'>> & { cacheOptions?: Partial<CacheOptions> }}
*/
const config = {
pipeline: {
"lage#bundle": ["^^transpile", "types"],
// Note that transpile/types are overridden later for the @lage-run/globby package
types: {
type: "worker",
options: /** @satisfies {WorkerTargetOptions} */ ({
worker: path.join(__dirname, "scripts/worker/types.js"),
}),
dependsOn: ["^types"],
outputs: ["lib/**/*.d.{ts,mts}"],
},
isolatedTypes: {
type: "worker",
options: /** @satisfies {WorkerTargetOptions} */ ({
worker: path.join(__dirname, "scripts/worker/types.js"),
}),
dependsOn: [],
outputs: ["lib/**/*.d.{ts,mts}"],
},
transpile: {
type: "worker",
options: /** @satisfies {WorkerTargetOptions} */ ({
worker: path.join(__dirname, "scripts/worker/transpile.js"),
}),
outputs: ["lib/**/*.{js,map}"],
},
test: { ...baseTestTarget },
build: {
type: "noop",
dependsOn: ["transpile", "types"],
},
api: ["build"],
"@lage-run/globby#types": {
type: "npmScript",
},
"@lage-run/globby#transpile": {
type: "npmScript",
},
"@lage-run/globby#isolatedTypes": {
type: "npmScript",
options: /** @satisfies {NpmScriptTargetOptions} */ ({
script: "types",
}),
},
lint: {
type: "worker",
options: /** @satisfies {WorkerTargetOptions} */ ({
worker: path.join(__dirname, "scripts/worker/lint.js"),
}),
},
depcheck: {
type: "worker",
options: /** @satisfies {WorkerTargetOptions} */ ({
worker: path.join(__dirname, "scripts/worker/depcheck.js"),
}),
},
"@lage-run/e2e-tests#test": {
...baseTestTarget,
dependsOn: ["^^transpile", "lage#bundle"],
// This runs last, so give it all available resources
weight: os.availableParallelism(),
priority: -9999,
},
},
npmClient: "yarn",
cacheOptions: {
// These are relative to the git root, and affect the hash of the cache.
// Changes to any of these files will invalidate the cache.
environmentGlob: [
// Folder globs MUST end with **/* to include all files!
"!node_modules/**/*",
"!**/node_modules/**/*",
"!**/__fixtures__/**",
".github/workflows/*",
"beachball.config.js",
"lage.config.js",
"/package.json",
"scripts/**/*",
"yarn.lock",
"*.yml",
],
// Subset of files in package directories that will be saved into the cache.
outputGlob: ["lib/**/*", "dist/**/*", ".docusaurus/**/*", "build/**/*"],
},
};
module.exports = config;