Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feat/config-param-d…
Browse files Browse the repository at this point in the history
…escs
  • Loading branch information
Keyrxng committed Nov 29, 2024
2 parents 9ee2939 + b52f2db commit 3b810d2
Show file tree
Hide file tree
Showing 26 changed files with 1,294 additions and 788 deletions.
43 changes: 36 additions & 7 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,41 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log"],
"ignorePaths": [
"**/*.json",
"**/*.css",
"node_modules",
"**/*.log"
],
"useGitignore": true,
"language": "en",
"words": ["dataurl", "devpool", "outdir", "servedir"],
"dictionaries": ["typescript", "node", "software-terms"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
"ignoreRegExpList": ["[0-9a-fA-F]{6}"],
"ignoreWords": ["ubiquibot", "Supabase", "supabase", "SUPABASE", "sonarjs", "mischeck", "tooltiptext"]
}
"words": [
"dataurl",
"devpool",
"outdir",
"servedir"
],
"dictionaries": [
"typescript",
"node",
"software-terms"
],
"import": [
"@cspell/dict-typescript/cspell-ext.json",
"@cspell/dict-node/cspell-ext.json",
"@cspell/dict-software-terms"
],
"ignoreRegExpList": [
"[0-9a-fA-F]{6}"
],
"ignoreWords": [
"ubiquibot",
"Supabase",
"supabase",
"SUPABASE",
"sonarjs",
"mischeck",
"Typebox",
"tooltiptext"
]
}
2 changes: 2 additions & 0 deletions .github/knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const config: KnipConfig = {
"@actions/core",
"esbuild",
"@ubiquity-os/plugin-sdk",
"markdown-it",
"@types/markdown-it",
],
eslint: true,
};
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@ubiquity-os/ubiquity-os-kernel": "^2.5.3",
"ajv": "^8.17.1",
"dotenv": "^16.4.4",
"markdown-it": "^14.1.0",
"yaml": "^2.6.0"
},
"devDependencies": {
Expand All @@ -51,6 +52,7 @@
"@jest/globals": "29.7.0",
"@mswjs/data": "0.16.1",
"@types/jest": "^29.5.12",
"@types/markdown-it": "^14.1.2",
"@types/node": "20.14.5",
"cspell": "8.14.4",
"cypress": "13.6.6",
Expand Down
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<tbody id="manifest-gui-body"></tbody>
<tfoot
><tr
><td></td><td><button id="remove"></button><button id="add"></button></td></tr
><td></td><td><button id="reset-to-default"></button><button id="remove"></button><button id="add"></button></td></tr
></tfoot>
</table>
</section>
Expand Down
37 changes: 16 additions & 21 deletions static/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AuthService } from "./scripts/authentication";
import { ManifestDecoder } from "./scripts/decode-manifest";
import { ManifestFetcher } from "./scripts/fetch-manifest";
import { ManifestRenderer } from "./scripts/render-manifest";
import { renderOrgPicker } from "./scripts/rendering/org-select";
import { toastNotification } from "./utils/toaster";

async function handleAuth() {
Expand All @@ -12,30 +12,31 @@ async function handleAuth() {

export async function mainModule() {
const auth = await handleAuth();
const decoder = new ManifestDecoder();
const renderer = new ManifestRenderer(auth);
const search = window.location.search.substring(1);

if (search) {
const decodedManifest = await decoder.decodeManifestFromSearch(search);
return renderer.renderManifest(decodedManifest);
}
renderer.manifestGuiBody.dataset.loading = "false";

try {
const ubiquityOrgsToFetchOfficialConfigFrom = ["ubiquity-os"];
const fetcher = new ManifestFetcher(ubiquityOrgsToFetchOfficialConfigFrom, auth.octokit, decoder);
const fetcher = new ManifestFetcher(ubiquityOrgsToFetchOfficialConfigFrom, auth.octokit);
const cache = fetcher.checkManifestCache();

if (auth.isActiveSession()) {
const userOrgs = await auth.getGitHubUserOrgs();
renderer.renderOrgPicker(userOrgs);

if (Object.keys(cache).length === 0) {
const manifestCache = await fetcher.fetchMarketplaceManifests();
localStorage.setItem("manifestCache", JSON.stringify(manifestCache));
// this is going to extract URLs from our official config which we'll inject into `- plugin: ...`
renderer.manifestGuiBody.dataset.loading = "true";
const killNotification = toastNotification("Fetching manifest data...", { type: "info", shouldAutoDismiss: true });
renderOrgPicker(renderer, []);

await fetcher.fetchMarketplaceManifests();
await fetcher.fetchOfficialPluginConfig();
killNotification();
renderer.manifestGuiBody.dataset.loading = "false";
}

renderOrgPicker(renderer, userOrgs);
} else {
renderer.renderOrgPicker([]);
renderOrgPicker(renderer, []);
}
} catch (error) {
if (error instanceof Error) {
Expand All @@ -46,10 +47,4 @@ export async function mainModule() {
}
}

mainModule()
.then(() => {
console.log("mainModule loaded");
})
.catch((error) => {
console.error(error);
});
mainModule().catch(console.error);
Loading

0 comments on commit 3b810d2

Please sign in to comment.