Skip to content

Commit

Permalink
Use JavaScript instead of TypeScript for CI scripts (#438)
Browse files Browse the repository at this point in the history
* ci: convert to javascript

* ci: remove tsconfig.json

* ci: remove unused packages from package.json

* ci: add package-lock.json to .gitignore

* ci: fix file extension in workflows

* chore: update AdminUI npm packages to fix vulnerability

* chore: undo unintentionally committed changes

* chore: .vscode/settings.json
  • Loading branch information
tnotheis authored Dec 11, 2023
1 parent f547e8e commit e048aa0
Show file tree
Hide file tree
Showing 29 changed files with 210 additions and 208 deletions.
1 change: 1 addition & 0 deletions .ci/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm -T
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm -T
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm -T
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";
Expand Down
2 changes: 1 addition & 1 deletion .ci/checkFormatting.ts → .ci/checkFormatting.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm -T
#!/usr/bin/env node

import { $ } from "zx";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm -T
#!/usr/bin/env node

import { echo } from "zx";
import { getRequiredEnvVar } from "./lib.js";
Expand Down
8 changes: 8 additions & 0 deletions .ci/fsc/buildContainerImage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";

const tag = getRequiredEnvVar("TAG");

await $`docker build --file ./Modules/Files/src/Files.Jobs.SanityCheck/Dockerfile --tag ghcr.io/nmshd/backbone-files-sanity-check:${tag} .`;
8 changes: 8 additions & 0 deletions .ci/fsc/pushContainerImage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";

const tag = getRequiredEnvVar("TAG");

await $`docker push ghcr.io/nmshd/backbone-files-sanity-check:${tag}`;
3 changes: 1 addition & 2 deletions .ci/helm/buildChart.ts → .ci/helm/buildChart.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env -S npx ts-node --esm -T
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";
import { readFile, writeFile, copyFile, rename, rm } from "fs/promises";

const version = getRequiredEnvVar("VERSION");

Expand Down
2 changes: 1 addition & 1 deletion .ci/helm/pushChart.ts → .ci/helm/pushChart.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm -T
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";
Expand Down
6 changes: 3 additions & 3 deletions .ci/lib.ts → .ci/lib.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { chalk, $ } from "zx";
import { $, chalk } from "zx";

export function getRequiredEnvVar(envVarName: string) {
export function getRequiredEnvVar(envVarName) {
var envVar = $.env[envVarName];
if (!envVar) {
console.error(chalk.red(`The environment variable '${envVarName}' is required, but was not set.`));
Expand All @@ -9,7 +9,7 @@ export function getRequiredEnvVar(envVarName: string) {
return envVar;
}

export function toCamelCase(input: string) {
export function toCamelCase(input) {
const first = input.charAt(0).toLowerCase();
const remaining = input.substring(1);
const result = first + remaining;
Expand Down
4 changes: 1 addition & 3 deletions .ci/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"type": "module",
"devDependencies": {
"zx": "^7.2.0",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
"zx": "^7.2.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm -T
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar, toCamelCase } from "../lib.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar, toCamelCase } from "../lib.js";
Expand Down
2 changes: 1 addition & 1 deletion .ci/test.ts → .ci/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S npx ts-node --esm
#!/usr/bin/env node

import { $ } from "zx";

Expand Down
12 changes: 0 additions & 12 deletions .ci/tsconfig.json

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/publish-aapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from git tag
id: extract-version-from-git-tag
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.ts)" >> $GITHUB_OUTPUT
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT
env:
GIT_TAG: ${{ github.ref_name }}
- name: Build Container Image
run: ./.ci/aapi/buildContainerImage.ts
run: ./.ci/aapi/buildContainerImage.js
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
- name: Push Container Image
run: ./.ci/aapi/pushContainerImage.ts
run: ./.ci/aapi/pushContainerImage.js
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
6 changes: 3 additions & 3 deletions .github/workflows/publish-acli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from git tag
id: extract-version-from-git-tag
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.ts)" >> $GITHUB_OUTPUT
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT
env:
GIT_TAG: ${{ github.ref_name }}
- name: Build Container Image
run: ./.ci/acli/buildContainerImage.ts
run: ./.ci/acli/buildContainerImage.js
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
- name: Push Container Image
run: ./.ci/acli/pushContainerImage.ts
run: ./.ci/acli/pushContainerImage.js
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
6 changes: 3 additions & 3 deletions .github/workflows/publish-aui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from git tag
id: extract-version-from-git-tag
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.ts)" >> $GITHUB_OUTPUT
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT
env:
GIT_TAG: ${{ github.ref_name }}
- name: Build Image
run: ./.ci/aui/buildContainerImage.ts
run: ./.ci/aui/buildContainerImage.js
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
- name: Push Image
run: ./.ci/aui/pushContainerImage.ts
run: ./.ci/aui/pushContainerImage.js
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
6 changes: 3 additions & 3 deletions .github/workflows/publish-capi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from git tag
id: extract-version-from-git-tag
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.ts)" >> $GITHUB_OUTPUT
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT
env:
GIT_TAG: ${{ github.ref_name }}
- name: Build Container Image
run: ./.ci/capi/buildContainerImage.ts
run: ./.ci/capi/buildContainerImage.js
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
- name: Push Container Image
run: ./.ci/capi/pushContainerImage.ts
run: ./.ci/capi/pushContainerImage.js
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
6 changes: 3 additions & 3 deletions .github/workflows/publish-fsc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from git tag
id: extract-version-from-git-tag
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.ts)" >> $GITHUB_OUTPUT
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT
env:
GIT_TAG: ${{ github.ref_name }}
- name: Build Container Image
run: ./.ci/sc/buildContainerImage.ts
run: ./.ci/sc/buildContainerImage.js
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
MODULE: Files
- name: Push Container Image
run: ./.ci/sc/pushContainerImage.ts
run: ./.ci/sc/pushContainerImage.js
env:
TAG: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
MODULE: Files
6 changes: 3 additions & 3 deletions .github/workflows/publish-helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from git tag
id: extract-version-from-git-tag
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.ts)" >> $GITHUB_OUTPUT
run: echo "VERSION=$(./.ci/extractVersionFromGitTag.js)" >> $GITHUB_OUTPUT
env:
GIT_TAG: ${{ github.ref_name }}
- name: Build Helm Chart
run: ./.ci/helm/buildChart.ts
run: ./.ci/helm/buildChart.js
env:
VERSION: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
- name: Push Helm Chart
run: ./.ci/helm/pushChart.ts
run: ./.ci/helm/pushChart.js
env:
VERSION: ${{ steps.extract-version-from-git-tag.outputs.VERSION }}
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
dotnet-version: "7.0.x"
- name: Check formatting
run: ./.ci/checkFormatting.ts
run: ./.ci/checkFormatting.js

test:
runs-on: ubuntu-latest
Expand All @@ -45,7 +45,7 @@ jobs:
with:
dotnet-version: "7.0.x"
- name: Run tests
run: ./.ci/test.ts
run: ./.ci/test.js

integration-test-sqlserver:
name: Run Integration Tests (on SQL Server)
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
- name: Install script dependencies
run: npm install --prefix ./.ci
- name: Build Helm Chart
run: ./.ci/helm/buildChart.ts
run: ./.ci/helm/buildChart.js
env:
VERSION: 0.0.0

Expand All @@ -183,7 +183,7 @@ jobs:
- name: Install script dependencies
run: npm install --prefix ./.ci
- name: Build image
run: ./.ci/capi/buildContainerImage.ts
run: ./.ci/capi/buildContainerImage.js
env:
TAG: test

Expand All @@ -196,7 +196,7 @@ jobs:
- name: Install script dependencies
run: npm install --prefix ./.ci
- name: Build image
run: ./.ci/aui/buildContainerImage.ts
run: ./.ci/aui/buildContainerImage.js
env:
TAG: test

Expand All @@ -209,7 +209,7 @@ jobs:
- name: Install script dependencies
run: npm install --prefix ./.ci
- name: Build image
run: ./.ci/acli/buildContainerImage.ts
run: ./.ci/acli/buildContainerImage.js
env:
TAG: test

Expand All @@ -222,7 +222,7 @@ jobs:
- name: Install script dependencies
run: npm install --prefix ./.ci
- name: Build image
run: ./.ci/fsc/buildContainerImage.ts
run: ./.ci/fsc/buildContainerImage.js
env:
TAG: test
MODULE: Files
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"editor.formatOnPaste": true,
"files.autoSave": "off",
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
},
"files.eol": "\n"
}
Loading

0 comments on commit e048aa0

Please sign in to comment.