From ccdd9ebfe65c27ec3c47a1f4a3ce297a66f7612d Mon Sep 17 00:00:00 2001 From: Vladislav Kibenko Date: Wed, 27 Mar 2024 14:24:07 +0300 Subject: [PATCH] fix(create-mini-app): add shebang --- packages/create-mini-app/package.json | 1 + packages/create-mini-app/src/index.ts | 1 + packages/create-mini-app/vite.config.ts | 6 ++++++ pnpm-lock.yaml | 22 +++++++++++++++++++++- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/create-mini-app/package.json b/packages/create-mini-app/package.json index 748227d76..82571facf 100644 --- a/packages/create-mini-app/package.json +++ b/packages/create-mini-app/package.json @@ -35,6 +35,7 @@ "@types/node": "^20.0.0", "build-utils": "workspace:*", "eslint-config-custom": "workspace:*", + "rollup-plugin-preserve-shebang": "^1.0.1", "test-utils": "workspace:*", "tsconfig": "workspace:*" }, diff --git a/packages/create-mini-app/src/index.ts b/packages/create-mini-app/src/index.ts index 3aead1de4..5151a8fd4 100644 --- a/packages/create-mini-app/src/index.ts +++ b/packages/create-mini-app/src/index.ts @@ -1,3 +1,4 @@ +#!/usr/bin/env node import process from 'node:process'; import chalk from 'chalk'; diff --git a/packages/create-mini-app/vite.config.ts b/packages/create-mini-app/vite.config.ts index b0c154a12..2323f225c 100644 --- a/packages/create-mini-app/vite.config.ts +++ b/packages/create-mini-app/vite.config.ts @@ -1,6 +1,12 @@ import { defineConfig } from 'vite'; +import shebang from 'rollup-plugin-preserve-shebang'; export default defineConfig({ + plugins: [ + shebang({ + shebang: '#!/usr/bin/env node', + }), + ], build: { emptyOutDir: true, ssr: true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 076272a8e..26dbd5679 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -104,6 +104,9 @@ importers: eslint-config-custom: specifier: workspace:* version: link:../eslint-config-custom + rollup-plugin-preserve-shebang: + specifier: ^1.0.1 + version: 1.0.1 test-utils: specifier: workspace:* version: link:../test-utils @@ -2044,7 +2047,7 @@ packages: /@vitest/snapshot@0.34.6: resolution: {integrity: sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==} dependencies: - magic-string: 0.30.4 + magic-string: 0.30.5 pathe: 1.1.1 pretty-format: 29.6.1 dev: true @@ -4782,6 +4785,12 @@ packages: dependencies: yallist: 4.0.0 + /magic-string@0.25.9: + resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} + dependencies: + sourcemap-codec: 1.4.8 + dev: true + /magic-string@0.30.4: resolution: {integrity: sha512-Q/TKtsC5BPm0kGqgBIF9oXAs/xEf2vRKiIB4wCRQTJOQIByZ1d+NnUOotvJOvNpi5RNIgVOMC3pOuaP1ZTDlVg==} engines: {node: '>=12'} @@ -5580,6 +5589,12 @@ packages: dependencies: glob: 7.2.3 + /rollup-plugin-preserve-shebang@1.0.1: + resolution: {integrity: sha512-gk7ExGBqvUinhgrvldKHkAKXXwRkWMXMZymNkrtn50uBgHITlhRjhnKmbNGwAIc4Bzgl3yLv7/8Fhi/XeHhFKg==} + dependencies: + magic-string: 0.25.9 + dev: true + /rollup@3.29.4: resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} @@ -5828,6 +5843,11 @@ packages: engines: {node: '>=0.10.0'} dev: true + /sourcemap-codec@1.4.8: + resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} + deprecated: Please use @jridgewell/sourcemap-codec instead + dev: true + /spawndamnit@2.0.0: resolution: {integrity: sha512-j4JKEcncSjFlqIwU5L/rp2N5SIPsdxaRsIv678+TZxZ0SRDJTm8JrxJMjE/XuiEZNEir3S8l0Fa3Ke339WI4qA==} dependencies: