Skip to content

Commit

Permalink
Merge pull request #270 from Joery-M/246-shared-refactor-projects-in-…
Browse files Browse the repository at this point in the history
…local-storage

246 shared refactor projects in local storage
  • Loading branch information
Joery-M authored Oct 24, 2024
2 parents 129fc5c + ed43b14 commit 011b2d9
Show file tree
Hide file tree
Showing 45 changed files with 1,213 additions and 1,311 deletions.
35 changes: 18 additions & 17 deletions packages/safelight/buildscripts/generatePackageList.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { spawnSync } from 'child_process';
import { existsSync, writeFileSync } from 'fs';
import { mkdir } from 'fs/promises';
import { spawn } from 'child_process';
import { existsSync } from 'fs';
import { mkdir, writeFile } from 'fs/promises';
import { join } from 'path';

const projects = [
Expand Down Expand Up @@ -32,22 +32,23 @@ if (!existsSync('./src/generated')) {

const bannedKeys = ['unsavedDependencies', 'path'];

function generatePackagesForProject(projectPath: string, outputFileName: string) {
return new Promise<void>((resolve) => {
const output = spawnSync('pnpm', ['list', '--depth', '2', '--json', '--long'], {
cwd: join(process.cwd(), '../../', projectPath),
stdio: ['inherit', 'pipe', 'inherit'],
shell: true
});
async function generatePackagesForProject(projectPath: string, outputFileName: string) {
const output = spawn('pnpm', ['list', '--depth', '2', '--json', '--long'], {
cwd: join(process.cwd(), '../../', projectPath),
stdio: ['inherit', 'pipe', 'inherit'],
shell: true
});
let result = '';
output.stdout.setEncoding('utf-8');
output.stdout.addListener('data', (c) => (result += c));

const filteredFile = removePath(JSON.parse(output.stdout.toString())[0]);
writeFileSync(
join('./src/generated/', outputFileName),
JSON.stringify(filteredFile, undefined, 4)
);
await new Promise((resolve) => output.addListener('close', resolve));

resolve();
});
const filteredFile = removePath(JSON.parse(result)[0]);
await writeFile(
join('./src/generated/', outputFileName),
JSON.stringify(filteredFile, undefined, 4)
);
}

// Recursively remove all fields that have the key "path", since this is a local path
Expand Down
2 changes: 1 addition & 1 deletion packages/safelight/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en" class="dark">
<html lang="en" class="dark" style="background-color: var(--p-neutral-950, #0a0a0a)">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
Expand Down
7 changes: 3 additions & 4 deletions packages/safelight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"type": "module",
"scripts": {
"dev": "pnpm generate-all && vite",
"generate-disclaimer": "cd ../../ && pnpm-licenses generate-disclaimer -o ./packages/safelight/src/generated/disclaimer.txt",
"generate-license": "cd ../../ && pnpm-licenses list -o ./packages/safelight/src/generated/licenses.json",
"generate-disclaimer": "pnpm-licenses generate-disclaimer -o ./src/generated/disclaimer.txt",
"generate-package-list": "tsx ./buildscripts/generatePackageList.ts",
"generate-all": "pnpm \"/^(generate-(?!all).*)/\"",
"build": "pnpm \"/^(generate-(?!all).*|type-check)/\" && pnpm build-only",
Expand All @@ -21,7 +20,6 @@
"@fontsource-variable/inter": "^5.1.0",
"@phosphor-icons/vue": "^2.2.1",
"@primevue/themes": "^4.1.1",
"@quantco/pnpm-licenses": "^2.1.0",
"@safelight/shared": "workspace:*",
"@safelight/timeline": "workspace:*",
"@vueuse/core": "^11.1.0",
Expand All @@ -34,9 +32,9 @@
"dot-path-value": "^0.0.11",
"fuzzysearch": "^1.0.3",
"hash-wasm": "^4.11.0",
"luna-object-viewer": "^0.3.1",
"luxon": "^3.5.0",
"mime-matcher": "^1.0.5",
"monaco-editor": "^0.52.0",
"pinia": "^2.2.4",
"primevue": "^4.1.1",
"rxjs": "^7.8.1",
Expand All @@ -49,6 +47,7 @@
"devDependencies": {
"@babel/types": "^7.25.8",
"@intlify/eslint-plugin-vue-i18n": "^3.0.0",
"@quantco/pnpm-licenses": "^2.1.0",
"@tsconfig/node20": "^20.1.4",
"@types/dom-webcodecs": "^0.1.13",
"@types/fuzzysearch": "^1.0.2",
Expand Down
9 changes: 5 additions & 4 deletions packages/safelight/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ import { SettingsManager } from '@safelight/shared/Settings/SettingsManager';
import { useTitle } from '@vueuse/core';
import DynamicDialog from 'primevue/dynamicdialog';
import { defineAsyncComponent, markRaw, watchEffect } from 'vue';
import { RouterView } from 'vue-router';
import { RouterView, useRoute } from 'vue-router';
import NotificationManager from './components/General/Notifications/NotificationManager.vue';
import { router } from './main';
const pageTitle = useTitle();
const newRoute = useRoute();
watchEffect(() => {
const newRoute = router.currentRoute.value;
if (newRoute.name) {
const newName = newRoute.name.toString().replace(/^\//, '').split('/').at(-1);
const newName = newRoute.meta.overridePageName
? undefined
: newRoute.name.toString().replace(/^\//, '').split('/').at(-1);
if (newName) {
pageTitle.value = newName + ' | Safelight';
} else {
Expand Down
111 changes: 0 additions & 111 deletions packages/safelight/src/components/Editor/CodeEditor/Monaco.vue

This file was deleted.

Loading

0 comments on commit 011b2d9

Please sign in to comment.