Skip to content

Commit 022692b

Browse files
authoredAug 9, 2022
chore: Add ci workflow to github actions (#1)
1 parent 235ca32 commit 022692b

File tree

16 files changed

+79
-29
lines changed

16 files changed

+79
-29
lines changed
 

‎.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ indent_style = tab
66
insert_final_newline = true
77
charset = utf-8
88
trim_trailing_whitespace = true
9+
10+
[*.yml]
11+
indent_size = 2
12+
indent_style = space

‎.eslintignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
dist
22
editor/dist/js/*
3-
editor/libs/
3+
editor/deps/
44
*.ts
5+
.coverage
6+
.denoTypes
7+
node_modules
8+
npm_packages

‎.github/workflows/ci.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow will install Deno then run Deno lint and test.
2+
3+
name: ci
4+
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
11+
jobs:
12+
ci:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Setup repo
17+
uses: actions/checkout@v2
18+
19+
- name: Setup Deno
20+
# For more information see: https://github.com/denoland/setup-deno
21+
uses: denoland/setup-deno@v1.1.0
22+
with:
23+
deno-version: "1.24.1"
24+
25+
- name: npm install
26+
run: npm install
27+
28+
- name: Setup Renda
29+
# Sets up a development environment required for type the next steps to pass.
30+
run: deno task dev --no-serve
31+
32+
- name: Install editor dependencies
33+
run: deno task build-editor-dependencies
34+
35+
- name: Type check
36+
run: deno task check
37+
38+
- name: Lint
39+
run: npm run lint
40+
41+
- name: Install puppeteer
42+
run: PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@14.1.1/install.ts
43+
44+
- name: Test
45+
run: deno task test
46+

‎editor/src/keyboardShortcuts/ShorcutConditionValueSetter.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {ShortcutCondition} from "./ShortcutCondition.js";
2-
31
/**
42
* A single valueSetter is used to control the value of ShortcutConditions.
53
* This is to ensure multiple places in the code can control the value of a
@@ -8,7 +6,7 @@ import {ShortcutCondition} from "./ShortcutCondition.js";
86
*/
97
export class ShorcutConditionValueSetter {
108
/**
11-
* @param {ShortcutCondition} condition
9+
* @param {import("./ShortcutCondition.js").ShortcutCondition} condition
1210
* @param {number} priority
1311
*/
1412
constructor(condition, priority = 0) {

‎editor/src/keyboardShortcuts/ShortcutCommand.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {KeyboardShortcutManager} from "./KeyboardShortcutManager.js";
2-
31
/**
42
* - `single` Only fire command once.
53
* - `hold` Activate when the key is down, and deactivate when it is up.
@@ -25,7 +23,7 @@ import {KeyboardShortcutManager} from "./KeyboardShortcutManager.js";
2523
*/
2624
export class ShortcutCommand {
2725
/**
28-
* @param {KeyboardShortcutManager} shortcutManager
26+
* @param {import("./KeyboardShortcutManager.js").KeyboardShortcutManager} shortcutManager
2927
* @param {ShortcutCommandOptions} opts
3028
*/
3129
constructor(shortcutManager, {

‎editor/src/propertiesWindowContent/EntityPropertiesWindowContent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ export class EntityPropertiesWindowContent extends PropertiesWindowContent {
235235
* @param {any} object
236236
* @param {string | number} propertyName
237237
* @param {any} scriptValue
238-
* @param {import("../ui/PropertiesTreeView/PropertiesTreeViewEntry.js").PropertiesTreeViewEntry<any>} guiEntry
238+
* @param {import("../ui/propertiesTreeView/PropertiesTreeViewEntry.js").PropertiesTreeViewEntry<any>} guiEntry
239239
*/
240240
mapFromDroppableGuiValues(object, propertyName, scriptValue, guiEntry) {
241241
if (Array.isArray(scriptValue)) {
242-
const castGuiEntry = /** @type {import("../ui/PropertiesTreeView/PropertiesTreeViewEntry.js").PropertiesTreeViewEntry<import("../ui/ArrayGui.js").ArrayGui<any>>} */ (guiEntry);
242+
const castGuiEntry = /** @type {import("../ui/propertiesTreeView/PropertiesTreeViewEntry.js").PropertiesTreeViewEntry<import("../ui/ArrayGui.js").ArrayGui<any>>} */ (guiEntry);
243243
/** @type {unknown[]} */
244244
const newScriptValue = [];
245245
for (const [i, item] of scriptValue.entries()) {

‎editor/src/ui/TreeView.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ export class TreeView {
140140
#textFieldVisible = false;
141141
#lastTextFocusOutWasFromRow = false;
142142
#lastTextFocusOutTime = 0;
143-
/** @type {import("../KeyboardShortcuts/ShorcutConditionValueSetter.js").ShorcutConditionValueSetter<boolean>?} */
143+
/** @type {import("../keyboardShortcuts/ShorcutConditionValueSetter.js").ShorcutConditionValueSetter<boolean>?} */
144144
#renamingShortcutCondition = null;
145145

146-
/** @type {import("../KeyboardShortcuts/ShorcutConditionValueSetter.js").ShorcutConditionValueSetter<boolean>?} */
146+
/** @type {import("../keyboardShortcuts/ShorcutConditionValueSetter.js").ShorcutConditionValueSetter<boolean>?} */
147147
#focusSelectedShortcutCondition = null;
148148

149149
/**
@@ -276,10 +276,10 @@ export class TreeView {
276276
const editor = getMaybeEditorInstance();
277277
if (editor && editor.keyboardShortcutManager) {
278278
const renamingCondition = editor.keyboardShortcutManager.getCondition("treeView.renaming");
279-
this.#renamingShortcutCondition = /** @type {import("../KeyboardShortcuts/ShorcutConditionValueSetter.js").ShorcutConditionValueSetter<boolean>} */ (renamingCondition.requestValueSetter());
279+
this.#renamingShortcutCondition = /** @type {import("../keyboardShortcuts/ShorcutConditionValueSetter.js").ShorcutConditionValueSetter<boolean>} */ (renamingCondition.requestValueSetter());
280280

281281
const focusSelectedCondition = editor.keyboardShortcutManager.getCondition("treeView.focusSelected");
282-
this.#focusSelectedShortcutCondition = /** @type {import("../KeyboardShortcuts/ShorcutConditionValueSetter.js").ShorcutConditionValueSetter<boolean>} */ (focusSelectedCondition.requestValueSetter());
282+
this.#focusSelectedShortcutCondition = /** @type {import("../keyboardShortcuts/ShorcutConditionValueSetter.js").ShorcutConditionValueSetter<boolean>} */ (focusSelectedCondition.requestValueSetter());
283283
}
284284

285285
this.updateArrowHidden();

‎editor/src/windowManagement/contentWindows/BuiltInAssetsContentWindow.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {ContentWindow} from "./ContentWindow.js";
22
import {TreeView} from "../../ui/TreeView.js";
3-
import {SelectionGroup} from "../../misc/SelectionGroup.js";
43

54
export class BuiltInAssetsContentWindow extends ContentWindow {
65
static contentWindowTypeId = "builtInAssets";
@@ -28,7 +27,7 @@ export class BuiltInAssetsContentWindow extends ContentWindow {
2827

2928
this.contentEl.appendChild(this.treeView.el);
3029

31-
/** @type {SelectionGroup<import("../../assets/ProjectAsset.js").ProjectAssetAny>} */
30+
/** @type {import("../../misc/SelectionGroup.js").SelectionGroup<import("../../assets/ProjectAsset.js").ProjectAssetAny>} */
3231
this.selectionManager = this.editorInstance.selectionManager.createSelectionGroup();
3332

3433
this.init();

‎editor/src/windowManagement/contentWindows/ConnectionsContentWindow.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {ContentWindow} from "./ContentWindow.js";
55
/**
66
* @typedef {Object} ConectionGui
77
* @property {PropertiesTreeView<any>} treeView
8-
* @property {import("../../ui/PropertiesTreeView/PropertiesTreeViewEntry.js").PropertiesTreeViewEntry<import("../../ui/LabelGui.js").LabelGui>} statusLabel
8+
* @property {import("../../ui/propertiesTreeView/PropertiesTreeViewEntry.js").PropertiesTreeViewEntry<import("../../ui/LabelGui.js").LabelGui>} statusLabel
99
*/
1010

1111
export class ConnectionsContentWindow extends ContentWindow {

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "module",
77
"scripts": {
88
"lint": "eslint .",
9-
"test": "playwright test"
9+
"lint-fix": "npm run lint -- --fix"
1010
},
1111
"devDependencies": {
1212
"@babel/eslint-parser": "^7.16.3",

‎scripts/dev.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ const buildProcess = Deno.run({
4545
});
4646
await buildProcess.status();
4747

48-
const server = new DevServer({
49-
port: 8080,
50-
serverName: "development server",
51-
});
52-
server.start();
48+
if (!Deno.args.includes("--no-serve")) {
49+
const server = new DevServer({
50+
port: 8080,
51+
serverName: "development server",
52+
});
53+
server.start();
54+
}

‎src/gizmos/draggables/GizmoDraggable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class GizmoDraggable {
6565
}
6666

6767
/**
68-
* @param {import("../../Components/builtIn/CameraComponent.js").CameraComponent} camera
68+
* @param {import("../../components/builtIn/CameraComponent.js").CameraComponent} camera
6969
*/
7070
getScreenPos(camera) {
7171
return camera.worldToScreenPos(this.entity.pos);

‎test/e2e/shared/browser.js

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export async function initBrowser() {
3535
headless,
3636
args: ["--enable-unsafe-webgpu"],
3737
devtools,
38-
executablePath: "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
3938
});
4039
}
4140

‎test/unit/editor/shared/mockKeyboardShortcutManager.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export function createMockKeyboardShortcutManager() {
2-
const keyboardShortcutManager = /** @type {import("../../../../editor/src/KeyboardShortcuts/KeyboardShortcutManager.js").KeyboardShortcutManager} */ ({
2+
const keyboardShortcutManager = /** @type {import("../../../../editor/src/keyboardShortcuts/KeyboardShortcutManager.js").KeyboardShortcutManager} */ ({
33
getCondition(name) {
4-
const mockCondition = /** @type {import("../../../../editor/src/KeyboardShortcuts/ShortcutCondition.js").ShortcutCondition} */ ({
4+
const mockCondition = /** @type {import("../../../../editor/src/keyboardShortcuts/ShortcutCondition.js").ShortcutCondition} */ ({
55
requestValueSetter(priority) {
6-
const mockValueSetter = /** @type {import("../../../../editor/src/KeyboardShortcuts/ShorcutConditionValueSetter.js").ShorcutConditionValueSetter<any>} */ ({
6+
const mockValueSetter = /** @type {import("../../../../editor/src/keyboardShortcuts/ShorcutConditionValueSetter.js").ShorcutConditionValueSetter<any>} */ ({
77
setValue(value) {},
88
});
99
return mockValueSetter;

‎test/unit/editor/src/tasks/TaskManager.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Deno.test({
9898
Deno.test({
9999
name: "running a task",
100100
async fn() {
101-
injectMockEditorInstance(/** @type {import("../../../../../editor/src/editor.js").Editor} */ ({}));
101+
injectMockEditorInstance(/** @type {import("../../../../../editor/src/Editor.js").Editor} */ ({}));
102102

103103
try {
104104
const manager = new TaskManager();

‎test/unit/editor/src/ui/NumericGui.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {assertEquals} from "std/testing/asserts.ts";
2-
import {NumericGui} from "../../../../../editor/src/UI/NumericGui.js";
2+
import {NumericGui} from "../../../../../editor/src/ui/NumericGui.js";
33
import {initializeDom} from "../../shared/initializeDom.js";
44

55
Deno.test({

0 commit comments

Comments
 (0)
Please sign in to comment.