11hidden=[".config", ".github", ".gitignore", ".prettierrc", "quick-start", "react-chat"]
22
33run = """
4- if [ ! -x "$(command -v feathers)" ]; then
5- npm i -g @feathersjs/cli
6- fi
7-
84cd feathers-chat-ts
9- clear
105npm run dev
116""" # """
127
138compile = """ # Runs before debug too. Lacks custom env vars.
9+ SECONDS=0
10+ FEATHERS_DIR="feathers-chat-ts"
1411clear
15- echo Running compile...
16- if [ ! -d "feathers-chat-ts/node_modules" ]; then
17- cd feathers-chat-ts
18- npm i
19- npm run compile
20- npm run migrate
12+ echo [compile]
13+
14+ if [ ! -d "$FEATHERS_DIR/node_modules" ]; then
15+ cd $FEATHERS_DIR
16+ npm i &> /dev/null
17+ export PERF1=$SECONDS
18+ # npm run migrate # Most of the time, optional
19+
20+ # For TS clients
21+ # npm run compile # Drastically faster dev cold boot without
22+ # npm run bundle:client # Generates .tgz types for loading into TS clients
23+
24+ export PERF2=$(($SECONDS - $PERF1))
2125 cd -
2226fi
2327
2428# Helper script to deal with lack of CWD support in the Debugger
2529mkdir -p .config
2630if [ ! -f "./.config/replit.mjs" ]; then
2731cat << EOF > ./.config/replit.mjs
28- // Resolve FEATHERS_DIR path and cd to it
29- console.log(process.env.NODE_PATH)
3032if (process.env.FEATHERS_DIR) {
31- const p = process.env.FEATHERS_DIR
32- const f = new Function('return \\`' + p + '\\`;').call(process.env)
33- process.chdir(f)
33+ process.chdir(process.env.FEATHERS_DIR)
3434}
3535EOF
3636fi
3737
38+ rm tsconfig.json 2> /dev/null || : # Cleanup upstream debris
39+
3840if [ ! -f "./.config/bashrc" ]; then
3941cat << EOF > ./.config/bashrc
4042#!/bin/bash
41- node --version
43+ echo Node version: "$( node --version)"
4244EOF
4345fi
4446
45- rm tsconfig.json 2> /dev/null || : # Cleanup upstream debris
47+ INDEX_TS="$FEATHERS_DIR/src/index.ts"
48+ if ! grep -q "console.time" "$INDEX_TS"; then
49+ sed -i "1i console.time('App startup time')" "$INDEX_TS"
50+ sed -i "/Feathers app listening on /a console.timeEnd('App startup time')" "$INDEX_TS"
51+ clear
52+ echo "[compile] took ${SECONDS}s. ($PERF1 + $PERF2)"
53+ else
54+ clear
55+ fi
4656""" # """
4757
4858
@@ -65,21 +75,17 @@ externalPort = 9000
6575channel = "stable-22_11"
6676
6777[env]
68- PATH = "/home/runner/$REPL_SLUG/.config/npm/node_global/bin:/home/runner/$REPL_SLUG/node_modules/.bin"
78+ FEATHERS_DIR = "feathers-chat-ts"
79+ 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"
6980EDITOR="replit-git-editor"
70- npm_config_yes="true"
7181npm_config_prefix = "/home/runner/$REPL_SLUG/.config/npm/node_global"
7282HOSTNAME="0.0.0.0"
7383NODE_OPTIONS="--max_old_space_size=384"
7484
75- # Enables Secrets and Repl Auth, without the erratic Replit packagers
85+ # Enables Secrets and Auth, without the Replit packager
7686[packager]
7787language = "bash"
7888
79- # Todo: Currently uses mocha by default, use npm run test instead or Test Runner
80- # [unitTest]
81- # language = "nodejs"
82-
8389[languages.typescript]
8490pattern = "**/{*.ts,*.js,*.tsx,*.jsx}"
8591syntax = "typescript"
@@ -133,5 +139,4 @@ support = true
133139
134140 [debugger.interactive.launchMessage.arguments.env]
135141 PORT = 9000
136- FEATHERS_DIR = "${this.HOME}/${this.REPL_SLUG}/feathers-chat-ts"
137142
0 commit comments