diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b860470d5..a3876f11b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2,36 +2,36 @@ name: CI
on: [push, pull_request]
jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v2
- with:
- node-version: "15"
-
- - name: Install system dependencies
- run: sudo apt update && sudo apt-get -y install libusb-1.0-0-dev libasound2-dev libudev-dev
-
- - name: Install nodejs dependencies
- run: npm ci && npm run bootstrap
-
- - name: Build TS
- run: npm run build
-
- tests:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v2
- with:
- node-version: "15"
-
- - name: Install system dependencies
- run: sudo apt update && sudo apt-get -y install libusb-1.0-0-dev libasound2-dev libudev-dev
-
- - name: Install nodejs dependencies
- run: npm ci && npm run bootstrap
-
- - name: Run tests
- run: npm run coverage -- --verbose
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-node@v2
+ with:
+ node-version: "15"
+
+ - name: Install system dependencies
+ run: sudo apt update && sudo apt-get -y install libusb-1.0-0-dev libasound2-dev libudev-dev
+
+ - name: Install nodejs dependencies
+ run: npm ci
+
+ - name: Build TS
+ run: npm run build
+
+ tests:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-node@v2
+ with:
+ node-version: "15"
+
+ - name: Install system dependencies
+ run: sudo apt update && sudo apt-get -y install libusb-1.0-0-dev libasound2-dev libudev-dev
+
+ - name: Install nodejs dependencies
+ run: npm ci
+
+ - name: Run tests
+ run: npm run coverage -- --verbose
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index a6fc07525..b6051bfd7 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -1,41 +1,39 @@
-
name: Update docs
on:
- push:
- branches:
- - master
- - "release/**"
+ push:
+ branches:
+ - master
+ - "release/**"
jobs:
- build:
- runs-on: ubuntu-latest
- if: startsWith(github.repository, 'codeoverflow-org') # don't run this in forks
- steps:
-
- - name: Setup Python
- uses: actions/setup-python@v2
- with:
- python-version: 3.8.3
-
- - uses: actions/checkout@v2
-
- - name: Checkout docs
- uses: actions/checkout@v2
- with:
- repository: codeoverflow-org/nodecg-io-docs
- path: docs
- ssh-key: ${{ secrets.DOCS_SSH_KEY }}
- ref: ${{ github.ref }}
+ build:
+ runs-on: ubuntu-latest
+ if: startsWith(github.repository, 'codeoverflow-org') # don't run this in forks
+ steps:
+ - name: Setup Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.8.3
+
+ - uses: actions/checkout@v2
+
+ - name: Checkout docs
+ uses: actions/checkout@v2
+ with:
+ repository: codeoverflow-org/nodecg-io-docs
+ path: docs
+ ssh-key: ${{ secrets.DOCS_SSH_KEY }}
+ ref: ${{ github.ref }}
- - name: Build docs
- run: python .scripts/build-docs.py
+ - name: Build docs
+ run: python .scripts/build-docs.py
- - name: GitHub Push
- run: |
- cd docs
- git config --global user.email "<>"
- git config --global user.name "codeoverflow-org"
- git add .
- git diff-index --quiet HEAD || git commit --message "Update generated documentation (codeoverflow-org/nodecg-io@${{ github.sha }})"
- git push origin "${GITHUB_REF#refs/heads/}"
+ - name: GitHub Push
+ run: |
+ cd docs
+ git config --global user.email "<>"
+ git config --global user.name "codeoverflow-org"
+ git add .
+ git diff-index --quiet HEAD || git commit --message "Update generated documentation (codeoverflow-org/nodecg-io@${{ github.sha }})"
+ git push origin "${GITHUB_REF#refs/heads/}"
diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
index 3c7f11c9e..8b6ef85b2 100755
--- a/.github/workflows/lint.yaml
+++ b/.github/workflows/lint.yaml
@@ -2,16 +2,20 @@ name: Linter
on: pull_request
jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
- - uses: actions/setup-node@v2
- with:
- node-version: "15"
+ - uses: actions/setup-node@v2
+ with:
+ node-version: "15"
- - name: Install nodejs dependencies
- run: npm i
- - name: Run ESLint
- run: npm run lint
\ No newline at end of file
+ - name: Install system dependencies
+ run: sudo apt update && sudo apt-get -y install libusb-1.0-0-dev libasound2-dev libudev-dev
+
+ - name: Install nodejs dependencies
+ run: npm i
+
+ - name: Run ESLint
+ run: npm run lint
diff --git a/.gitignore b/.gitignore
index eb110d88b..fb3b6a16a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,12 @@ node_modules/
# generated type definitions
*.d.ts
+# generated source mapping files
+*.d.ts.map
+
+# generated build info
+*.tsbuildinfo
+
# Coverage reports by jest
coverage
diff --git a/.scripts/create-service.py b/.scripts/create-service.py
index d4c0e25da..ba7584a04 100755
--- a/.scripts/create-service.py
+++ b/.scripts/create-service.py
@@ -2,7 +2,7 @@
# What this file does:
# + It creates all required files for a new nodecg-io service
-# + It copies version and dependency information (e.q fpr typescript) from noodecg-io-template
+# + It copies version and dependency information (e.g., for typescript) from noodecg-io-template
# + It'll also create a sample and the files for the docs
#
# Requirements:
@@ -22,7 +22,7 @@
service_name_c = service_name.replace("-", " ").title().replace(" ", "")
service_name_cc = service_name_c[0].lower() + service_name_c[1:]
- with open('nodecg-io-template/package.json') as file:
+ with open('services/nodecg-io-template/package.json') as file:
package = json.loads(file.read())
# Replace some entries from the template package.json
@@ -33,17 +33,19 @@
'name': author_name,
'url': author_url
}
- package['repository']['directory'] = f'nodecg-io-{service_name}'
+ package['repository']['directory'] = f'services/nodecg-io-{service_name}'
- os.mkdir(f'nodecg-io-{service_name}')
- with open(f'nodecg-io-{service_name}/package.json', mode='w') as file:
+ os.mkdir(f'services/nodecg-io-{service_name}')
+ with open(f'services/nodecg-io-{service_name}/package.json', mode='w') as file:
file.write(json.dumps(package, indent=4))
- shutil.copy('nodecg-io-template/schema.json', f'nodecg-io-{service_name}/schema.json')
- shutil.copy('nodecg-io-template/tsconfig.json', f'nodecg-io-{service_name}/tsconfig.json')
+ shutil.copy('services/nodecg-io-template/schema.json',
+ f'services/nodecg-io-{service_name}/schema.json')
+ shutil.copy('services/nodecg-io-template/tsconfig.json',
+ f'services/nodecg-io-{service_name}/tsconfig.json')
- os.mkdir(f'nodecg-io-{service_name}/extension')
- with open(f'nodecg-io-{service_name}/extension/index.ts', mode='w') as file:
+ os.mkdir(f'services/nodecg-io-{service_name}/extension')
+ with open(f'services/nodecg-io-{service_name}/extension/index.ts', mode='w') as file:
file.writelines([
'import { NodeCG } from "nodecg-types/types/server";\n',
'import { Result, emptySuccess, success, ServiceBundle } from "nodecg-io-core";\n',
@@ -83,7 +85,7 @@
'}\n'
])
- with open(f'nodecg-io-{service_name}/extension/{service_name_cc}Client.ts', mode='w') as file:
+ with open(f'services/nodecg-io-{service_name}/extension/{service_name_cc}Client.ts', mode='w') as file:
file.writelines([
f'import {{ {service_name_c}Config }} from "./index";\n',
'\n',
@@ -119,7 +121,16 @@
with open(f'samples/{sample_name}/package.json', mode='w') as file:
file.write(json.dumps(sample_package, indent=4))
- shutil.copy('samples/template/tsconfig.json', f'samples/{sample_name}/tsconfig.json')
+ with open('samples/template/tsconfig.json') as file:
+ sample_tsconfig = json.loads(file.read())
+
+ # Replace reference in template tsconfig.json
+
+ sample_tsconfig['references'][1]["path"] = sample_tsconfig['references'][1]["path"].replace(
+ 'template', service_name)
+
+ with open(f'samples/{sample_name}/tsconfig.json', mode='w') as file:
+ file.write(json.dumps(sample_tsconfig, indent=4))
os.mkdir(f'samples/{sample_name}/extension')
with open(f'samples/{sample_name}/extension/index.ts', mode='w') as file:
@@ -157,6 +168,7 @@
'You can help us [create it](../contribute/sample_documentation.md).'
])
- os.system('npm run bsb')
+ os.system('npm install')
+ os.system('npm run rebuild')
print(f"\n\nService {service_name_c} created. Please add it to mkdocs.yml")
diff --git a/.scripts/update-paths.mjs b/.scripts/update-paths.mjs
new file mode 100644
index 000000000..dac1c12c0
--- /dev/null
+++ b/.scripts/update-paths.mjs
@@ -0,0 +1,22 @@
+import * as fs from "fs";
+
+const DIRS = ["./samples", "./services", "./utils"];
+
+for (const dir of DIRS) {
+ let tsconfig = {
+ files: [],
+ references: []
+ }
+ let contents = fs.opendirSync(dir);
+ let item;
+ while ((item = contents.readSync()) !== null) {
+ if (item.isDirectory() && fs.readdirSync(`${dir}/${item.name}`).includes("tsconfig.json")) {
+ tsconfig.references.push({
+ path: "./" + item.name
+ })
+ }
+ }
+
+ let content = "// This file will be overwritten automatically! Do not store options here.\n" + JSON.stringify(tsconfig)
+ fs.writeFileSync(dir + "/tsconfig.json", content, { encoding: "utf8" });
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 0a5633abd..38e27c577 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -2,8 +2,14 @@
// Hides js, js map and ts definition files, that are generated by the build process, in the explorer windows of vs code
"vscode.tsc.compiler.alertTSConfigChanges": "never",
"files.exclude": {
- "**/*.js": { "when": "$(basename).ts" },
+ "**/*.js": {
+ "when": "$(basename).ts"
+ },
"**/*.js.map": true,
- "**/*.d.ts": { "when": "$(basename).ts" }
+ "**/*.d.ts": {
+ "when": "$(basename).ts"
+ },
+ "**/*.d.ts.map": true,
+ "**/*.tsbuildinfo": true
}
}
diff --git a/lerna.json b/lerna.json
deleted file mode 100644
index b9c8466d1..000000000
--- a/lerna.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "packages": ["nodecg-io-*", "nodecg-io-core/dashboard", "samples/*", "utils/*"],
- "version": "0.2.0"
-}
diff --git a/nodecg-io-ahk/tsconfig.json b/nodecg-io-ahk/tsconfig.json
deleted file mode 100644
index 1c8405620..000000000
--- a/nodecg-io-ahk/tsconfig.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": "../tsconfig.common.json"
-}
diff --git a/nodecg-io-android/tsconfig.json b/nodecg-io-android/tsconfig.json
deleted file mode 100644
index 1c8405620..000000000
--- a/nodecg-io-android/tsconfig.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": "../tsconfig.common.json"
-}
diff --git a/nodecg-io-artnet/tsconfig.json b/nodecg-io-artnet/tsconfig.json
deleted file mode 100644
index 1c8405620..000000000
--- a/nodecg-io-artnet/tsconfig.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": "../tsconfig.common.json"
-}
diff --git a/nodecg-io-core/dashboard/bundles.ts b/nodecg-io-core/dashboard/bundles.ts
index 08825e4ce..e2530b646 100644
--- a/nodecg-io-core/dashboard/bundles.ts
+++ b/nodecg-io-core/dashboard/bundles.ts
@@ -77,8 +77,9 @@ export function renderInstanceSelector(): void {
return;
}
- const currentInstance = config.data.bundles[bundle]?.find((dep) => dep.serviceType === serviceType)
- ?.serviceInstance;
+ const currentInstance = config.data.bundles[bundle]?.find(
+ (dep) => dep.serviceType === serviceType,
+ )?.serviceInstance;
let index = 0;
for (let i = 0; i < selectBundleInstance.options.length; i++) {
diff --git a/nodecg-io-core/dashboard/package.json b/nodecg-io-core/dashboard/package.json
index 446c3d93f..2c9e83cee 100644
--- a/nodecg-io-core/dashboard/package.json
+++ b/nodecg-io-core/dashboard/package.json
@@ -7,7 +7,6 @@
},
"devDependencies": {
"clean-webpack-plugin": "^3.0.0",
- "ts-loader": "^9.1.2",
"typescript": "^4.2.4",
"webpack": "^5.36.2",
"webpack-cli": "^4.7.0"
diff --git a/nodecg-io-core/dashboard/panel.html b/nodecg-io-core/dashboard/panel.html
index b7507fc51..1dffd0ce4 100644
--- a/nodecg-io-core/dashboard/panel.html
+++ b/nodecg-io-core/dashboard/panel.html
@@ -93,9 +93,9 @@
-
+