diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 4db389d24e..4431c1675e 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: pnpm install - name: Format code - run: pnpm run format + run: pnpm run format:ci - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 with: diff --git a/package.json b/package.json index e1e3eb6eda..3be9d8e87c 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,10 @@ "build:ci": "turbo run build:ci --no-deps --scope=astro --scope=create-astro --scope=\"@astrojs/*\"", "build:examples": "turbo run build --scope=\"@example/*\"", "dev": "turbo run dev --no-deps --no-cache --parallel --scope=astro --scope=create-astro --scope=\"@astrojs/*\"", + "format": "pnpm run format:code", + "format:ci": "pnpm run format:imports && pnpm run format:code", + "format:code": "prettier -w .", + "format:imports": "organize-imports-cli ./packages/*/tsconfig.json ./packages/*/*/tsconfig.json", "test": "turbo run test --concurrency=1", "test:match": "cd packages/astro && pnpm run test:match", "test:templates": "turbo run test --filter=create-astro --concurrency=1", @@ -22,7 +26,6 @@ "test:e2e:match": "cd packages/astro && pnpm playwright install && pnpm run test:e2e:match", "benchmark": "turbo run benchmark --scope=astro", "lint": "eslint \"packages/**/*.ts\"", - "format": "prettier -w .", "version": "changeset version && pnpm install --no-frozen-lockfile && pnpm run format" }, "workspaces": [ @@ -68,6 +71,7 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.0.0", "execa": "^6.1.0", + "organize-imports-cli": "^0.10.0", "patch-package": "^6.4.7", "prettier": "^2.6.2", "pretty-bytes": "^6.0.0", diff --git a/packages/integrations/deno/src/server.ts b/packages/integrations/deno/src/server.ts index d1bed9aec9..eb83c8eae7 100644 --- a/packages/integrations/deno/src/server.ts +++ b/packages/integrations/deno/src/server.ts @@ -1,4 +1,9 @@ +// NOTE(fks): Side-effect -- shim.js must run first. This isn't guaranteed by +// the language, but it is a Node.js behavior that we rely on here. Keep this +// separate from the other imports so that it doesn't get organized & reordered. import './shim.js'; + +// Normal Imports import type { SSRManifest } from 'astro'; import { App } from 'astro/app'; // @ts-ignore diff --git a/packages/integrations/vercel/src/edge/entrypoint.ts b/packages/integrations/vercel/src/edge/entrypoint.ts index af1496f602..0cd069b6e2 100644 --- a/packages/integrations/vercel/src/edge/entrypoint.ts +++ b/packages/integrations/vercel/src/edge/entrypoint.ts @@ -1,5 +1,9 @@ +// NOTE(fks): Side-effect -- shim.js must run first. This isn't guaranteed by +// the language, but it is a Node.js behavior that we rely on here. Keep this +// separate from the other imports so that it doesn't get organized & reordered. import './shim.js'; +// Normal Imports import type { SSRManifest } from 'astro'; import { App } from 'astro/app'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1b00d4aa84..326b8e9c3d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,6 +16,7 @@ importers: eslint-config-prettier: ^8.5.0 eslint-plugin-prettier: ^4.0.0 execa: ^6.1.0 + organize-imports-cli: ^0.10.0 patch-package: ^6.4.7 prettier: ^2.6.2 pretty-bytes: ^6.0.0 @@ -36,6 +37,7 @@ importers: eslint-config-prettier: 8.5.0_eslint@8.16.0 eslint-plugin-prettier: 4.0.0_j7rsahgqtkecno6yauhsgsglf4 execa: 6.1.0 + organize-imports-cli: 0.10.0 patch-package: 6.4.7 prettier: 2.6.2 pretty-bytes: 6.0.0 @@ -6515,6 +6517,15 @@ packages: engines: {node: '>= 6'} dev: true + /@ts-morph/common/0.15.0: + resolution: {integrity: sha512-QefRbadcwfBnd3HWrltpjRJprHgeKfQsnbyGbRF8pEjMqISAljJwq4wfRETxxojsmN4GWuJv3PWG+W7kBIHMMw==} + dependencies: + fast-glob: 3.2.11 + minimatch: 5.1.0 + mkdirp: 1.0.4 + path-browserify: 1.0.1 + dev: true + /@types/acorn/4.0.6: resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==} dependencies: @@ -6788,6 +6799,14 @@ packages: '@types/node': 17.0.38 dev: true + /@types/strip-bom/3.0.0: + resolution: {integrity: sha512-xevGOReSYGM7g/kUBZzPqCrR/KYAo+F0yiPc85WFTJa0MSLtyFTVTU6cJu/aV4mid7IffDIWqo69THF2o4JiEQ==} + dev: true + + /@types/strip-json-comments/0.0.30: + resolution: {integrity: sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ==} + dev: true + /@types/tailwindcss/3.0.10: resolution: {integrity: sha512-1UnZIHO0NOPyPlPFV0HuMjki2SHkvG9uBA1ZehWj/OQMSROk503nuNyyfmJSIT289yewxTbKoPG+KLxYRvfIIg==} dev: true @@ -7866,6 +7885,12 @@ packages: engines: {node: '>=6'} dev: false + /code-block-writer/11.0.0: + resolution: {integrity: sha512-GEqWvEWWsOvER+g9keO4ohFoD3ymwyCnqY3hoTr7GZipYFwEhMHJw+TtV0rfgRhNImM6QWZGO2XYjlJVyYT62w==} + dependencies: + tslib: 2.3.1 + dev: true + /code-point-at/1.1.0: resolution: {integrity: sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==} engines: {node: '>=0.10.0'} @@ -8072,6 +8097,11 @@ packages: /debug/3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.1.3 dev: false @@ -8354,6 +8384,16 @@ packages: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: false + /editorconfig/0.15.3: + resolution: {integrity: sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==} + hasBin: true + dependencies: + commander: 2.20.3 + lru-cache: 4.1.5 + semver: 5.7.1 + sigmund: 1.0.1 + dev: true + /ejs/3.1.8: resolution: {integrity: sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==} engines: {node: '>=0.10.0'} @@ -10924,7 +10964,6 @@ packages: resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} engines: {node: '>=10'} hasBin: true - dev: false /mocha/9.2.2: resolution: {integrity: sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==} @@ -11003,6 +11042,8 @@ packages: debug: 3.2.7 iconv-lite: 0.4.24 sax: 1.2.4 + transitivePeerDependencies: + - supports-color dev: false /netmask/2.0.2: @@ -11086,6 +11127,8 @@ packages: rimraf: 2.7.1 semver: 5.7.1 tar: 4.4.19 + transitivePeerDependencies: + - supports-color dev: false /node-releases/2.0.5: @@ -11280,6 +11323,16 @@ packages: wcwidth: 1.0.1 dev: false + /organize-imports-cli/0.10.0: + resolution: {integrity: sha512-cVyNEeiDxX/zA6gdK1QS2rr3TK1VymIkT0LagnAk4f6eE0IC0bo3BeUkMzm3q3GnCJzYC+6lfuMpBE0Cequ7Vg==} + hasBin: true + dependencies: + chalk: 4.1.2 + editorconfig: 0.15.3 + ts-morph: 15.0.0 + tsconfig: 7.0.0 + dev: true + /os-homedir/1.0.2: resolution: {integrity: sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==} engines: {node: '>=0.10.0'} @@ -11457,7 +11510,6 @@ packages: /path-browserify/1.0.1: resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} - dev: false /path-exists/4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} @@ -12352,6 +12404,10 @@ packages: get-intrinsic: 1.1.1 object-inspect: 1.12.2 + /sigmund/1.0.1: + resolution: {integrity: sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=} + dev: true + /signal-exit/3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} @@ -12991,6 +13047,13 @@ packages: /trough/2.1.0: resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==} + /ts-morph/15.0.0: + resolution: {integrity: sha512-OZkg0TI1h6FVe8DZXyBo6p7NfCN9EZZkkA736f243KzQ3cypYWtaLc9eyNn/JH/fWYfQ4d6wIA4oM0vElRTGcQ==} + dependencies: + '@ts-morph/common': 0.15.0 + code-block-writer: 11.0.0 + dev: true + /tsconfig-resolver/3.0.1: resolution: {integrity: sha512-ZHqlstlQF449v8glscGRXzL6l2dZvASPCdXJRWG4gHEZlUVx2Jtmr+a2zeVG4LCsKhDXKRj5R3h0C/98UcVAQg==} dependencies: @@ -13002,10 +13065,23 @@ packages: type-fest: 0.13.1 dev: false + /tsconfig/7.0.0: + resolution: {integrity: sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw==} + dependencies: + '@types/strip-bom': 3.0.0 + '@types/strip-json-comments': 0.0.30 + strip-bom: 3.0.0 + strip-json-comments: 2.0.1 + dev: true + /tslib/1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: true + /tslib/2.3.1: + resolution: {integrity: sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==} + dev: true + /tslib/2.4.0: resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==}