generated from bitmodo/node-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paths.js
107 lines (94 loc) · 2.59 KB
/
paths.js
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
// @ts-nocheck
const path = require('path');
const cwd = process.cwd(),
root = __dirname;
const buildDir = 'build',
cacheDir = 'cache',
coverageDir = 'coverage';
const tslint = path.join(root, 'tslint.json'),
tsconfig = path.join(root, 'tsconfig.base.json'),
buildPath = path.join(cwd, buildDir),
cachePath = path.join(buildPath, cacheDir),
coveragePath = path.join(buildPath, coverageDir);
const packagesDir = 'packages',
libDir = 'lib',
testDir = 'test',
distDir = 'dist';
const packages = path.join(root, packagesDir),
project = function (name) {
return path.join(packages, name)
},
packageJson = function (name) {
return path.join(project(name), 'package.json')
},
cache = function (name) {
return path.join(cachePath, name);
},
coverage = function (name) {
return path.join(coveragePath, name);
};
const glob = function (glob) {
return glob.replace(/\\/g, '/');
},
libRoot = function (name) {
return path.join(project(name), libDir);
},
lib = function (name) {
return path.join(libRoot(name), '**', '*.ts');
},
libGlob = function (name) {
return glob(lib(name));
},
allLibGlob = libGlob('*'),
relativeLibGlob = function (name) {
return glob(path.relative(root, lib(name)));
},
relativeAllLibGlob = relativeLibGlob('*'),
test = function (name) {
return path.join(project(name), testDir, '**', '*.ts');
},
testGlob = function (name) {
return glob(test(name));
},
allTestGlob = testGlob('*'),
dist = function (name) {
return path.join(project(name), distDir);
},
allDist = path.join(dist('*'), '**', '*'),
allDistGlob = glob(allDist),
relativeAllDistGlob = glob(path.relative(root, allDist));
module.exports = {
cwd,
root,
buildDir,
cacheDir,
coverageDir,
tslint,
buildPath,
cachePath,
coveragePath,
packagesDir,
libDir,
testDir,
distDir,
packages,
project,
tsconfig,
packageJson,
cache,
coverage,
glob,
libRoot,
lib,
libGlob,
allLibGlob,
relativeLibGlob,
relativeAllLibGlob,
test,
testGlob,
allTestGlob,
dist,
allDist,
allDistGlob,
relativeAllDistGlob,
};