Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
287 commits
Select commit Hold shift + click to select a range
acffe64
Merge branch 'master' of https://github.com/source-academy/modules in…
RichDom2185 Feb 7, 2026
ce99536
Format markdown files
RichDom2185 Feb 7, 2026
bb3f681
Merge branch 'master' of https://github.com/source-academy/modules in…
RichDom2185 Feb 8, 2026
f05933a
Update lockfile post-merge
RichDom2185 Feb 8, 2026
4bfd69f
Merge branch 'plugins' of github.com:source-academy/modules into plugins
leeyi45 Feb 10, 2026
b639551
Fix incorrect curve drawer implementations and add tests
leeyi45 Feb 11, 2026
ef9a367
Add a documentation section regarding checking callback parameters
leeyi45 Feb 11, 2026
7af0cc1
Add overloads to the isFunctionOfLength callback
leeyi45 Feb 11, 2026
03c2867
Move type checking into its own section for docs
leeyi45 Feb 14, 2026
af5966b
Add isFunctionOfLength utility function
leeyi45 Feb 14, 2026
8a8db52
Update constraints file and node version
leeyi45 Feb 14, 2026
9a35743
Bump dependencies
RichDom2185 Feb 14, 2026
f4293d2
Fix format
RichDom2185 Feb 14, 2026
5443917
Revert js-slang due to breaking changes
RichDom2185 Feb 14, 2026
b3e0d77
Fix lint issues
RichDom2185 Feb 14, 2026
f646686
Update lib/buildtools/src/build/modules/__tests__/building.test.ts
RichDom2185 Feb 14, 2026
f3b9bf8
Add yarn checksum
RichDom2185 Feb 14, 2026
6d1fafd
Use a new error type to unify errors thrown by type guards
leeyi45 Feb 14, 2026
7afaec2
Merge remote-tracking branch 'origin/plugins' into better-type-guards
leeyi45 Feb 14, 2026
039f3b5
Merge branch 'master' into better-type-guards
leeyi45 Feb 14, 2026
ec87a3b
Add the callback type checks to sound bundle
leeyi45 Feb 14, 2026
a952439
Linting fixes
leeyi45 Feb 15, 2026
7db632c
General documentation updates
leeyi45 Feb 26, 2026
4efc5a5
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Feb 26, 2026
c43178b
Update linting and documentation
leeyi45 Feb 28, 2026
d39bb8f
Bump fast-xml-parser from 5.3.6 to 5.4.1
dependabot[bot] Feb 28, 2026
6f0ec17
Merge remote-tracking branch 'origin/dependabot/npm_and_yarn/fast-xml…
leeyi45 Mar 2, 2026
47cb851
Remove extraneous line
leeyi45 Mar 2, 2026
463784a
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Mar 3, 2026
4bc2449
Fix missing lodash package in Unittest tab
leeyi45 Mar 3, 2026
45557b9
Add missing dependencies to vitest optimizeDeps for modules-lib
leeyi45 Mar 3, 2026
eeefeb3
Change some errors to use InvalidTypeParameterError
leeyi45 Mar 3, 2026
7ddda5c
Add InvalidCallbackError to Rune animations
leeyi45 Mar 3, 2026
884a8a9
Add some missing functionality to midi
leeyi45 Mar 3, 2026
0e87bc0
Add type checks to repeat
leeyi45 Mar 7, 2026
595b52c
Add type checking to repeat bundle
leeyi45 Mar 7, 2026
8d7328c
Add more type guard checks to unittest and fix broken tests
leeyi45 Mar 7, 2026
494826f
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Mar 7, 2026
0f28aea
Update some documentation
leeyi45 Mar 8, 2026
2f178b7
Add documentation about bp css styles
leeyi45 Mar 8, 2026
580da06
Update modules-lib to use blueprint/core iconnames
leeyi45 Mar 9, 2026
eb0d025
Update devserver to use blueprint core icons
leeyi45 Mar 9, 2026
bd69a3a
Change which iconname modules-lib refers to
leeyi45 Mar 9, 2026
f9b7ebb
Remove blueprint icons where unnecessary
leeyi45 Mar 9, 2026
88379d9
Update some documentation
leeyi45 Mar 9, 2026
200cef7
Update documentation config for modules-lib for better organization
leeyi45 Mar 9, 2026
20902e4
Add direct nav link to modules-lib docs
leeyi45 Mar 9, 2026
724a0e5
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Mar 10, 2026
8e7dcb1
Add a linting rule to refer to es-toolkit
leeyi45 Mar 10, 2026
e1615c3
Add checks for number range and change to assertion style guards
leeyi45 Mar 15, 2026
44db249
Pin Vitest and upgrade to Vite v8
RichDom2185 Mar 16, 2026
2301e42
Rollback Vite to v7
RichDom2185 Mar 16, 2026
778c788
Revert "Rollback Vite to v7"
RichDom2185 Mar 16, 2026
8af4479
Ignore Vitest attachments
RichDom2185 Mar 16, 2026
9781d00
Migrate Vitest config
RichDom2185 Mar 16, 2026
9b44933
Run Vitest non-interactively
RichDom2185 Mar 16, 2026
4d7362c
Skip failing tests for now
RichDom2185 Mar 16, 2026
9000797
Rollback vitest-browser-react
RichDom2185 Mar 16, 2026
a8c066f
Update plotly to use new type guards
leeyi45 Mar 17, 2026
48972cc
Fix some naming issues
leeyi45 Mar 17, 2026
bfebf40
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Mar 17, 2026
b4e79f8
Update documentations
leeyi45 Mar 17, 2026
3d85d09
Minor changes
leeyi45 Mar 18, 2026
00f7061
Update docs
leeyi45 Mar 18, 2026
dc3bd2f
Update sound docs
leeyi45 Mar 18, 2026
a20e2bb
General documentation updates
leeyi45 Mar 20, 2026
0a0a720
Merge remote-tracking branch 'origin/master' into vite-8
leeyi45 Mar 20, 2026
d3ed1df
Add the legacy.inconsistentCjsInterop flag to vitest configuration
leeyi45 Mar 20, 2026
8ec125d
Restore playground tests
RichDom2185 Mar 20, 2026
937824c
Update vite config resolution to remove type error
leeyi45 Mar 20, 2026
f2c820c
Merge branch 'vite-8' of github.com:source-academy/modules into vite-8
leeyi45 Mar 20, 2026
0f0f0a9
Fix tests being skipped
leeyi45 Mar 20, 2026
e53b037
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Mar 20, 2026
5d19c43
Update vitest-browser-react
leeyi45 Mar 22, 2026
c90d0f0
Merge branch 'vite-8' into better-type-guards
leeyi45 Mar 22, 2026
da30cdb
Fix sound documentation again
leeyi45 Mar 22, 2026
2048de5
Add some more type guards to sound
leeyi45 Mar 24, 2026
b6683c9
Change get_arg_list to return list of lists
leeyi45 Mar 24, 2026
33b3dcb
Fix binary_tree to work with new list type definitions
leeyi45 Mar 27, 2026
721e5eb
Fix csg to use new list type definitions
leeyi45 Mar 27, 2026
e07b0b5
Fix stereo_sound and sound to work with new list type definitions
leeyi45 Mar 27, 2026
b84d358
Fix unittest to work with new list type definitions
leeyi45 Mar 27, 2026
032e349
Fix game and curve to work with new list definitions
leeyi45 Mar 27, 2026
f727a63
Tidy up repl bundle implementation
leeyi45 Mar 28, 2026
40c8b57
Make devserver work with new js-slang imports
leeyi45 Mar 28, 2026
856ef6f
Fix Repl tab
leeyi45 Mar 28, 2026
5539616
Update pix_n_flix to use new module utilities
leeyi45 Mar 28, 2026
92c7cd8
Update devserver to allow direct importing
leeyi45 Mar 28, 2026
8a07b20
Update imports from js-slang errors
leeyi45 Mar 28, 2026
165b15d
Update robot_simulation for new js-slang types
leeyi45 Mar 28, 2026
c31ade3
Update compilation scripts
leeyi45 Mar 28, 2026
66dc398
Update more robot_simulation imports
leeyi45 Mar 28, 2026
a95b74c
Make repl tab work with new repl bundle
leeyi45 Mar 30, 2026
072eac8
Add intellisense support for vue files
leeyi45 Mar 30, 2026
c562699
Revert "Add intellisense support for vue files"
leeyi45 Mar 30, 2026
82d094f
Add twoslash support to docs
leeyi45 Apr 2, 2026
50933bd
Add a docs section about typescript
leeyi45 Apr 2, 2026
3f70061
Add twoslash to docs
leeyi45 Apr 2, 2026
e9191e6
Allow devserver to use custom importers
leeyi45 Apr 2, 2026
a5b10df
Update tests to work with new js-slang list lib
leeyi45 Apr 2, 2026
d812bfb
Update modules-lib docs
leeyi45 Apr 2, 2026
135c9b1
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Apr 2, 2026
4caf6e2
Update eslint config to work for docs and twoslash
leeyi45 Apr 2, 2026
650eb57
Fix twoslash popovers not having styling
leeyi45 Apr 2, 2026
ce1243c
Update markdown-tree packages
leeyi45 Apr 6, 2026
974d216
Add clean command
leeyi45 Apr 6, 2026
41979c6
Update bundles to work with Typescript 6
leeyi45 Apr 6, 2026
c6e6024
Update tabs to work with typescript 6
leeyi45 Apr 6, 2026
372a933
Update github actions to work with Typescript 6
leeyi45 Apr 6, 2026
1b88ee4
Update libs to work with Typescript 6
leeyi45 Apr 6, 2026
467d090
Update ESLint packages
leeyi45 Apr 6, 2026
77150eb
Needed to revert back to ESLint 9
leeyi45 Apr 6, 2026
3a2ac5a
Update typedoc
leeyi45 Apr 6, 2026
8f6a3d3
Fix dependencies for lintplugin
leeyi45 Apr 6, 2026
e938d2b
Fix broken test
leeyi45 Apr 7, 2026
fbdee21
Test a potential broken action
leeyi45 Apr 7, 2026
6ba6b6c
Try another fix
leeyi45 Apr 7, 2026
3c1ad58
More testing
leeyi45 Apr 7, 2026
99e6f1e
Try adding silent to exec option
leeyi45 Apr 7, 2026
268c945
Augment code to see where execution stopped
leeyi45 Apr 7, 2026
19c176d
Try with more logging
leeyi45 Apr 7, 2026
4c3cf5b
Redo the implementation for getRawPackages to use yarn workspaces list
leeyi45 Apr 7, 2026
0c44216
Fix broken tests
leeyi45 Apr 7, 2026
280f242
Investigate using a try block
leeyi45 Apr 7, 2026
9aa9dd6
Try without memoization
leeyi45 Apr 7, 2026
55fe824
Try testing the yarn why command without silent
leeyi45 Apr 7, 2026
1849e5a
Fix package name extractor
leeyi45 Apr 7, 2026
2a1d7b9
Make package type information available too
leeyi45 Apr 7, 2026
948a6dd
Fix incorrect lib typing in tests
leeyi45 Apr 7, 2026
fea050e
Fix sound test using global
leeyi45 Apr 7, 2026
c105e43
Fix CurveAnimations crashing the frontend
leeyi45 Apr 7, 2026
962e428
Fix types and documentation
leeyi45 Apr 7, 2026
fc4fde8
Add result handling for the clean command
leeyi45 Apr 7, 2026
30447a8
Added documentation about the instanceof issue
leeyi45 Apr 7, 2026
d56aed5
Add Typescript to docs
leeyi45 Apr 7, 2026
5161209
Fix linting config to always require json extension
leeyi45 Apr 7, 2026
d9aec50
Fix toSpawn checks for tabs that weren't working
leeyi45 Apr 8, 2026
ab9ff8a
Fix broken tests
leeyi45 Apr 8, 2026
de6f6ae
Update tab test snapshots
leeyi45 Apr 9, 2026
c37d245
Update the docs about the ModuleTab type
leeyi45 Apr 9, 2026
ab21f78
Fix missing export and incorrect css layout
leeyi45 Apr 9, 2026
6a06264
Introduce validator
leeyi45 Apr 9, 2026
99e9d49
Merge branch 'ts-6' into better-type-guards
leeyi45 Apr 9, 2026
b0d6ed3
Fix WASM bundle
RichDom2185 Apr 10, 2026
38babe0
Update docs
leeyi45 Apr 11, 2026
e867f59
Merge branch 'ts-6' of github.com:source-academy/modules into ts-6
leeyi45 Apr 11, 2026
ae85b05
Update configurations
leeyi45 Apr 11, 2026
ac9af6f
Merge branch 'ts-6' into validator
leeyi45 Apr 11, 2026
dd67167
Add readme for validator
leeyi45 Apr 11, 2026
d24df04
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Apr 15, 2026
702d4af
Fix incorrect typescript-eslint packages causing lintplugin type errors
leeyi45 Apr 15, 2026
30cde0d
change modules-lib utils to use the ones exported by js-slang
leeyi45 Apr 15, 2026
9bfb52f
Fix eslint issues
leeyi45 Apr 15, 2026
5e1075f
Update unittest bundle errors
leeyi45 Apr 16, 2026
ea4c683
Fix repl tab
leeyi45 Apr 16, 2026
d41c6bb
Fix modules-lib exports
leeyi45 Apr 16, 2026
54e4186
Add docs about error throwing
leeyi45 Apr 16, 2026
eee61c1
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Apr 16, 2026
e1f6bce
Update pix_n_flix
leeyi45 Apr 16, 2026
ebddbe5
Downgrade shikijs version to the one actually used by vitepress
leeyi45 Apr 16, 2026
5488374
Fix unittest bundle test
leeyi45 Apr 16, 2026
5dc3ac8
Fix docs tsc not working properly
leeyi45 Apr 16, 2026
444cc49
Fix broken markdown-plugin test
leeyi45 Apr 16, 2026
a23ffb2
Fix stereo_sound type checks, errors and tests
leeyi45 Apr 17, 2026
9ef6c21
Fix buildtools testing command ui option not working
leeyi45 Apr 17, 2026
a0c3aca
Unittest bundle: Make mocked functions have all the same toString
leeyi45 Apr 17, 2026
5184365
Tidy up some code
leeyi45 Apr 17, 2026
fce6f40
Update docs
leeyi45 Apr 18, 2026
5de596b
Update curve bundle tests
leeyi45 Apr 18, 2026
47f530c
Update vitest versions
leeyi45 Apr 22, 2026
4e0de12
Update js-slang version for all packages
leeyi45 Apr 24, 2026
c83f65c
Update node version and constraints
leeyi45 Apr 24, 2026
0b48f73
Update docs
leeyi45 Apr 24, 2026
c2d13a0
Add instanceof check rule
leeyi45 Apr 24, 2026
128de66
Fix unknown @types/node version
leeyi45 Apr 24, 2026
944a4c6
Clean up docs
leeyi45 Apr 24, 2026
e6f250a
Update linting configuration
leeyi45 Apr 26, 2026
bc88aa2
Merge branch 'validator' into better-type-guards
leeyi45 Apr 26, 2026
dd58e7e
Add validator to workflows
leeyi45 Apr 26, 2026
1b2b9b0
Add manifest loading to load-artifact
leeyi45 Apr 26, 2026
b6bed4b
Upgrade load-artifacts action to be able to load bundle and manifest
leeyi45 Apr 28, 2026
a2a155e
Linting and documentation changes
leeyi45 Apr 28, 2026
732f6bd
Update repl to use js-slang errors
leeyi45 Apr 28, 2026
740c383
Fix module-lib not exporting errors correctly
leeyi45 Apr 28, 2026
726ab0b
Update lintplugin exports
leeyi45 Apr 28, 2026
8c648ca
Update modules-lib exports to include function handling utils from js…
leeyi45 Apr 28, 2026
db4f881
Fix broken tests and es-toolkit imports
leeyi45 Apr 28, 2026
be9a24d
Fix incorrect test for pix_n_flix
leeyi45 Apr 28, 2026
0d460c9
Update docs
leeyi45 Apr 28, 2026
cde8b35
Rename DrawnRune types to be more distinct from the Rune type
leeyi45 Apr 28, 2026
3136163
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Apr 28, 2026
353b2e1
Update arcade_2d to use js-slang based errors and type guards
leeyi45 Apr 29, 2026
db9708f
Update curve bundle to use js-slang errors
leeyi45 Apr 29, 2026
3b75906
Update nbody to use js-slang errors
leeyi45 Apr 29, 2026
ec94ed7
Update physics_2d to use js-slang errors
leeyi45 Apr 29, 2026
df78f5e
Add tests to physics_2d
leeyi45 Apr 29, 2026
6373f51
Add tests to physics_2d
leeyi45 Apr 29, 2026
3517a75
Update sound bundle to use js-slang errors
leeyi45 Apr 30, 2026
a39b8de
Update repl bundle to use js-slang errors
leeyi45 Apr 30, 2026
a6d5150
Update rune bundle to use js-slang errors
leeyi45 Apr 30, 2026
1dd0f03
Update communication bundle to use js-slang errors
leeyi45 Apr 30, 2026
9fcb756
Update csg bundle to use js-slang errors
leeyi45 Apr 30, 2026
a80444c
Update sound-matrix bundle to use js-slang
leeyi45 Apr 30, 2026
4a7a7a5
Update midi bundle to use js-slang errors
leeyi45 Apr 30, 2026
2764568
Update plotly bundle to use js-slang errors
leeyi45 Apr 30, 2026
5260ce6
Update stereo_sound bundle to use js-slang errors
leeyi45 Apr 30, 2026
591eac2
Add a hasInstance check for glAnimations
leeyi45 Apr 30, 2026
32a3a98
Export the throw runtime error rule for lintplugin
leeyi45 Apr 30, 2026
a1e183c
Update unity_academy for tests
leeyi45 May 1, 2026
1ca3666
Fix some more unity_academy types
leeyi45 May 1, 2026
94a23b4
Add tests to mark_sweep
leeyi45 May 1, 2026
f8a0268
Change mark_sweep functions to be compatible with new module format
leeyi45 May 1, 2026
36f3ce6
Switch MarkSweep tab to functional component style
leeyi45 May 1, 2026
ce440fc
Change devserver to no longer require modules server at all
leeyi45 May 1, 2026
3a31d68
Basic refactoring of copy_gc
leeyi45 May 1, 2026
6bbec1a
Make copy_gc bundle and tab work with new modules system
leeyi45 May 1, 2026
7410dbb
Update documentation
leeyi45 May 2, 2026
1229451
Add throw runtime error to eslint
leeyi45 May 2, 2026
cac8c04
Fix rune type errors
leeyi45 May 2, 2026
a9b7b88
Update missing dependencies
leeyi45 May 2, 2026
f046dd9
Fix unity academy tab
leeyi45 May 2, 2026
1999c52
Update throwRuntimeError to allow rethrowing
leeyi45 May 2, 2026
47201d5
fix type errors
leeyi45 May 2, 2026
491276f
Fix repl tests
leeyi45 May 2, 2026
2c5e8e2
Fix stereo_sound tests
leeyi45 May 2, 2026
6238a40
Fix rune tab test
leeyi45 May 2, 2026
37cf81f
Fix arcade_2d types
leeyi45 May 2, 2026
ac415f5
Fix broken robot_simulation tests
leeyi45 May 2, 2026
bff967e
Continue fixing broken types
leeyi45 May 2, 2026
d97027a
Continue fixing type errors
leeyi45 May 2, 2026
c3c2b1b
Fix more type errors
leeyi45 May 2, 2026
87b3d7b
Refactor docs to have separate page for each linting rule
leeyi45 May 5, 2026
f34466b
Use typescript-eslint utils for the lintplugin
leeyi45 May 5, 2026
bf6f39a
Misc changes
leeyi45 May 5, 2026
c209eff
Remove validator
leeyi45 May 5, 2026
505458c
Remove validator eslint configs
leeyi45 May 5, 2026
1407a51
Update lockfile
leeyi45 May 5, 2026
09fef67
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 May 5, 2026
e9fd257
Update robot_simulation errors
leeyi45 May 6, 2026
21ec116
Update unittest assert_length to include arrays
leeyi45 May 6, 2026
f58a4be
Fix possible broken tests
leeyi45 May 6, 2026
4aaeba8
Fix docs
leeyi45 May 7, 2026
d038e5b
Try fixing github actions
leeyi45 May 7, 2026
3c1d79e
Remove validate from workflow
leeyi45 May 7, 2026
1a15089
Update test for actions
leeyi45 May 7, 2026
85cb029
Fix broken actions and types
leeyi45 May 7, 2026
ee55498
Fix linting for CI and node types for docs
leeyi45 May 7, 2026
d2e8b79
Fix broken rule for CI
leeyi45 May 7, 2026
e665b79
Fix broken docs
leeyi45 May 7, 2026
1cc80b4
Fix all React types using JSX namespace
leeyi45 May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@sourceacademy/modules-repotools": "workspace:^",
"@types/node": "^24.0.0",
"typescript": "^6.0.2",
"vitest": "4.1.4"
"vitest": "4.1.5"
},
"dependencies": {
"@actions/artifact": "^6.0.0",
Expand Down
17 changes: 8 additions & 9 deletions .github/actions/src/__tests__/commons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import * as exec from '@actions/exec';
import { describe, expect, it, test, vi } from 'vitest';
import * as commons from '../commons.js';

vi.mock(import('es-toolkit'), async (importOriginal) => {
vi.mock(import('es-toolkit'), async importOriginal => {
const actual = await importOriginal();
return {
...actual,
memoize: (x: any) => x
};
});

const mockedExecOutput = vi.spyOn(exec, 'getExecOutput');
const mockedExecOutput = vi.mocked(exec.getExecOutput);

describe(commons.checkDirForChanges, () => {
function mockChanges(value: boolean) {
Expand All @@ -19,18 +19,17 @@ describe(commons.checkDirForChanges, () => {
});
}

it('should return true if git diff exits with non zero code', async () => {
mockChanges(true);
await expect(commons.checkDirForChanges('/')).resolves.toEqual(true);
expect(mockedExecOutput).toHaveBeenCalledOnce();
});

it('should return false if git diff exits with 0', async () => {
mockChanges(false);

await expect(commons.checkDirForChanges('/')).resolves.toEqual(false);
expect(mockedExecOutput).toHaveBeenCalledOnce();
});

it('should return true if git diff exits with non zero code', async () => {
mockChanges(true);
await expect(commons.checkDirForChanges('/')).resolves.toEqual(true);
expect(mockedExecOutput).toHaveBeenCalledOnce();
});
});

describe(commons.isPackageRecord, () => {
Expand Down
88 changes: 88 additions & 0 deletions .github/actions/src/artifact.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import fs from 'fs/promises';
import pathlib from 'path';
import { ArtifactNotFoundError, DefaultArtifactClient } from '@actions/artifact';
import * as core from '@actions/core';
import { exec } from '@actions/exec';
import { outDir } from '@sourceacademy/modules-repotools/getGitRoot';
import type { BundleManifest, ResolvedBundle, ResolvedTab } from '@sourceacademy/modules-repotools/types';
import { filterAsync } from 'es-toolkit';

/**
* If the given bundles or tabs have already been built, then restore the built version
* using the {@link DefaultArtifactClient}. Otherwise, focus those workspaces, and then
* run the appropriate build commands.
*/
export async function loadOrBuildAsset(bundles: ResolvedBundle[], tabs: ResolvedTab[], manifest?: boolean) {
const artifact = new DefaultArtifactClient();

const tabsPromise = filterAsync(tabs, async ({ name: tabName }) => {
try {
const { artifact: { id } } = await artifact.getArtifact(`${tabName}-tab`);
await artifact.downloadArtifact(id, { path: pathlib.join(outDir, 'tabs') });
core.info(`Downloaded artifact for ${tabName} tab`);
return false;
} catch (error) {
if (!(error instanceof ArtifactNotFoundError)) {
throw error;
}
core.error(`Error retrieving artifact for ${tabName} tab, need to try building`);
return true;
}
});

const bundlesPromise = filterAsync(bundles, async ({ name: bundleName }) => {
try {
const { artifact: { id } } = await artifact.getArtifact(`${bundleName}-bundle`);
await artifact.downloadArtifact(id, { path: pathlib.join(outDir, 'bundles') });
core.info(`Downloaded artifact for ${bundleName} bundle`);
return false;
} catch (error) {
if (!(error instanceof ArtifactNotFoundError)) {
throw error;
}
core.error(`Error retrieving artifact for ${bundleName} bundle, need to try building`);
return true;
}
});

const manifestPromise = (async () => {
if (!manifest || bundles.length === 0) return;

try {
const { artifact: { id } } = await artifact.getArtifact('manifest');
await artifact.downloadArtifact(id, { path: outDir });
} catch (error) {
if (!(error instanceof ArtifactNotFoundError)) {
throw error;
}

const manifest = bundles.reduce<Record<string, BundleManifest>>((res, bundle) => ({
...res,
[bundle.name]: bundle.manifest
}), {});

const outpath = pathlib.join(outDir, 'modules.json');
await fs.writeFile(outpath, JSON.stringify(manifest));
}
})();

const [bundlesToBuild, tabsToBuild] = await Promise.all([bundlesPromise, tabsPromise, manifestPromise]);

if (bundlesToBuild.length === 0 && tabsToBuild.length === 0) return;

const workspaces = [
...bundlesToBuild.map(({ name }) => `@sourceacademy/bundle-${name}`),
...tabsToBuild.map(({ name }) => `@sourceacademy/tab-${name}`),
];

// focus all at once
await exec('yarn workspaces focus', workspaces, { silent: false });

// Then build everything
const workspaceBuildArgs = workspaces.flatMap(each => ['--include', each]);
await exec(
'yarn workspaces foreach -pA',
[...workspaceBuildArgs, 'run', 'build' ],
{ silent: false }
);
}
Loading
Loading