Pre-typescript compile releases

- build the release in-place in out/dist
- run the `tsc` compiler on the code so everything
  is pre-transpiled
This commit is contained in:
Matt Godbolt
2022-04-26 13:36:23 -05:00
parent 09df855cdb
commit 6872fd06d4
3 changed files with 37 additions and 21 deletions
+1 -1
View File
@@ -119,7 +119,7 @@ if (opts.tmpDir) {
process.env.winTmp = path.join('/mnt', driveLetter, directoryPath);
}
const distPath = utils.resolvePathFromAppRoot('out', 'dist');
const distPath = utils.resolvePathFromAppRoot('.');
const gitReleaseName = (() => {
// Use the canned git_hash if provided
+30 -16
View File
@@ -2,10 +2,11 @@
set -euo pipefail
cd "$(
ROOT="$(
cd -- "$(dirname "$0")/../.." >/dev/null 2>&1
pwd -P
)"
cd "$ROOT"
RELEASE_FILE_NAME=${GITHUB_RUN_NUMBER}
RELEASE_NAME=gh-${RELEASE_FILE_NAME}
@@ -14,34 +15,47 @@ HASH=$(git rev-parse HEAD)
# Clear the output
rm -rf out/dist
mkdir -p out/dist
echo "${HASH}" >out/dist/git_hash
echo "${RELEASE_NAME}" >out/dist/release_build
cd out/dist
echo "${HASH}" >git_hash
echo "${RELEASE_NAME}" >release_build
cp -R "${ROOT}"/etc \
"${ROOT}"/examples \
"${ROOT}"/static \
"${ROOT}"/views \
"${ROOT}"/types \
"${ROOT}"/package*.json \
.
rm -rf "${ROOT}"/lib/storage/data
# Create any autogenerated files.
python3 ./etc/scripts/util/changelog.py
python3 ./etc/scripts/util/politic.py
python3 "${ROOT}/etc/scripts/util/changelog.py"
python3 "${ROOT}/etc/scripts/util/politic.py"
# Set up and build and webpack everything
rm -rf node_modules
cd "${ROOT}"
npm install --no-audit
npm run webpack
npm run ts-compile
# Now install only the production dependencies
# Now install only the production dependencies in our output directory
cd out/dist
rm -rf node_modules
npm install --no-audit --production
npm install --no-audit --ignore-scripts --production
rm -rf node_modules/.cache/ node_modules/monaco-editor/
# Output some magic for GH to set the branch name and release name
echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
echo "::set-output name=release_name::${RELEASE_NAME}"
# Run to make sure we haven't just made something that won't work
node -r esm -r ts-node/register ./app.js --version --dist
node -r esm ./app.js --version --dist
rm -rf out/dist-bin
mkdir -p out/dist-bin
rm -rf "${ROOT}/out/dist-bin"
mkdir -p "${ROOT}/out/dist-bin"
export XZ_OPT="-1 -T 0"
tar -Jcf "out/dist-bin/${RELEASE_FILE_NAME}.tar.xz" -T gh-dist-files.txt
tar -Jcf "out/dist-bin/${RELEASE_FILE_NAME}.static.tar.xz" --transform="s,^out/dist/static/,," out/dist/static/*
echo "${HASH}" >"out/dist-bin/${RELEASE_FILE_NAME}.txt"
du -ch out/**/*
tar -Jcf "${ROOT}/out/dist-bin/${RELEASE_FILE_NAME}.tar.xz" --exclude static .
tar -Jcf "${ROOT}/out/dist-bin/${RELEASE_FILE_NAME}.static.tar.xz" --transform="s,^static/,," static/*
echo "${HASH}" >"${RELEASE_FILE_NAME}.txt"
du -ch ./*
+6 -4
View File
@@ -1,17 +1,19 @@
{
"extends": "./tsconfig.base.json",
"include": ["lib/**/*"],
"exclude": ["static/**/*"],
"files": ["app.js"],
"include": ["**/*.js", "**/*.ts"],
"exclude": ["out", "etc", "examples", "static", "**/*.d.ts"],
"compilerOptions": {
/* Module resolution */
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
/* Code generation */
"outDir": "./out/app",
"outDir": "./out/dist",
"typeRoots": ["./typings", "./node_modules/@types"],
/* Other options */
"strict": true,
"noImplicitAny": false
"noImplicitAny": false,
"allowJs": true
}
}