diff --git a/docs/docs/package.json b/docs/docs/package.json deleted file mode 100644 index 8a7f2b80af1..00000000000 --- a/docs/docs/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "docs", - "private": true, - "volta": { - "extends": "../../../package.json" - } -} diff --git a/package.json b/package.json index 56ff173def6..919a2a11d6f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "private": true, "devDependencies": { "bump-pack": "workspace:^", - "generate-workspace": "workspace:^", "turbo": "^1.10.13" }, "scripts": { @@ -15,7 +14,7 @@ "test:ci": "turbo default --color --concurrency 1 && turbo compile post-compile lint eslint test test:playwright --color --filter=!hangar", "docs": "./scripts/docsite.sh", "install": "bash scripts/setup_wasi.sh", - "postinstall": "link-bundles && generate-workspace", + "postinstall": "link-bundles", "wing": "turbo compile --filter=winglang --output-logs=errors-only && ./apps/wing/bin/wing" }, "volta": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 752e59f5b1b..e8fa1a23539 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,9 +34,6 @@ importers: bump-pack: specifier: workspace:^ version: link:tools/bump-pack - generate-workspace: - specifier: workspace:^ - version: link:tools/generate-workspace turbo: specifier: ^1.10.13 version: 1.10.13 @@ -968,8 +965,6 @@ importers: specifier: ^5.2.2 version: 5.2.2 - docs/docs: {} - examples/tests/error: {} examples/tests/invalid: @@ -1332,34 +1327,6 @@ importers: specifier: ^5.2.2 version: 5.2.2 - tools/generate-workspace: - dependencies: - '@pnpm/find-workspace-dir': - specifier: ^6.0.2 - version: 6.0.2 - '@pnpm/workspace.find-packages': - specifier: ^1.0.1 - version: 1.0.5(@pnpm/logger@5.0.0) - npm-which: - specifier: ^3.0.1 - version: 3.0.1 - tsx: - specifier: ^3.12.7 - version: 3.12.7 - devDependencies: - '@types/fs-extra': - specifier: ^11 - version: 11.0.1 - '@types/node': - specifier: ^18.16.18 - version: 18.17.13 - '@types/semver': - specifier: ^7.5.0 - version: 7.5.1 - typescript: - specifier: ^5.1.3 - version: 5.1.6 - tools/hangar: devDependencies: '@wingconsole/app': @@ -12435,7 +12402,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.3.0-dev.20230906 + typescript: 5.3.0-dev.20230905 dev: true /dset@3.1.2: @@ -21242,17 +21209,6 @@ packages: typescript: 5.2.2 dev: false - /tsx@3.12.7: - resolution: {integrity: sha512-C2Ip+jPmqKd1GWVQDvz/Eyc6QJbGfE7NrR3fx5BpEHMZsEHoIxHL1j+lKdGobr8ovEyqeNkPLSKp6SCSOt7gmw==} - hasBin: true - dependencies: - '@esbuild-kit/cjs-loader': 2.4.2 - '@esbuild-kit/core-utils': 3.2.2 - '@esbuild-kit/esm-loader': 2.5.5 - optionalDependencies: - fsevents: 2.3.3 - dev: false - /tsx@3.12.8: resolution: {integrity: sha512-Lt9KYaRGF023tlLInPj8rgHwsZU8qWLBj4iRXNWxTfjIkU7canGL806AqKear1j722plHuiYNcL2ZCo6uS9UJA==} hasBin: true @@ -21487,8 +21443,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - /typescript@5.3.0-dev.20230906: - resolution: {integrity: sha512-7dCmQgfQ4i38daoPCCert+rM6gLxBpxRdjncJkHkJV4CWvNZsRX+RVTusojkqGAtW9vqB0+/8iDH6CZ0PDxghg==} + /typescript@5.3.0-dev.20230905: + resolution: {integrity: sha512-Nl9MoKWN0YYlCvQnw850L4ZgqdmqwVGCi9cAoQDw4PsqRGaWAi9HKizS9xu0q4qgKKsEKetWCZHT8dBtJTGaMg==} engines: {node: '>=14.17'} hasBin: true dev: true diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index ee1a2596cb9..bf601137be2 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -2,7 +2,6 @@ packages: - "apps/*" - "libs/*" - "tools/*" - - "docs/docs" - "apps/wing-console/packages/*" - "apps/wing-console/console/*" - "apps/wing-console/tools/*" diff --git a/tools/generate-workspace/README.md b/tools/generate-workspace/README.md deleted file mode 100644 index e3fbcfdd9d2..00000000000 --- a/tools/generate-workspace/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Generate-Workspace CLI - -The `generate-workspace` CLI is a tool that generates a Visual Studio Code [multi-root](https://code.visualstudio.com/docs/editor/multi-root-workspaces) workspace file based on the configuration of a pnpm [workspace](https://pnpm.io/workspaces). - -![screenshot](./screenshot.png) - -## How it works - -The CLI scans the pnpm workspace configuration and creates a `wing.code-workspace` file that Visual Studio Code can use to open multiple projects in the same window. This is particularly useful in a monorepo setup where you might have multiple packages that you want to work with at the same time. - -The generated workspace file includes all the packages in the pnpm workspace, except for those specified in the `ignoreList` in `cli.ts`. The names of the packages in the workspace file are either their actual package names or the names specified in the `nameMapping` in `cli.ts`, if present. - -## Usage - -To use the `generate-workspace` CLI, run the following command in your terminal in the this directory: `npx generate-workspace` - - - diff --git a/tools/generate-workspace/bin/generate-workspace.cjs b/tools/generate-workspace/bin/generate-workspace.cjs deleted file mode 100755 index 5be1bffa694..00000000000 --- a/tools/generate-workspace/bin/generate-workspace.cjs +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env -S node -const { execSync } = require("node:child_process"); -const { resolve, relative } = require("node:path"); - -const which = require("npm-which")(__dirname); -const tsx = relative(process.cwd(), which.sync("tsx")); -const cliSource = relative(process.cwd(), resolve(__dirname, "../src/cli.ts")); -execSync(`${tsx} ${cliSource} ${process.argv.slice(2).join(" ")}`, { - stdio: "inherit", -}); diff --git a/tools/generate-workspace/package.json b/tools/generate-workspace/package.json deleted file mode 100644 index 78725c35fc9..00000000000 --- a/tools/generate-workspace/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "generate-workspace", - "version": "0.0.0", - "private": true, - "bin": { - "generate-workspace": "./bin/generate-workspace.cjs" - }, - "exports": null, - "sideEffects": false, - "files": [ - "dist" - ], - "type": "module", - "scripts": {}, - "devDependencies": { - "@types/fs-extra": "^11", - "@types/node": "^18.16.18", - "@types/semver": "^7.5.0", - "typescript": "^5.1.3" - }, - "dependencies": { - "@pnpm/find-workspace-dir": "^6.0.2", - "@pnpm/workspace.find-packages": "^1.0.1", - "tsx": "^3.12.7", - "npm-which": "^3.0.1" - }, - "volta": { - "extends": "../../package.json" - } -} diff --git a/tools/generate-workspace/screenshot.png b/tools/generate-workspace/screenshot.png deleted file mode 100644 index c2f81842b33..00000000000 Binary files a/tools/generate-workspace/screenshot.png and /dev/null differ diff --git a/tools/generate-workspace/src/cli.ts b/tools/generate-workspace/src/cli.ts deleted file mode 100644 index d58937b4ef8..00000000000 --- a/tools/generate-workspace/src/cli.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { findWorkspacePackages } from "@pnpm/workspace.find-packages"; -import { findWorkspaceDir } from "@pnpm/find-workspace-dir"; -import { writeFileSync } from "fs"; -import { join } from "path"; - -// Define ignore list and name mapping -const ignoreList = [ - "construct-library", - "@wingconsole/eslint-plugin", - "generate-workspace", - "bump-pack", - "@winglang/wingii", - "@winglang/wingc", - "@winglang/tree-sitter-wing", - "@wingconsole/error-message", - "@wingconsole/use-loading", - "@wingconsole/tsconfig", - "hangar", - "@wingconsole/design-system", -]; - -const nameMapping: Record = { - "@winglang/monorepo": "ROOT", - "winglang": "CLI", - "@winglang/compiler": "Compiler", - "@winglang/sdk": "SDK", - "examples-sdk": "SDK Tests", - "docs": "Docs", - "@wingconsole/app": "Console App", - "@wingconsole/server": "Console Server", - "@wingconsole/ui": "Console UI", - "vscode-wing": "VSCode", - "@winglang/jsii-docgen": "API Docs Generator", - "wing-api-checker": "API Checker", - "examples-valid": "Tests: Valid", - "examples-invalid": "Tests: Invalid", - "examples-error": "Tests: Error", -}; - -async function getWorkspaceDir() { - const workspaceDir = await findWorkspaceDir(process.cwd()); - if (!workspaceDir) { - throw new Error("No workspace found"); - } - return workspaceDir; -} - -async function getWorkspacePackages(workspaceDir: string) { - const workspacePackages = await findWorkspacePackages(workspaceDir); - return workspacePackages; -} - -function getFolders(workspacePackages: any[], workspaceDir: string) { - const folders: Record[] = []; - for (const pkg of workspacePackages) { - const pkgName = pkg.manifest.name; - // Skip unwanted packages - if (pkgName == undefined) throw new Error("Package name is undefined"); - if (ignoreList.includes(pkgName)) continue; - - // Use name mapping if present, else use the package name - const name = nameMapping[pkgName] || pkgName; - const path = pkg.dir.replace(workspaceDir, "").substring(1); // Remove workspaceDir from the path - - folders.push({ name, path: `./${path}` }); - } - return folders; -} - -function sortFolders(folders: any[]) { - let sortedFolders = Object.keys(nameMapping).map(key => { - return folders.find(folder => folder.name === key || folder.name === nameMapping[key]); - }).filter(Boolean); - return sortedFolders; -} - -function warnAboutPackages(workspacePackages: any[]) { - workspacePackages.forEach(pkg => { - const pkgName = pkg.manifest.name; - if (pkgName && (!ignoreList.includes(pkgName) && !Object.keys(nameMapping).includes(pkgName))) { - console.warn(`Warning: Package ${pkgName} is not present in ignore list or name mappings. Please check ./tools/generate-workspace/src/cli.ts`); - } - }); -} - -function checkIgnoreListAndNameMapping(workspacePackages: any[]) { - ignoreList.forEach(ignoreItem => { - if (!workspacePackages.some(pkg => pkg.manifest.name === ignoreItem)) { - console.error(`Error: ${ignoreItem} from ignore list is not present as a workspace package. Please check ./tools/generate-workspace/src/cli.ts`); - process.exit(1); - } - }); - - Object.keys(nameMapping).forEach(mappingItem => { - if (!workspacePackages.some(pkg => pkg.manifest.name === mappingItem)) { - console.error(`Error: ${mappingItem} from name mapping is not present as a workspace package. Please check ./tools/generate-workspace/src/cli.ts`); - process.exit(1); - } - }); -} - -function writeWorkspaceFile(workspaceDir: string, sortedFolders: any[]) { - const workspaceFilePath = join(workspaceDir, "wing.code-workspace"); - writeFileSync(workspaceFilePath, JSON.stringify({ folders: sortedFolders, settings: {}}, null, 2)); - console.log(`Workspace file written to ${workspaceFilePath}`); -} - -async function main() { - const workspaceDir = await getWorkspaceDir(); - const workspacePackages = await getWorkspacePackages(workspaceDir); - const folders = getFolders(workspacePackages, workspaceDir); - const sortedFolders = sortFolders(folders); - warnAboutPackages(workspacePackages); - checkIgnoreListAndNameMapping(workspacePackages); - writeWorkspaceFile(workspaceDir, sortedFolders); -} - -main(); diff --git a/tools/generate-workspace/tsconfig.json b/tools/generate-workspace/tsconfig.json deleted file mode 100644 index b5381a09482..00000000000 --- a/tools/generate-workspace/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "compilerOptions": { - "module": "ES2022", - "target": "ES2022", - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "strict": true - } -} \ No newline at end of file diff --git a/wing.code-workspace b/wing.code-workspace deleted file mode 100644 index 1bedc45849d..00000000000 --- a/wing.code-workspace +++ /dev/null @@ -1,65 +0,0 @@ -{ - "folders": [ - { - "name": "ROOT", - "path": "./" - }, - { - "name": "CLI", - "path": "./apps/wing" - }, - { - "name": "Compiler", - "path": "./libs/wingcompiler" - }, - { - "name": "SDK", - "path": "./libs/wingsdk" - }, - { - "name": "SDK Tests", - "path": "./examples/tests/sdk_tests" - }, - { - "name": "Docs", - "path": "./docs/docs" - }, - { - "name": "Console App", - "path": "./apps/wing-console/console/app" - }, - { - "name": "Console Server", - "path": "./apps/wing-console/console/server" - }, - { - "name": "Console UI", - "path": "./apps/wing-console/console/ui" - }, - { - "name": "VSCode", - "path": "./apps/vscode-wing" - }, - { - "name": "API Docs Generator", - "path": "./apps/jsii-docgen" - }, - { - "name": "API Checker", - "path": "./apps/wing-api-checker" - }, - { - "name": "Tests: Valid", - "path": "./examples/tests/valid" - }, - { - "name": "Tests: Invalid", - "path": "./examples/tests/invalid" - }, - { - "name": "Tests: Error", - "path": "./examples/tests/error" - } - ], - "settings": {} -} \ No newline at end of file