-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
166 lines (166 loc) · 4.04 KB
/
test.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
module.exports = {
scripts: {
testing: {
default: {
_default: "echo default",
},
os: {
_win32: "echo Windows",
_default: "echo Not Windows",
},
arch: {
_x64: "echo 64-bit",
_x32: "echo 32-bit",
_arm: "echo ARM",
_arm64: "echo ARM64",
_default: "echo Unknown",
},
args: {
_pre: "echo pre args",
_default: "bsm testing.args.* --",
echo: "echo",
echo2: "echo",
},
array: ["echo 1", "echo 2", "echo 3"],
hooks: {
_pre: "echo pre hooks",
_default: ["echo hooks1", "echo hooks2"],
test: {
_pre: "echo pre test",
_default: "echo test",
},
_post: "echo post",
error: {
_default: "echo error",
_post: "bsm ~.unknown",
_catch: "",
},
},
relative: {
_default: "bsm ~.test",
test: "echo test",
echo: {
_default: "bsm ~._",
_: {
_linux: "echo $BSM_PATH",
_win32: "echo %BSM_PATH%",
_default: `echo ${process.env.BSM_PATH}`,
},
},
array: ["echo $BSM_PATH", "echo %BSM_PATH%"],
},
error: {
onError: {
_default: "exit 4",
_onError: "echo onError",
},
catch: {
_default: "exit 4",
_catch: "echo catch",
},
finally: {
_default: "exit 4",
normal: "exit 0",
_finally: "echo finally",
},
all: {
_default: "exit 4",
normal: "exit 0",
_post: "echo post",
_onError: "echo onError",
_catch: "exit 3",
_finally: "echo finally",
},
_catch: () => `echo ${process.env.BSM_ERROR}`,
},
functions: {
_default: "bsm ~.*",
return: (argv) => {
console.log(`wow cool function bro ${argv}`);
return "echo evil";
},
empty: (argv) => {
console.log(`wow cool function bro ${argv}`);
},
error: {
error() {
throw new Error("wow cool error bro");
},
return() {
return "exit 1";
},
_onError: () => `echo ${process.env.BSM_ERROR}`,
},
_pre: {
_default: "echo pre test",
},
},
env: {
$env: {
TEST: "true",
GLOBAL: "123",
},
_default: () => {
console.log(process.env.TEST);
console.log(process.env.GLOBAL);
},
overrides: {
$env: {
test: "false",
},
_default: () => {
console.log(process.env.test);
console.log(process.env.global);
},
},
file: {
$env: "file:test.env",
_default: () => {
console.log(process.env.TEST);
console.log(process.env.UNMATCH_QUOTE);
console.log(process.env.NEW_LINE_NO_QUOTES);
console.log(process.env.NEW_LINE_SINGLE_QUOTE);
console.log(process.env.NEW_LINE_DOUBLE_QUOTE);
},
},
},
interactive: {
notFound: "bsm ~._notFound",
},
debug: {
_default: "bsm ~.*",
scripts: "bsm --debug scripts",
extends: "bsm --debug extends",
},
alias: {
_default: "bsm ~.n ~.l ~.ls ~.d.n ~.list.test",
normal: {
$alias: "n",
_default: "echo normal",
},
list: {
$alias: ["l", "ls"],
_default: "echo list",
test: "bsm ~.list.t ~.list.n ~.list ~.list.0",
list: [
{
$alias: "t",
_default: "echo test",
},
{
$alias: "n",
_default: "echo new",
},
],
},
deep: {
$alias: "d",
normal: {
$alias: "n",
_default: "echo deep normal",
},
},
},
},
},
};