-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathbuild-test-package.sh
More file actions
executable file
·84 lines (72 loc) · 1.92 KB
/
build-test-package.sh
File metadata and controls
executable file
·84 lines (72 loc) · 1.92 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
#!/bin/bash
set -euxo pipefail
# Navigate to the repository root
cd "$(dirname "$0")/.."
ROOT="$(pwd)"
# npm pack the repository
rm -f replit-codemirror-vim-*.tgz
npm pack
# Get the name of the packed file
PACKAGE_FILE=$(ls replit-codemirror-vim-*.tgz | sort -V | tail -n 1)
mv "$PACKAGE_FILE" replit-codemirror-vim-latest.tgz
rm -rf ../.test_package
mkdir -p ../.test_package
cd ../.test_package
cp "$ROOT"/dev/index.ts index.ts
cp "$ROOT"/dev/index.html index.html
node -e "
const fs = require('fs');
const filePath = 'index.ts';
let data = fs.readFileSync(filePath, 'utf8');
data = data.replace(/\"..\/src\/index\" \/\//g, '');
fs.writeFileSync(filePath, data, 'utf8');
"
echo '{
"name": "test_package",
"scripts": {
"build": "tsc",
"test": "echo \"No tests yet\""
}
}' > package.json
echo '
import { defineConfig } from "vite";
export default defineConfig({
base: "",
});' > vite.config.js
echo '{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"target": "es2020",
"moduleResolution": "node"
},
"include": ["*.ts"],
"exclude": ["node_modules"]
}
' > tsconfig.json
# Install the ace package from the npm pack result
npm i "$ROOT"/replit-codemirror-vim-latest.tgz
npm i codemirror @codemirror/lang-javascript @codemirror/lang-xml
# Install TypeScript
npm i typescript@latest
rm -f index.js
npm run build
# Install old version of TypeScript
npm i typescript@4
rm -f index.js
npm run build