-
Notifications
You must be signed in to change notification settings - Fork 248
/
.replit
174 lines (142 loc) · 4.46 KB
/
.replit
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
167
168
169
170
171
172
173
hidden=[
".config", ".github", ".gitignore", ".prettierrc", "quick-start", "react-chat",
"feathers-chat-ts/node_modules", "react-chat/node_modules", "quick-start/node_modules"
]
run = """
cd feathers-chat-ts
npm run dev
""" # """
compile = """ # Runs before debug too. Lacks custom env vars.
SECONDS=0
FEATHERS_DIR="feathers-chat-ts"
FEATHERS_ORIGIN="https://${REPL_SLUG,,}.${REPL_OWNER,,}.repl.co"
clear
echo [compile]
if [ ! -d "$FEATHERS_DIR/node_modules" ]; then
cd $FEATHERS_DIR
npm i &> /dev/null
# For TS clients
# npm run compile # Drastically faster dev cold boot without
# npm run bundle:client # Generates .tgz types for loading into TS clients
cd -
fi
PERF1=$SECONDS
# Sets up the tables, login will not work without this!
if [ ! -f "$FEATHERS_DIR/feathers-chat.sqlite" ]; then
sh -c "cd '$FEATHERS_DIR'; npm run migrate"
fi
PERF2=$(($SECONDS - $PERF1))
# Helper script to deal with lack of CWD support in the Debugger
mkdir -p .config
if [ ! -f "./.config/replit.mjs" ]; then
cat << EOF > ./.config/replit.mjs
if (process.env.FEATHERS_DIR) {
process.chdir(process.env.FEATHERS_DIR)
}
EOF
fi
rm tsconfig.json 2> /dev/null || : # Cleanup upstream debris
if [ ! -f "./.config/bashrc" ]; then
cat << EOF > ./.config/bashrc
#!/bin/bash
echo Node version: "\\$(node --version)"
EOF
fi
# Append origin for OAuth. Alternatively, set it as an env var
CONFIG_FILE="$FEATHERS_DIR/config/default.json"
if ! grep -q "$FEATHERS_ORIGIN" "$CONFIG_FILE"; then
sed -i "/\\"origins\\"/a \\ \\"$FEATHERS_ORIGIN\\"," "$CONFIG_FILE"
fi
INDEX_TS="$FEATHERS_DIR/src/index.ts"
if ! grep -q "console.time" "$INDEX_TS"; then
sed -i "/Feathers app listening on /a \\
\\ logger.info(\\`Remote: \\${process.env.FEATHERS_ORIGIN?.toLowerCase()}\\`)\\n\\
console.timeEnd('App startup time')" "$INDEX_TS"
sed -i "1i console.time('App startup time')" "$INDEX_TS"
clear
echo "[compile] took ${SECONDS}s. ($PERF1 + $PERF2)"
else
clear
fi
""" # """
[[hints]]
regex = "Error: listen EADDRINUSE: address already in use"
message = "Try closing all web clients before running from the debugger or the shell."
# Ports
# ==============================
# https://docs.replit.com/programming-ide/configuring-repl#ports
# If you use an undefined port, your container may crash!
# Server port
[[ports]]
localPort = 3030
externalPort = 80
# Server's test env port
[[ports]]
localPort = 8998
externalPort = 8998
# Server debugging port
[[ports]]
localPort = 9000
externalPort = 9000
# React client
[[ports]]
localPort = 3000
externalPort = 3000
[nix]
channel = "stable-22_11"
[env]
FEATHERS_DIR = "feathers-chat-ts"
PATH = "/home/runner/$REPL_SLUG/.config/npm/node_global/bin:/home/runner/$REPL_SLUG/node_modules/.bin:/home/runner/$REPL_SLUG/$FEATHERS_DIR/node_modules/.bin"
EDITOR = "replit-git-editor"
npm_config_prefix = "/home/runner/$REPL_SLUG/.config/npm/node_global"
HOSTNAME = "0.0.0.0"
FEATHERS_ORIGIN = "https://${REPL_SLUG}.${REPL_OWNER}.repl.co"
NODE_OPTIONS = "--max_old_space_size=384"
# Enables Secrets and Auth, without the Replit packager
[packager]
language = "bash"
[languages.typescript]
pattern = "**/{*.ts,*.js,*.tsx,*.jsx}"
syntax = "typescript"
[languages.typescript.languageServer]
start = [ "typescript-language-server", "--stdio" ]
[debugger]
support = true
[debugger.interactive]
transport = "localhost:0"
startCommand = [ "dap-node" ]
[debugger.interactive.initializeMessage]
command = "initialize"
type = "request"
[debugger.interactive.initializeMessage.arguments]
clientID = "replit"
clientName = "replit.com"
columnsStartAt1 = true
linesStartAt1 = true
locale = "en-us"
pathFormat = "path"
supportsInvalidatedEvent = true
supportsProgressReporting = true
supportsRunInTerminalRequest = true
supportsVariablePaging = true
supportsVariableType = true
[debugger.interactive.launchMessage]
command = "launch"
type = "request"
[debugger.interactive.launchMessage.arguments]
runtimeArgs = [
"--import", "./.config/replit.mjs",
"--loader", "./feathers-chat-ts/node_modules/ts-node/esm/transpile-only.mjs"
]
args = []
console = "externalTerminal"
cwd = "."
environment = []
pauseForSourceMap = false
program = "feathers-chat-ts/src/index.ts"
request = "launch"
sourceMaps = true
stopOnEntry = false
type = "pwa-node"
[debugger.interactive.launchMessage.arguments.env]
PORT = 9000