diff --git a/package.json b/package.json index ebdc4ea..1983927 100644 --- a/package.json +++ b/package.json @@ -81,9 +81,10 @@ "npm-run-all": "^4.1.5", "prettier": "^3.2.5", "stylelint": "^16.6.1", - "tsup": "^8.0.2", + "tsup": "^8.1.0", "tsx": "^4.11.0", "type-fest": "^4.18.3", "typescript": "~5.4.5" - } + }, + "packageManager": "pnpm@9.1.4+sha512.9df9cf27c91715646c7d675d1c9c8e41f6fce88246f1318c1aa6a1ed1aeb3c4f032fcdf4ba63cc69c4fe6d634279176b5358727d8f2cc1e65b65f43ce2f8bfb0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 235f820..cb3cf1c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -88,8 +88,8 @@ importers: specifier: ^16.6.1 version: 16.6.1(typescript@5.4.5) tsup: - specifier: ^8.0.2 - version: 8.0.2(postcss@8.4.38)(ts-node@10.9.1(@types/node@18.19.33)(typescript@5.4.5))(typescript@5.4.5) + specifier: ^8.1.0 + version: 8.1.0(postcss@8.4.38)(ts-node@10.9.1(@types/node@18.19.33)(typescript@5.4.5))(typescript@5.4.5) tsx: specifier: ^4.11.0 version: 4.11.0 @@ -414,11 +414,11 @@ packages: cpu: [ppc64] os: [aix] - '@esbuild/android-arm64@0.19.5': - resolution: {integrity: sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==} + '@esbuild/aix-ppc64@0.21.4': + resolution: {integrity: sha512-Zrm+B33R4LWPLjDEVnEqt2+SLTATlru1q/xYKVn8oVTbiRBGmK2VIMoIYGJDGyftnGaC788IuzGFAlb7IQ0Y8A==} engines: {node: '>=12'} - cpu: [arm64] - os: [android] + cpu: [ppc64] + os: [aix] '@esbuild/android-arm64@0.20.2': resolution: {integrity: sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==} @@ -426,10 +426,10 @@ packages: cpu: [arm64] os: [android] - '@esbuild/android-arm@0.19.5': - resolution: {integrity: sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==} + '@esbuild/android-arm64@0.21.4': + resolution: {integrity: sha512-fYFnz+ObClJ3dNiITySBUx+oNalYUT18/AryMxfovLkYWbutXsct3Wz2ZWAcGGppp+RVVX5FiXeLYGi97umisA==} engines: {node: '>=12'} - cpu: [arm] + cpu: [arm64] os: [android] '@esbuild/android-arm@0.20.2': @@ -438,10 +438,10 @@ packages: cpu: [arm] os: [android] - '@esbuild/android-x64@0.19.5': - resolution: {integrity: sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==} + '@esbuild/android-arm@0.21.4': + resolution: {integrity: sha512-E7H/yTd8kGQfY4z9t3nRPk/hrhaCajfA3YSQSBrst8B+3uTcgsi8N+ZWYCaeIDsiVs6m65JPCaQN/DxBRclF3A==} engines: {node: '>=12'} - cpu: [x64] + cpu: [arm] os: [android] '@esbuild/android-x64@0.20.2': @@ -450,11 +450,11 @@ packages: cpu: [x64] os: [android] - '@esbuild/darwin-arm64@0.19.5': - resolution: {integrity: sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==} + '@esbuild/android-x64@0.21.4': + resolution: {integrity: sha512-mDqmlge3hFbEPbCWxp4fM6hqq7aZfLEHZAKGP9viq9wMUBVQx202aDIfc3l+d2cKhUJM741VrCXEzRFhPDKH3Q==} engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] + cpu: [x64] + os: [android] '@esbuild/darwin-arm64@0.20.2': resolution: {integrity: sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==} @@ -462,10 +462,10 @@ packages: cpu: [arm64] os: [darwin] - '@esbuild/darwin-x64@0.19.5': - resolution: {integrity: sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==} + '@esbuild/darwin-arm64@0.21.4': + resolution: {integrity: sha512-72eaIrDZDSiWqpmCzVaBD58c8ea8cw/U0fq/PPOTqE3c53D0xVMRt2ooIABZ6/wj99Y+h4ksT/+I+srCDLU9TA==} engines: {node: '>=12'} - cpu: [x64] + cpu: [arm64] os: [darwin] '@esbuild/darwin-x64@0.20.2': @@ -474,11 +474,11 @@ packages: cpu: [x64] os: [darwin] - '@esbuild/freebsd-arm64@0.19.5': - resolution: {integrity: sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==} + '@esbuild/darwin-x64@0.21.4': + resolution: {integrity: sha512-uBsuwRMehGmw1JC7Vecu/upOjTsMhgahmDkWhGLWxIgUn2x/Y4tIwUZngsmVb6XyPSTXJYS4YiASKPcm9Zitag==} engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] + cpu: [x64] + os: [darwin] '@esbuild/freebsd-arm64@0.20.2': resolution: {integrity: sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==} @@ -486,10 +486,10 @@ packages: cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-x64@0.19.5': - resolution: {integrity: sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==} + '@esbuild/freebsd-arm64@0.21.4': + resolution: {integrity: sha512-8JfuSC6YMSAEIZIWNL3GtdUT5NhUA/CMUCpZdDRolUXNAXEE/Vbpe6qlGLpfThtY5NwXq8Hi4nJy4YfPh+TwAg==} engines: {node: '>=12'} - cpu: [x64] + cpu: [arm64] os: [freebsd] '@esbuild/freebsd-x64@0.20.2': @@ -498,11 +498,11 @@ packages: cpu: [x64] os: [freebsd] - '@esbuild/linux-arm64@0.19.5': - resolution: {integrity: sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==} + '@esbuild/freebsd-x64@0.21.4': + resolution: {integrity: sha512-8d9y9eQhxv4ef7JmXny7591P/PYsDFc4+STaxC1GBv0tMyCdyWfXu2jBuqRsyhY8uL2HU8uPyscgE2KxCY9imQ==} engines: {node: '>=12'} - cpu: [arm64] - os: [linux] + cpu: [x64] + os: [freebsd] '@esbuild/linux-arm64@0.20.2': resolution: {integrity: sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==} @@ -510,10 +510,10 @@ packages: cpu: [arm64] os: [linux] - '@esbuild/linux-arm@0.19.5': - resolution: {integrity: sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==} + '@esbuild/linux-arm64@0.21.4': + resolution: {integrity: sha512-/GLD2orjNU50v9PcxNpYZi+y8dJ7e7/LhQukN3S4jNDXCKkyyiyAz9zDw3siZ7Eh1tRcnCHAo/WcqKMzmi4eMQ==} engines: {node: '>=12'} - cpu: [arm] + cpu: [arm64] os: [linux] '@esbuild/linux-arm@0.20.2': @@ -522,10 +522,10 @@ packages: cpu: [arm] os: [linux] - '@esbuild/linux-ia32@0.19.5': - resolution: {integrity: sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==} + '@esbuild/linux-arm@0.21.4': + resolution: {integrity: sha512-2rqFFefpYmpMs+FWjkzSgXg5vViocqpq5a1PSRgT0AvSgxoXmGF17qfGAzKedg6wAwyM7UltrKVo9kxaJLMF/g==} engines: {node: '>=12'} - cpu: [ia32] + cpu: [arm] os: [linux] '@esbuild/linux-ia32@0.20.2': @@ -534,10 +534,10 @@ packages: cpu: [ia32] os: [linux] - '@esbuild/linux-loong64@0.19.5': - resolution: {integrity: sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==} + '@esbuild/linux-ia32@0.21.4': + resolution: {integrity: sha512-pNftBl7m/tFG3t2m/tSjuYeWIffzwAZT9m08+9DPLizxVOsUl8DdFzn9HvJrTQwe3wvJnwTdl92AonY36w/25g==} engines: {node: '>=12'} - cpu: [loong64] + cpu: [ia32] os: [linux] '@esbuild/linux-loong64@0.20.2': @@ -546,10 +546,10 @@ packages: cpu: [loong64] os: [linux] - '@esbuild/linux-mips64el@0.19.5': - resolution: {integrity: sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==} + '@esbuild/linux-loong64@0.21.4': + resolution: {integrity: sha512-cSD2gzCK5LuVX+hszzXQzlWya6c7hilO71L9h4KHwqI4qeqZ57bAtkgcC2YioXjsbfAv4lPn3qe3b00Zt+jIfQ==} engines: {node: '>=12'} - cpu: [mips64el] + cpu: [loong64] os: [linux] '@esbuild/linux-mips64el@0.20.2': @@ -558,10 +558,10 @@ packages: cpu: [mips64el] os: [linux] - '@esbuild/linux-ppc64@0.19.5': - resolution: {integrity: sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==} + '@esbuild/linux-mips64el@0.21.4': + resolution: {integrity: sha512-qtzAd3BJh7UdbiXCrg6npWLYU0YpufsV9XlufKhMhYMJGJCdfX/G6+PNd0+v877X1JG5VmjBLUiFB0o8EUSicA==} engines: {node: '>=12'} - cpu: [ppc64] + cpu: [mips64el] os: [linux] '@esbuild/linux-ppc64@0.20.2': @@ -570,10 +570,10 @@ packages: cpu: [ppc64] os: [linux] - '@esbuild/linux-riscv64@0.19.5': - resolution: {integrity: sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==} + '@esbuild/linux-ppc64@0.21.4': + resolution: {integrity: sha512-yB8AYzOTaL0D5+2a4xEy7OVvbcypvDR05MsB/VVPVA7nL4hc5w5Dyd/ddnayStDgJE59fAgNEOdLhBxjfx5+dg==} engines: {node: '>=12'} - cpu: [riscv64] + cpu: [ppc64] os: [linux] '@esbuild/linux-riscv64@0.20.2': @@ -582,10 +582,10 @@ packages: cpu: [riscv64] os: [linux] - '@esbuild/linux-s390x@0.19.5': - resolution: {integrity: sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==} + '@esbuild/linux-riscv64@0.21.4': + resolution: {integrity: sha512-Y5AgOuVzPjQdgU59ramLoqSSiXddu7F3F+LI5hYy/d1UHN7K5oLzYBDZe23QmQJ9PIVUXwOdKJ/jZahPdxzm9w==} engines: {node: '>=12'} - cpu: [s390x] + cpu: [riscv64] os: [linux] '@esbuild/linux-s390x@0.20.2': @@ -594,10 +594,10 @@ packages: cpu: [s390x] os: [linux] - '@esbuild/linux-x64@0.19.5': - resolution: {integrity: sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==} + '@esbuild/linux-s390x@0.21.4': + resolution: {integrity: sha512-Iqc/l/FFwtt8FoTK9riYv9zQNms7B8u+vAI/rxKuN10HgQIXaPzKZc479lZ0x6+vKVQbu55GdpYpeNWzjOhgbA==} engines: {node: '>=12'} - cpu: [x64] + cpu: [s390x] os: [linux] '@esbuild/linux-x64@0.20.2': @@ -606,11 +606,11 @@ packages: cpu: [x64] os: [linux] - '@esbuild/netbsd-x64@0.19.5': - resolution: {integrity: sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==} + '@esbuild/linux-x64@0.21.4': + resolution: {integrity: sha512-Td9jv782UMAFsuLZINfUpoF5mZIbAj+jv1YVtE58rFtfvoKRiKSkRGQfHTgKamLVT/fO7203bHa3wU122V/Bdg==} engines: {node: '>=12'} cpu: [x64] - os: [netbsd] + os: [linux] '@esbuild/netbsd-x64@0.20.2': resolution: {integrity: sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==} @@ -618,11 +618,11 @@ packages: cpu: [x64] os: [netbsd] - '@esbuild/openbsd-x64@0.19.5': - resolution: {integrity: sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==} + '@esbuild/netbsd-x64@0.21.4': + resolution: {integrity: sha512-Awn38oSXxsPMQxaV0Ipb7W/gxZtk5Tx3+W+rAPdZkyEhQ6968r9NvtkjhnhbEgWXYbgV+JEONJ6PcdBS+nlcpA==} engines: {node: '>=12'} cpu: [x64] - os: [openbsd] + os: [netbsd] '@esbuild/openbsd-x64@0.20.2': resolution: {integrity: sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==} @@ -630,11 +630,11 @@ packages: cpu: [x64] os: [openbsd] - '@esbuild/sunos-x64@0.19.5': - resolution: {integrity: sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==} + '@esbuild/openbsd-x64@0.21.4': + resolution: {integrity: sha512-IsUmQeCY0aU374R82fxIPu6vkOybWIMc3hVGZ3ChRwL9hA1TwY+tS0lgFWV5+F1+1ssuvvXt3HFqe8roCip8Hg==} engines: {node: '>=12'} cpu: [x64] - os: [sunos] + os: [openbsd] '@esbuild/sunos-x64@0.20.2': resolution: {integrity: sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==} @@ -642,11 +642,11 @@ packages: cpu: [x64] os: [sunos] - '@esbuild/win32-arm64@0.19.5': - resolution: {integrity: sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==} + '@esbuild/sunos-x64@0.21.4': + resolution: {integrity: sha512-hsKhgZ4teLUaDA6FG/QIu2q0rI6I36tZVfM4DBZv3BG0mkMIdEnMbhc4xwLvLJSS22uWmaVkFkqWgIS0gPIm+A==} engines: {node: '>=12'} - cpu: [arm64] - os: [win32] + cpu: [x64] + os: [sunos] '@esbuild/win32-arm64@0.20.2': resolution: {integrity: sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==} @@ -654,10 +654,10 @@ packages: cpu: [arm64] os: [win32] - '@esbuild/win32-ia32@0.19.5': - resolution: {integrity: sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==} + '@esbuild/win32-arm64@0.21.4': + resolution: {integrity: sha512-UUfMgMoXPoA/bvGUNfUBFLCh0gt9dxZYIx9W4rfJr7+hKe5jxxHmfOK8YSH4qsHLLN4Ck8JZ+v7Q5fIm1huErg==} engines: {node: '>=12'} - cpu: [ia32] + cpu: [arm64] os: [win32] '@esbuild/win32-ia32@0.20.2': @@ -666,10 +666,10 @@ packages: cpu: [ia32] os: [win32] - '@esbuild/win32-x64@0.19.5': - resolution: {integrity: sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==} + '@esbuild/win32-ia32@0.21.4': + resolution: {integrity: sha512-yIxbspZb5kGCAHWm8dexALQ9en1IYDfErzjSEq1KzXFniHv019VT3mNtTK7t8qdy4TwT6QYHI9sEZabONHg+aw==} engines: {node: '>=12'} - cpu: [x64] + cpu: [ia32] os: [win32] '@esbuild/win32-x64@0.20.2': @@ -678,6 +678,12 @@ packages: cpu: [x64] os: [win32] + '@esbuild/win32-x64@0.21.4': + resolution: {integrity: sha512-sywLRD3UK/qRJt0oBwdpYLBibk7KiRfbswmWRDabuncQYSlf8aLEEUor/oP6KRz8KEG+HoiVLBhPRD5JWjS8Sg==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + '@eslint-community/eslint-utils@4.4.0': resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -1610,13 +1616,13 @@ packages: resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} engines: {node: '>= 0.4'} - esbuild@0.19.5: - resolution: {integrity: sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==} + esbuild@0.20.2: + resolution: {integrity: sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==} engines: {node: '>=12'} hasBin: true - esbuild@0.20.2: - resolution: {integrity: sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==} + esbuild@0.21.4: + resolution: {integrity: sha512-sFMcNNrj+Q0ZDolrp5pDhH0nRPN9hLIM3fRPwgbLYJeSHHgnXSnbV3xYgSVuOeLWH9c73VwmEverVzupIv5xuA==} engines: {node: '>=12'} hasBin: true @@ -2010,6 +2016,7 @@ packages: glob@7.1.6: resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} + deprecated: Glob versions prior to v9 are no longer supported glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} @@ -3593,8 +3600,8 @@ packages: tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - tsup@8.0.2: - resolution: {integrity: sha512-NY8xtQXdH7hDUAZwcQdY/Vzlw9johQsaqf7iwZ6g1DOUlFYQ5/AtVAjTvihhEyeRlGo4dLRVHtrRaL35M1daqQ==} + tsup@8.1.0: + resolution: {integrity: sha512-UFdfCAXukax+U6KzeTNO2kAARHcWxmKsnvSPXUcfA1D+kU05XDccCrkffCQpFaWDsZfV0jMyTsxU39VfCp6EOg==} engines: {node: '>=18'} hasBin: true peerDependencies: @@ -3802,10 +3809,6 @@ packages: yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - yaml@2.3.4: - resolution: {integrity: sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==} - engines: {node: '>= 14'} - yaml@2.4.2: resolution: {integrity: sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA==} engines: {node: '>= 14'} @@ -4122,138 +4125,141 @@ snapshots: '@esbuild/aix-ppc64@0.20.2': optional: true - '@esbuild/android-arm64@0.19.5': + '@esbuild/aix-ppc64@0.21.4': optional: true '@esbuild/android-arm64@0.20.2': optional: true - '@esbuild/android-arm@0.19.5': + '@esbuild/android-arm64@0.21.4': optional: true '@esbuild/android-arm@0.20.2': optional: true - '@esbuild/android-x64@0.19.5': + '@esbuild/android-arm@0.21.4': optional: true '@esbuild/android-x64@0.20.2': optional: true - '@esbuild/darwin-arm64@0.19.5': + '@esbuild/android-x64@0.21.4': optional: true '@esbuild/darwin-arm64@0.20.2': optional: true - '@esbuild/darwin-x64@0.19.5': + '@esbuild/darwin-arm64@0.21.4': optional: true '@esbuild/darwin-x64@0.20.2': optional: true - '@esbuild/freebsd-arm64@0.19.5': + '@esbuild/darwin-x64@0.21.4': optional: true '@esbuild/freebsd-arm64@0.20.2': optional: true - '@esbuild/freebsd-x64@0.19.5': + '@esbuild/freebsd-arm64@0.21.4': optional: true '@esbuild/freebsd-x64@0.20.2': optional: true - '@esbuild/linux-arm64@0.19.5': + '@esbuild/freebsd-x64@0.21.4': optional: true '@esbuild/linux-arm64@0.20.2': optional: true - '@esbuild/linux-arm@0.19.5': + '@esbuild/linux-arm64@0.21.4': optional: true '@esbuild/linux-arm@0.20.2': optional: true - '@esbuild/linux-ia32@0.19.5': + '@esbuild/linux-arm@0.21.4': optional: true '@esbuild/linux-ia32@0.20.2': optional: true - '@esbuild/linux-loong64@0.19.5': + '@esbuild/linux-ia32@0.21.4': optional: true '@esbuild/linux-loong64@0.20.2': optional: true - '@esbuild/linux-mips64el@0.19.5': + '@esbuild/linux-loong64@0.21.4': optional: true '@esbuild/linux-mips64el@0.20.2': optional: true - '@esbuild/linux-ppc64@0.19.5': + '@esbuild/linux-mips64el@0.21.4': optional: true '@esbuild/linux-ppc64@0.20.2': optional: true - '@esbuild/linux-riscv64@0.19.5': + '@esbuild/linux-ppc64@0.21.4': optional: true '@esbuild/linux-riscv64@0.20.2': optional: true - '@esbuild/linux-s390x@0.19.5': + '@esbuild/linux-riscv64@0.21.4': optional: true '@esbuild/linux-s390x@0.20.2': optional: true - '@esbuild/linux-x64@0.19.5': + '@esbuild/linux-s390x@0.21.4': optional: true '@esbuild/linux-x64@0.20.2': optional: true - '@esbuild/netbsd-x64@0.19.5': + '@esbuild/linux-x64@0.21.4': optional: true '@esbuild/netbsd-x64@0.20.2': optional: true - '@esbuild/openbsd-x64@0.19.5': + '@esbuild/netbsd-x64@0.21.4': optional: true '@esbuild/openbsd-x64@0.20.2': optional: true - '@esbuild/sunos-x64@0.19.5': + '@esbuild/openbsd-x64@0.21.4': optional: true '@esbuild/sunos-x64@0.20.2': optional: true - '@esbuild/win32-arm64@0.19.5': + '@esbuild/sunos-x64@0.21.4': optional: true '@esbuild/win32-arm64@0.20.2': optional: true - '@esbuild/win32-ia32@0.19.5': + '@esbuild/win32-arm64@0.21.4': optional: true '@esbuild/win32-ia32@0.20.2': optional: true - '@esbuild/win32-x64@0.19.5': + '@esbuild/win32-ia32@0.21.4': optional: true '@esbuild/win32-x64@0.20.2': optional: true + '@esbuild/win32-x64@0.21.4': + optional: true + '@eslint-community/eslint-utils@4.4.0(eslint@8.49.0)': dependencies: eslint: 8.49.0 @@ -4896,9 +4902,9 @@ snapshots: dependencies: run-applescript: 5.0.0 - bundle-require@4.0.2(esbuild@0.19.5): + bundle-require@4.0.2(esbuild@0.21.4): dependencies: - esbuild: 0.19.5 + esbuild: 0.21.4 load-tsconfig: 0.2.5 cac@6.7.14: {} @@ -5339,31 +5345,6 @@ snapshots: is-date-object: 1.0.5 is-symbol: 1.0.4 - esbuild@0.19.5: - optionalDependencies: - '@esbuild/android-arm': 0.19.5 - '@esbuild/android-arm64': 0.19.5 - '@esbuild/android-x64': 0.19.5 - '@esbuild/darwin-arm64': 0.19.5 - '@esbuild/darwin-x64': 0.19.5 - '@esbuild/freebsd-arm64': 0.19.5 - '@esbuild/freebsd-x64': 0.19.5 - '@esbuild/linux-arm': 0.19.5 - '@esbuild/linux-arm64': 0.19.5 - '@esbuild/linux-ia32': 0.19.5 - '@esbuild/linux-loong64': 0.19.5 - '@esbuild/linux-mips64el': 0.19.5 - '@esbuild/linux-ppc64': 0.19.5 - '@esbuild/linux-riscv64': 0.19.5 - '@esbuild/linux-s390x': 0.19.5 - '@esbuild/linux-x64': 0.19.5 - '@esbuild/netbsd-x64': 0.19.5 - '@esbuild/openbsd-x64': 0.19.5 - '@esbuild/sunos-x64': 0.19.5 - '@esbuild/win32-arm64': 0.19.5 - '@esbuild/win32-ia32': 0.19.5 - '@esbuild/win32-x64': 0.19.5 - esbuild@0.20.2: optionalDependencies: '@esbuild/aix-ppc64': 0.20.2 @@ -5390,6 +5371,32 @@ snapshots: '@esbuild/win32-ia32': 0.20.2 '@esbuild/win32-x64': 0.20.2 + esbuild@0.21.4: + optionalDependencies: + '@esbuild/aix-ppc64': 0.21.4 + '@esbuild/android-arm': 0.21.4 + '@esbuild/android-arm64': 0.21.4 + '@esbuild/android-x64': 0.21.4 + '@esbuild/darwin-arm64': 0.21.4 + '@esbuild/darwin-x64': 0.21.4 + '@esbuild/freebsd-arm64': 0.21.4 + '@esbuild/freebsd-x64': 0.21.4 + '@esbuild/linux-arm': 0.21.4 + '@esbuild/linux-arm64': 0.21.4 + '@esbuild/linux-ia32': 0.21.4 + '@esbuild/linux-loong64': 0.21.4 + '@esbuild/linux-mips64el': 0.21.4 + '@esbuild/linux-ppc64': 0.21.4 + '@esbuild/linux-riscv64': 0.21.4 + '@esbuild/linux-s390x': 0.21.4 + '@esbuild/linux-x64': 0.21.4 + '@esbuild/netbsd-x64': 0.21.4 + '@esbuild/openbsd-x64': 0.21.4 + '@esbuild/sunos-x64': 0.21.4 + '@esbuild/win32-arm64': 0.21.4 + '@esbuild/win32-ia32': 0.21.4 + '@esbuild/win32-x64': 0.21.4 + escalade@3.1.1: {} escape-string-regexp@1.0.5: {} @@ -6826,7 +6833,7 @@ snapshots: postcss-load-config@4.0.1(postcss@8.4.38)(ts-node@10.9.1(@types/node@18.19.33)(typescript@5.4.5)): dependencies: lilconfig: 2.1.0 - yaml: 2.3.4 + yaml: 2.4.2 optionalDependencies: postcss: 8.4.38 ts-node: 10.9.1(@types/node@18.19.33)(typescript@5.4.5) @@ -7660,13 +7667,13 @@ snapshots: tslib@2.6.2: {} - tsup@8.0.2(postcss@8.4.38)(ts-node@10.9.1(@types/node@18.19.33)(typescript@5.4.5))(typescript@5.4.5): + tsup@8.1.0(postcss@8.4.38)(ts-node@10.9.1(@types/node@18.19.33)(typescript@5.4.5))(typescript@5.4.5): dependencies: - bundle-require: 4.0.2(esbuild@0.19.5) + bundle-require: 4.0.2(esbuild@0.21.4) cac: 6.7.14 chokidar: 3.5.3 debug: 4.3.4 - esbuild: 0.19.5 + esbuild: 0.21.4 execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 @@ -7924,8 +7931,6 @@ snapshots: yallist@4.0.0: {} - yaml@2.3.4: {} - yaml@2.4.2: {} yargs-parser@20.2.9: {} diff --git a/src/app.ts b/src/app.ts index b78da3c..7b2e555 100644 --- a/src/app.ts +++ b/src/app.ts @@ -52,13 +52,16 @@ const TEMPLATES_NAMES = FRAMEWORKS.map( const PKG_FIELDS = [ 'name', 'version', + 'displayName', 'description', - 'keywords', 'private', 'type', 'engines', 'packageManager', + 'keywords', + 'categories', 'author', + 'publisher', 'contributors', 'homepage', 'bugs', @@ -71,10 +74,16 @@ const PKG_FIELDS = [ 'exports', 'publishConfig', 'repository', + 'activationEvents', + 'contributes', + 'badges', + 'icon', + 'vsce', 'scripts', 'dependencies', 'devDependencies', 'peerDependencies', + 'optionalDependencies', ]; async function getGitInfo(name: string) { @@ -100,15 +109,8 @@ function writePkgJson(filePath: string, data: any) { function sortObjectKeys(values: any, startKeys?: string[], endKeys?: string[]) { const obj = {}; const allKeys = Object.keys(values).sort(); - let sKeys = startKeys || []; - if (sKeys.length > 0) { - sKeys = sKeys.filter(key => allKeys.includes(key)); - } - - let eKeys = endKeys || []; - if (eKeys.length > 0) { - eKeys = eKeys.filter(key => allKeys.includes(key)); - } + const sKeys = initKeys(startKeys); + const eKeys = initKeys(endKeys); sKeys .concat(allKeys.filter(key => !sKeys.includes(key) && !eKeys.includes(key))) @@ -118,6 +120,27 @@ function sortObjectKeys(values: any, startKeys?: string[], endKeys?: string[]) { }); return obj; + + function initKeys(customKeys?: string[]) { + let cKeys = Array.isArray(customKeys) ? customKeys : []; + if (cKeys.length > 0) { + cKeys = cKeys.reduce((acc, key) => { + if (key.endsWith(':*')) { + const sk = key.replace(':*', ':'); + console.log(`sk:`, sk); + const keys = allKeys.filter(k => !acc.includes(k) && k.startsWith(sk)); + return acc.concat(keys); + } + + if (allKeys.includes(key)) { + return acc.concat(key); + } + + return acc; + }, [] as string[]); + } + return cKeys; + } } export async function createApp(options: CLIOptions) { @@ -272,9 +295,11 @@ function handleFinalPkg(pkg: PackageJson, appType: AppType, variant: FrameworkVa pkg[key], [ 'dev', + 'dev:*', 'debug', 'start', 'build', + 'build:*', 'preview', 'test', 'lint', @@ -478,8 +503,9 @@ async function getUserVariant(appType: AppType, rootDir: string, template?: stri }) : variants.map(s => ({ name: s.display, value: s.name })); + const frameworkName = FRAMEWORKS.find(s => s.name === framework)?.display; const _variant = await askList( - 'Select a variant:', + `Select a ${chalk.blue(frameworkName)} variant:`, _variants.concat([{ name: chalk.yellow('← Back'), value: '_' }]), ); diff --git a/templates/base/core/package.json b/templates/base/core/package.json index 64373c2..c083224 100644 --- a/templates/base/core/package.json +++ b/templates/base/core/package.json @@ -18,12 +18,12 @@ "@tomjs/eslint": "^3.1.1", "@tomjs/prettier": "^1.4.1", "@tomjs/tsconfig": "^1.6.0", - "@types/node": "^18.19.33", + "@types/node": "^18.19.34", "eslint": "^8.57.0", "husky": "^9.0.11", "lint-staged": "^15.2.5", "npm-run-all": "^4.1.5", - "prettier": "^3.2.5", + "prettier": "^3.3.0", "rimraf": "^5.0.7", "typescript": "~5.4.5" } diff --git a/templates/base/node/package.json b/templates/base/node/package.json index d5b206f..ec76267 100644 --- a/templates/base/node/package.json +++ b/templates/base/node/package.json @@ -32,6 +32,15 @@ "url": "git+{{gitUrl}}.git" }, "scripts": { - "lint:eslint": "eslint \"{src,test}/**/*.ts\" *.{js,cjs,mjs,ts} --fix --cache" + "lint:eslint": "eslint \"{src,test}/**/*.ts\" *.{js,cjs,mjs,ts} --fix --cache", + "test": "vitest" + }, + "dependencies": { + "@tomjs/node": "^2.1.0" + }, + "devDependencies": { + "tsx": "^4.11.2", + "type-fest": "^4.18.3", + "vitest": "^1.6.0" } } diff --git a/templates/node-cli-legacy/test/index.test.ts b/templates/base/node/test/index.test.ts similarity index 100% rename from templates/node-cli-legacy/test/index.test.ts rename to templates/base/node/test/index.test.ts diff --git a/templates/base/vscode/.vscode/extensions.json b/templates/base/vscode/.vscode/extensions.json new file mode 100644 index 0000000..f8e513b --- /dev/null +++ b/templates/base/vscode/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "lokalise.i18n-ally" + ] +} diff --git a/templates/base/vscode/.vscode/launch.json b/templates/base/vscode/.vscode/launch.json new file mode 100644 index 0000000..1348474 --- /dev/null +++ b/templates/base/vscode/.vscode/launch.json @@ -0,0 +1,21 @@ +// A launch configuration that compiles the extension and then opens it inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Extension", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ], + "outFiles": [ + "${workspaceFolder}/dist/*.js" + ], + "preLaunchTask": "${defaultBuildTask}" + } + ] +} diff --git a/templates/base/vscode/.vscode/settings.json b/templates/base/vscode/.vscode/settings.json new file mode 100644 index 0000000..f701d90 --- /dev/null +++ b/templates/base/vscode/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "i18n-ally.localesPaths": ["locales"] +} diff --git a/templates/base/vscode/.vscode/tasks.json b/templates/base/vscode/.vscode/tasks.json new file mode 100644 index 0000000..d331c19 --- /dev/null +++ b/templates/base/vscode/.vscode/tasks.json @@ -0,0 +1,36 @@ +// See https://go.microsoft.com/fwlink/?LinkId=733558 +// for the documentation about the tasks.json format +{ + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "dev", + "problemMatcher": { + "owner": "typescript", + "fileLocation": "relative", + "pattern": { + "regexp": "^([a-zA-Z]\\:\/?([\\w\\-]\/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$", + "file": 1, + "line": 3, + "column": 4, + "code": 5, + "message": 6 + }, + "background": { + "activeOnStart": true, + "beginsPattern": "^.*extension build start*$", + "endsPattern": "^.*extension (build|rebuild) success.*$" + } + }, + "isBackground": true, + "presentation": { + "reveal": "never" + }, + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/templates/base/vscode/.vscodeignore b/templates/base/vscode/.vscodeignore new file mode 100644 index 0000000..18f5d36 --- /dev/null +++ b/templates/base/vscode/.vscodeignore @@ -0,0 +1,73 @@ +# logs +*.log +lerna-debug.log* +logs +npm-debug.log* +pnpm-debug.log* +yarn-debug.log* +yarn-error.log* + +# diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# runtime data +*.pid +*.pid.lock +*.seed +pids + +# dependency directory +node_modules + +# cache +.cache +.npm +.tmp +.temp +.eslintcache +.stylelintcache +tsconfig.tsbuildinfo + +# environment +*.local + +# macOS +.DS_Store + +# package files +*.7z +*.gz +*.gzip +*.rar +*.tar +*.tar.* +*.tgz +*.zip +*.vsix + +# IDEA +.idea + +# vscode +.vscode +.history + +# project +src +extensions +locales + +.husky +.commitlintrc* +.editorconfig +.eslintrc* +.eslintignore +.gitattributes +.gitignore +.lintstagedrc* +.prettierrc* +.prettierignore +pnpm-lock.yaml +tsconfig.json +tsconfig.*.json +*.config.ts diff --git a/templates/base/vscode/LICENSE b/templates/base/vscode/LICENSE new file mode 100644 index 0000000..1c6b0a2 --- /dev/null +++ b/templates/base/vscode/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) {{dateYear}}-PRESENT {{gitUserName}}<{{gitUserEmail}}> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/templates/base/vscode/_gitignore b/templates/base/vscode/_gitignore new file mode 100644 index 0000000..e454cca --- /dev/null +++ b/templates/base/vscode/_gitignore @@ -0,0 +1,63 @@ +# logs +*.log +lerna-debug.log* +logs +npm-debug.log* +pnpm-debug.log* +yarn-debug.log* +yarn-error.log* + +# diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# runtime data +*.pid +*.pid.lock +*.seed +pids + +# dependency directory +bower_components +jspm_packages +node_modules +web_modules + +# cache +.cache +.npm +.tmp +.temp +.eslintcache +.stylelintcache +tsconfig.tsbuildinfo + +# environment +*.local + +# macOS +.DS_Store + +# package files +*.7z +*.gz +*.gzip +*.rar +*.tar +*.tar.* +*.tgz +*.zip +*.vsix + +# IDEA +.idea + +# vscode +.history + +# build output +build +dist +release + +package.nls.json +package.nls.*.json diff --git a/templates/base/vscode/extension/env.d.ts b/templates/base/vscode/extension/env.d.ts new file mode 100644 index 0000000..1d3981d --- /dev/null +++ b/templates/base/vscode/extension/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/templates/base/vscode/extension/index.ts b/templates/base/vscode/extension/index.ts new file mode 100644 index 0000000..640e475 --- /dev/null +++ b/templates/base/vscode/extension/index.ts @@ -0,0 +1,21 @@ +import { i18n, initExtension } from '@tomjs/vscode'; +import type { ExtensionContext } from 'vscode'; +import { commands, window } from 'vscode'; +import { MainPanel } from './views/panel'; + +export function activate(context: ExtensionContext) { + initExtension(context); + + context.subscriptions.push( + commands.registerCommand('tomjs.xxx.showHello', async () => { + window.showInformationMessage(i18n.t('tomjs.commands.hello')); + }), + ); + context.subscriptions.push( + commands.registerCommand('tomjs.xxx.showPanel', async () => { + MainPanel.render(context); + }), + ); +} + +export function deactivate() {} diff --git a/templates/base/vscode/extension/views/helper.ts b/templates/base/vscode/extension/views/helper.ts new file mode 100644 index 0000000..b7f5f48 --- /dev/null +++ b/templates/base/vscode/extension/views/helper.ts @@ -0,0 +1,27 @@ +import type { Disposable, ExtensionContext, Webview } from 'vscode'; +import { window } from 'vscode'; + +export class WebviewHelper { + public static setupHtml(webview: Webview, context: ExtensionContext) { + return process.env.VITE_DEV_SERVER_URL + ? __getWebviewHtml__(process.env.VITE_DEV_SERVER_URL) + : __getWebviewHtml__(webview, context); + } + + public static setupWebviewHooks(webview: Webview, disposables: Disposable[]) { + webview.onDidReceiveMessage( + (message: any) => { + const command = message.command; + const text = message.text; + console.log(`command: ${command}`); + switch (command) { + case 'hello': + window.showInformationMessage(text); + return; + } + }, + undefined, + disposables, + ); + } +} diff --git a/templates/base/vscode/extension/views/panel.ts b/templates/base/vscode/extension/views/panel.ts new file mode 100644 index 0000000..0cf6992 --- /dev/null +++ b/templates/base/vscode/extension/views/panel.ts @@ -0,0 +1,48 @@ +import type { Disposable, ExtensionContext, WebviewPanel } from 'vscode'; +import { ViewColumn, window } from 'vscode'; +import { WebviewHelper } from './helper'; + +export class MainPanel { + public static currentPanel: MainPanel | undefined; + private readonly _panel: WebviewPanel; + private _disposables: Disposable[] = []; + + private constructor(panel: WebviewPanel, context: ExtensionContext) { + this._panel = panel; + + this._panel.onDidDispose(() => this.dispose(), null, this._disposables); + this._panel.webview.html = WebviewHelper.setupHtml(this._panel.webview, context); + + WebviewHelper.setupWebviewHooks(this._panel.webview, this._disposables); + } + + public static render(context: ExtensionContext) { + if (MainPanel.currentPanel) { + MainPanel.currentPanel._panel.reveal(ViewColumn.One); + } else { + const panel = window.createWebviewPanel('showHelloWorld', 'Hello World', ViewColumn.One, { + enableScripts: true, + }); + + MainPanel.currentPanel = new MainPanel(panel, context); + } + } + + /** + * Cleans up and disposes of webview resources when the webview panel is closed. + */ + public dispose() { + MainPanel.currentPanel = undefined; + + // Dispose of the current webview panel + this._panel.dispose(); + + // Dispose of all disposables (i.e. commands) for the current webview panel + while (this._disposables.length) { + const disposable = this._disposables.pop(); + if (disposable) { + disposable.dispose(); + } + } + } +} diff --git a/templates/base/vscode/locales/en.json b/templates/base/vscode/locales/en.json new file mode 100644 index 0000000..86feed4 --- /dev/null +++ b/templates/base/vscode/locales/en.json @@ -0,0 +1,6 @@ +{ + "tomjs.commands.hello": "Show Hello", + "tomjs.commands.panel": "Open Panel", + "description": "This is a Tomjs Extension.", + "displayName": "Tomjs Extension" +} diff --git a/templates/base/vscode/locales/zh-CN.json b/templates/base/vscode/locales/zh-CN.json new file mode 100644 index 0000000..94d7d30 --- /dev/null +++ b/templates/base/vscode/locales/zh-CN.json @@ -0,0 +1,5 @@ +{ + "tomjs.commands.hello": "显示你好", + "description": "这是一个 Tomjs 扩展。", + "displayName": "Tomjs 扩展" +} diff --git a/templates/base/vscode/locales/zh-TW.json b/templates/base/vscode/locales/zh-TW.json new file mode 100644 index 0000000..fb98ef6 --- /dev/null +++ b/templates/base/vscode/locales/zh-TW.json @@ -0,0 +1,5 @@ +{ + "tomjs.commands.hello": "顯示你好", + "description": "這是一個 Tomjs 延伸模組。", + "displayName": "Tomjs 延伸模組" +} diff --git a/templates/base/vscode/package.json b/templates/base/vscode/package.json new file mode 100644 index 0000000..a3804a9 --- /dev/null +++ b/templates/base/vscode/package.json @@ -0,0 +1,70 @@ +{ + "name": "vscode-extension", + "displayName": "%displayName%", + "description": "%description%", + "version": "0.0.0", + "publisher": "{{gitOrg}}", + "license": "MIT", + "engines": { + "node": ">=14", + "vscode": "^1.56.0" + }, + "main": "dist/extension/index.js", + "keywords": [ + "vscode" + ], + "categories": [ + "Other" + ], + "activationEvents": [ + "onCommand:tomjs.xxx.showHello", + "onCommand:tomjs.xxx.showPanel" + ], + "contributes": { + "commands": [ + { + "command": "tomjs.xxx.showHello", + "title": "%tomjs.commands.hello%", + "category": "%displayName%" + }, + { + "command": "tomjs.xxx.showPanel", + "title": "%tomjs.commands.panel%", + "category": "%displayName%" + } + ] + }, + "repository": { + "type": "git", + "url": "git+{{gitUrl}}.git" + }, + "bugs": { + "url": "git+{{gitUrl}}/issues" + }, + "homepage": "{{gitUrl}}/blob/main/README.md", + "icon": "resources/logo.png", + "vsce": { + "dependencies": false, + "yarn": false + }, + "scripts": { + "dev": "run-p dev:*", + "dev:i18n": "vscode-dev i18n --watch", + "dev:dist": "vite", + "build": "vscode-dev i18n && vite build", + "lint": "run-s lint:eslint lint:stylelint lint:prettier", + "lint:eslint": "eslint \"{src,extension}/**/*.{js,cjs,ts,tsx}\" *.{js,cjs,ts} --fix --cache" + }, + "dependencies": { + "@tomjs/node": "^2.1.0", + "@tomjs/vscode": "^2.0.1", + "@vscode/webview-ui-toolkit": "^1.4.0" + }, + "devDependencies": { + "@tomjs/vite-plugin-vscode": "^2.3.1", + "@tomjs/vscode-dev": "^1.2.3", + "@types/vscode": "^1.56.0", + "@types/vscode-webview": "^1.57.5", + "vite": "^5.2.12" + } +} diff --git a/templates/base/vscode/resources/logo.png b/templates/base/vscode/resources/logo.png new file mode 100644 index 0000000..580b7b6 Binary files /dev/null and b/templates/base/vscode/resources/logo.png differ diff --git a/templates/base/vscode/tsconfig.json b/templates/base/vscode/tsconfig.json new file mode 100644 index 0000000..dbee936 --- /dev/null +++ b/templates/base/vscode/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "@tomjs/tsconfig/vue-dom.json", + "compilerOptions": {}, + "include": ["src"], + "references": [ + { + "path": "./tsconfig.node.json" + } + ] +} diff --git a/templates/base/vscode/tsconfig.node.json b/templates/base/vscode/tsconfig.node.json new file mode 100644 index 0000000..54cff2c --- /dev/null +++ b/templates/base/vscode/tsconfig.node.json @@ -0,0 +1,7 @@ +{ + "extends": "@tomjs/tsconfig/node.json", + "compilerOptions": { + "composite": true + }, + "include": ["extension", "package.json", "vite.config.ts"] +} diff --git a/templates/config.json b/templates/config.json index 1245da3..0ca461d 100644 --- a/templates/config.json +++ b/templates/config.json @@ -67,12 +67,12 @@ { "name": "electron-vue", "display": "Vue", - "templates": ["vue", "base/electron"] + "templates": ["base/vue", "base/electron"] }, { "name": "electron-react", "display": "React", - "templates": ["react", "base/electron"] + "templates": ["base/react", "base/electron"] } ] }, @@ -86,11 +86,13 @@ }, { "name": "vscode-vue", - "display": "Vue" + "display": "Vue", + "templates": ["base/style", "base/vue", "base/vscode"] }, { "name": "vscode-react", - "display": "React" + "display": "React", + "templates": ["base/style", "base/react", "base/vscode"] } ] } diff --git a/templates/node-cli-legacy/package.json b/templates/node-cli-legacy/package.json index b90b2bf..a006d6b 100644 --- a/templates/node-cli-legacy/package.json +++ b/templates/node-cli-legacy/package.json @@ -14,8 +14,7 @@ "scripts": { "dev": "tsup --watch", "start": "tsx ./src/index.ts", - "build": "tsup", - "test": "vitest" + "build": "tsup" }, "dependencies": { "@tomjs/logger": "^1.0.0", @@ -27,9 +26,6 @@ "ora": "^5.4.1" }, "devDependencies": { - "tsup": "^8.0.2", - "tsx": "^4.11.0", - "type-fest": "^4.18.3", - "vitest": "^1.6.0" + "tsup": "^8.1.0" } } diff --git a/templates/node-cli/package.json b/templates/node-cli/package.json index b0af97e..4b05800 100644 --- a/templates/node-cli/package.json +++ b/templates/node-cli/package.json @@ -18,8 +18,7 @@ "scripts": { "dev": "tsup --watch", "start": "tsx ./src/index.ts", - "build": "tsup", - "test": "vitest" + "build": "tsup" }, "dependencies": { "chalk": "^5.3.0", @@ -29,9 +28,6 @@ "ora": "^8.0.1" }, "devDependencies": { - "tsup": "^8.0.2", - "tsx": "^4.11.0", - "type-fest": "^4.18.3", - "vitest": "^1.6.0" + "tsup": "^8.1.0" } } diff --git a/templates/node-cli/test/index.test.ts b/templates/node-cli/test/index.test.ts deleted file mode 100644 index b095e48..0000000 --- a/templates/node-cli/test/index.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { describe, expect, it } from 'vitest'; - -describe('some test', () => { - it('1 + 1 = 2', () => { - expect(1 + 1).toBe(2); - }); -}); diff --git a/templates/node-vite-plugin/package.json b/templates/node-vite-plugin/package.json index 0ffc790..14d1127 100644 --- a/templates/node-vite-plugin/package.json +++ b/templates/node-vite-plugin/package.json @@ -6,16 +6,12 @@ ], "scripts": { "dev": "tsup --watch", - "build": "tsup", - "test": "vitest" + "build": "tsup" }, "dependencies": {}, "devDependencies": { - "tsup": "^8.0.2", - "tsx": "^4.11.0", - "type-fest": "^4.18.3", - "vite": "^5.2.12", - "vitest": "^1.6.0" + "tsup": "^8.1.0", + "vite": "^5.2.12" }, "peerDependencies": { "vite": ">=2" diff --git a/templates/node-workspaces/package.json b/templates/node-workspaces/package.json index a156e60..619720c 100644 --- a/templates/node-workspaces/package.json +++ b/templates/node-workspaces/package.json @@ -2,13 +2,9 @@ "private": true, "scripts": { "build": "pnpm -r --stream --filter=@tomjs/* build", - "test": "vitest", "lint:eslint": "eslint \"packages/**/*.ts\" *.{js,cjs,ts} --fix --cache" }, "devDependencies": { - "tsup": "^8.0.2", - "tsx": "^4.11.0", - "type-fest": "^4.18.3", - "vitest": "^1.6.0" + "tsup": "^8.1.0" } } diff --git a/templates/node/package.json b/templates/node/package.json index 1968b4e..82e2b91 100644 --- a/templates/node/package.json +++ b/templates/node/package.json @@ -3,14 +3,10 @@ "keywords": [], "scripts": { "dev": "tsup --watch", - "build": "tsup", - "test": "vitest" + "build": "tsup" }, "dependencies": {}, "devDependencies": { - "tsup": "^8.0.2", - "tsx": "^4.11.0", - "type-fest": "^4.18.3", - "vitest": "^1.6.0" + "tsup": "^8.1.0" } } diff --git a/templates/node/test/index.test.ts b/templates/node/test/index.test.ts deleted file mode 100644 index b095e48..0000000 --- a/templates/node/test/index.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { describe, expect, it } from 'vitest'; - -describe('some test', () => { - it('1 + 1 = 2', () => { - expect(1 + 1).toBe(2); - }); -}); diff --git a/templates/schema.json b/templates/schema.json index 8839e43..56f14d4 100644 --- a/templates/schema.json +++ b/templates/schema.json @@ -41,6 +41,7 @@ "base/react", "base/style", "base/vue", + "base/vscode", "react", "vue" ] diff --git a/templates/vscode-react/README.md b/templates/vscode-react/README.md new file mode 100644 index 0000000..ab46164 --- /dev/null +++ b/templates/vscode-react/README.md @@ -0,0 +1,3 @@ +# extension-webview + +vite + extension + react diff --git a/templates/vscode-react/index.html b/templates/vscode-react/index.html new file mode 100644 index 0000000..9d3a47a --- /dev/null +++ b/templates/vscode-react/index.html @@ -0,0 +1,14 @@ + + + + + + + Vite + VSCode Extension + React + + + +
+ + + diff --git a/templates/vscode-react/src/App.css b/templates/vscode-react/src/App.css new file mode 100644 index 0000000..726ee21 --- /dev/null +++ b/templates/vscode-react/src/App.css @@ -0,0 +1,7 @@ +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + height: 100%; +} diff --git a/templates/vscode-react/src/App.tsx b/templates/vscode-react/src/App.tsx new file mode 100644 index 0000000..c3f3d68 --- /dev/null +++ b/templates/vscode-react/src/App.tsx @@ -0,0 +1,51 @@ +import { VSCodeButton, VSCodeTextField } from '@vscode/webview-ui-toolkit/react'; +import { useState } from 'react'; +import { vscode } from './utils/vscode'; + +import './App.css'; + +function App() { + function onPostMessage() { + vscode.postMessage({ + command: 'hello', + text: 'Hey there partner! 🤠', + }); + } + + const [message, setMessage] = useState(''); + const [state, setState] = useState(''); + + const onSetState = () => { + vscode.setState(state); + }; + const onGetState = () => { + setState(vscode.getState() as string); + }; + + return ( +
+

Hello React!

+ Test VSCode Message +
+ setMessage(e.target.value)}> + Please enter a message + +
Message is: {message}
+
+
+ setState(e.target.value)}> + Please enter a state + +
State is: {state}
+
+ setState + + getState + +
+
+
+ ); +} + +export default App; diff --git a/templates/vscode-react/src/main.tsx b/templates/vscode-react/src/main.tsx new file mode 100644 index 0000000..1386bc7 --- /dev/null +++ b/templates/vscode-react/src/main.tsx @@ -0,0 +1,9 @@ +import React from 'react'; +import ReactDOM from 'react-dom/client'; +import App from './App.tsx'; + +ReactDOM.createRoot(document.getElementById('app')!).render( + + + , +); diff --git a/templates/vscode-react/src/utils/index.ts b/templates/vscode-react/src/utils/index.ts new file mode 100644 index 0000000..4b5f623 --- /dev/null +++ b/templates/vscode-react/src/utils/index.ts @@ -0,0 +1 @@ +export * from './vscode'; diff --git a/templates/vscode-react/src/utils/vscode.ts b/templates/vscode-react/src/utils/vscode.ts new file mode 100644 index 0000000..57a0cb6 --- /dev/null +++ b/templates/vscode-react/src/utils/vscode.ts @@ -0,0 +1,83 @@ +import type { WebviewApi } from 'vscode-webview'; + +/** + * A utility wrapper around the acquireVsCodeApi() function, which enables + * message passing and state management between the webview and extension + * contexts. + * + * This utility also enables webview code to be run in a web browser-based + * dev server by using native web browser features that mock the functionality + * enabled by acquireVsCodeApi. + */ +class VSCodeAPIWrapper { + private readonly vsCodeApi: WebviewApi | undefined; + + constructor() { + // Check if the acquireVsCodeApi function exists in the current development + // context (i.e. VS Code development window or web browser) + if (typeof acquireVsCodeApi === 'function') { + this.vsCodeApi = acquireVsCodeApi(); + } + } + + // private init() { + // // TODO 环境变量判断 + // } + + /** + * Post a message (i.e. send arbitrary data) to the owner of the webview. + * + * @remarks When running webview code inside a web browser, postMessage will instead + * log the given message to the console. + * + * @param message Abitrary data (must be JSON serializable) to send to the extension context. + */ + public postMessage(message: unknown) { + if (this.vsCodeApi) { + this.vsCodeApi.postMessage(message); + } else { + window.parent.postMessage({ type: 'page:message', data: message }, '*'); + console.log(message); + } + } + + /** + * Get the persistent state stored for this webview. + * + * @remarks When running webview source code inside a web browser, getState will retrieve state + * from local storage (https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). + * + * @return The current state or `undefined` if no state has been set. + */ + public getState(): unknown | undefined { + if (this.vsCodeApi) { + return this.vsCodeApi.getState(); + } else { + const state = localStorage.getItem('vscodeState'); + return state ? JSON.parse(state) : undefined; + } + } + + /** + * Set the persistent state stored for this webview. + * + * @remarks When running webview source code inside a web browser, setState will set the given + * state using local storage (https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). + * + * @param newState New persisted state. This must be a JSON serializable object. Can be retrieved + * using {@link getState}. + * + * @return The new state. + */ + public setState(newState: T): T { + if (this.vsCodeApi) { + return this.vsCodeApi.setState(newState); + } else { + localStorage.setItem('vscodeState', JSON.stringify(newState)); + return newState; + } + } +} + +// Exports class singleton to prevent multiple invocations of acquireVsCodeApi. +export const vscode = new VSCodeAPIWrapper(); diff --git a/templates/vscode-react/src/vite-env.d.ts b/templates/vscode-react/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/templates/vscode-react/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/templates/vscode-react/vite.config.ts b/templates/vscode-react/vite.config.ts new file mode 100644 index 0000000..e947b35 --- /dev/null +++ b/templates/vscode-react/vite.config.ts @@ -0,0 +1,20 @@ +import path from 'node:path'; +import vscode from '@tomjs/vite-plugin-vscode'; +import react from '@vitejs/plugin-react-swc'; +import { defineConfig } from 'vite'; +import pkg from './package.json'; + +// https://vitejs.dev/config/ +export default defineConfig(() => { + process.env.APP_BUILD_TIME = Date.now() + ''; + process.env.APP_VERSION = pkg.version; + + return { + resolve: { + alias: { + '@': path.join(__dirname, 'src'), + }, + }, + plugins: [react(), vscode()], + }; +}); diff --git a/templates/vscode-vue/README.md b/templates/vscode-vue/README.md new file mode 100644 index 0000000..61972da --- /dev/null +++ b/templates/vscode-vue/README.md @@ -0,0 +1,3 @@ +# extension-webview + +vite + extension + vue diff --git a/templates/vscode-vue/index.html b/templates/vscode-vue/index.html new file mode 100644 index 0000000..88716b5 --- /dev/null +++ b/templates/vscode-vue/index.html @@ -0,0 +1,14 @@ + + + + + + + Vite + VSCode Extension + Vue + + + +
+ + + diff --git a/templates/vscode-vue/package.json b/templates/vscode-vue/package.json index 0967ef4..f4eadbd 100644 --- a/templates/vscode-vue/package.json +++ b/templates/vscode-vue/package.json @@ -1 +1,6 @@ -{} +{ + "scripts": { + "build": "vscode-dev i18n && vue-tsc --noEmit && vite build", + "lint:eslint": "eslint \"{src,extension}/**/*.{js,cjs,ts,tsx,vue}\" *.{js,cjs,ts} --fix --cache" + } +} diff --git a/templates/vscode-vue/src/App.vue b/templates/vscode-vue/src/App.vue new file mode 100644 index 0000000..836f9bf --- /dev/null +++ b/templates/vscode-vue/src/App.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/templates/vscode-vue/src/main.ts b/templates/vscode-vue/src/main.ts new file mode 100644 index 0000000..684d042 --- /dev/null +++ b/templates/vscode-vue/src/main.ts @@ -0,0 +1,4 @@ +import { createApp } from 'vue'; +import App from './App.vue'; + +createApp(App).mount('#app'); diff --git a/templates/vscode-vue/src/utils/index.ts b/templates/vscode-vue/src/utils/index.ts new file mode 100644 index 0000000..4b5f623 --- /dev/null +++ b/templates/vscode-vue/src/utils/index.ts @@ -0,0 +1 @@ +export * from './vscode'; diff --git a/templates/vscode-vue/src/utils/vscode.ts b/templates/vscode-vue/src/utils/vscode.ts new file mode 100644 index 0000000..57a0cb6 --- /dev/null +++ b/templates/vscode-vue/src/utils/vscode.ts @@ -0,0 +1,83 @@ +import type { WebviewApi } from 'vscode-webview'; + +/** + * A utility wrapper around the acquireVsCodeApi() function, which enables + * message passing and state management between the webview and extension + * contexts. + * + * This utility also enables webview code to be run in a web browser-based + * dev server by using native web browser features that mock the functionality + * enabled by acquireVsCodeApi. + */ +class VSCodeAPIWrapper { + private readonly vsCodeApi: WebviewApi | undefined; + + constructor() { + // Check if the acquireVsCodeApi function exists in the current development + // context (i.e. VS Code development window or web browser) + if (typeof acquireVsCodeApi === 'function') { + this.vsCodeApi = acquireVsCodeApi(); + } + } + + // private init() { + // // TODO 环境变量判断 + // } + + /** + * Post a message (i.e. send arbitrary data) to the owner of the webview. + * + * @remarks When running webview code inside a web browser, postMessage will instead + * log the given message to the console. + * + * @param message Abitrary data (must be JSON serializable) to send to the extension context. + */ + public postMessage(message: unknown) { + if (this.vsCodeApi) { + this.vsCodeApi.postMessage(message); + } else { + window.parent.postMessage({ type: 'page:message', data: message }, '*'); + console.log(message); + } + } + + /** + * Get the persistent state stored for this webview. + * + * @remarks When running webview source code inside a web browser, getState will retrieve state + * from local storage (https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). + * + * @return The current state or `undefined` if no state has been set. + */ + public getState(): unknown | undefined { + if (this.vsCodeApi) { + return this.vsCodeApi.getState(); + } else { + const state = localStorage.getItem('vscodeState'); + return state ? JSON.parse(state) : undefined; + } + } + + /** + * Set the persistent state stored for this webview. + * + * @remarks When running webview source code inside a web browser, setState will set the given + * state using local storage (https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). + * + * @param newState New persisted state. This must be a JSON serializable object. Can be retrieved + * using {@link getState}. + * + * @return The new state. + */ + public setState(newState: T): T { + if (this.vsCodeApi) { + return this.vsCodeApi.setState(newState); + } else { + localStorage.setItem('vscodeState', JSON.stringify(newState)); + return newState; + } + } +} + +// Exports class singleton to prevent multiple invocations of acquireVsCodeApi. +export const vscode = new VSCodeAPIWrapper(); diff --git a/templates/vscode-vue/src/vite-env.d.ts b/templates/vscode-vue/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/templates/vscode-vue/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/templates/vscode-vue/vite.config.ts b/templates/vscode-vue/vite.config.ts new file mode 100644 index 0000000..8510be3 --- /dev/null +++ b/templates/vscode-vue/vite.config.ts @@ -0,0 +1,29 @@ +import path from 'node:path'; +import vscode from '@tomjs/vite-plugin-vscode'; +import vue from '@vitejs/plugin-vue'; +import { defineConfig } from 'vite'; +import pkg from './package.json'; + +// https://vitejs.dev/config/ +export default defineConfig(() => { + process.env.APP_BUILD_TIME = Date.now() + ''; + process.env.APP_VERSION = pkg.version; + + return { + resolve: { + alias: { + '@': path.join(__dirname, 'src'), + }, + }, + plugins: [ + vue({ + template: { + compilerOptions: { + isCustomElement: (tag: string) => tag.startsWith('vscode-'), + }, + }, + }), + vscode(), + ], + }; +}); diff --git a/templates/vscode/.vscode/extensions.json b/templates/vscode/.vscode/extensions.json new file mode 100644 index 0000000..f8e513b --- /dev/null +++ b/templates/vscode/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "lokalise.i18n-ally" + ] +} diff --git a/templates/vscode/.vscode/launch.json b/templates/vscode/.vscode/launch.json new file mode 100644 index 0000000..1348474 --- /dev/null +++ b/templates/vscode/.vscode/launch.json @@ -0,0 +1,21 @@ +// A launch configuration that compiles the extension and then opens it inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Extension", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ], + "outFiles": [ + "${workspaceFolder}/dist/*.js" + ], + "preLaunchTask": "${defaultBuildTask}" + } + ] +} diff --git a/templates/vscode/.vscode/settings.json b/templates/vscode/.vscode/settings.json new file mode 100644 index 0000000..f701d90 --- /dev/null +++ b/templates/vscode/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "i18n-ally.localesPaths": ["locales"] +} diff --git a/templates/vscode/.vscode/tasks.json b/templates/vscode/.vscode/tasks.json new file mode 100644 index 0000000..3bc2e39 --- /dev/null +++ b/templates/vscode/.vscode/tasks.json @@ -0,0 +1,36 @@ +// See https://go.microsoft.com/fwlink/?LinkId=733558 +// for the documentation about the tasks.json format +{ + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "dev", + "problemMatcher": { + "owner": "typescript", + "fileLocation": "relative", + "pattern": { + "regexp": "^([a-zA-Z]\\:\/?([\\w\\-]\/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$", + "file": 1, + "line": 3, + "column": 4, + "code": 5, + "message": 6 + }, + "background": { + "activeOnStart": true, + "beginsPattern": "^.*Build start*$", + "endsPattern": "^.*Build success.*$" + } + }, + "isBackground": true, + "presentation": { + "reveal": "never" + }, + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/templates/vscode/.vscodeignore b/templates/vscode/.vscodeignore new file mode 100644 index 0000000..efeb6d3 --- /dev/null +++ b/templates/vscode/.vscodeignore @@ -0,0 +1,72 @@ +# logs +*.log +lerna-debug.log* +logs +npm-debug.log* +pnpm-debug.log* +yarn-debug.log* +yarn-error.log* + +# diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# runtime data +*.pid +*.pid.lock +*.seed +pids + +# dependency directory +node_modules + +# cache +.cache +.npm +.tmp +.temp +.eslintcache +.stylelintcache +tsconfig.tsbuildinfo + +# environment +*.local + +# macOS +.DS_Store + +# package files +*.7z +*.gz +*.gzip +*.rar +*.tar +*.tar.* +*.tgz +*.zip +*.vsix + +# IDEA +.idea + +# vscode +.vscode +.history + +# project +src +locales + +.husky +.commitlintrc* +.editorconfig +.eslintrc* +.eslintignore +.gitattributes +.gitignore +.lintstagedrc* +.prettierrc* +.prettierignore +pnpm-lock.yaml +tsconfig.json +tsconfig.*.json +*.config.ts diff --git a/templates/vscode/LICENSE b/templates/vscode/LICENSE new file mode 100644 index 0000000..c2f5d0d --- /dev/null +++ b/templates/vscode/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023-PRESENT {{user.name}}<{{user.email}}> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/templates/vscode/README.md b/templates/vscode/README.md new file mode 100644 index 0000000..a222153 --- /dev/null +++ b/templates/vscode/README.md @@ -0,0 +1,3 @@ +# extension + +vscode extension diff --git a/templates/vscode/_gitignore b/templates/vscode/_gitignore new file mode 100644 index 0000000..e454cca --- /dev/null +++ b/templates/vscode/_gitignore @@ -0,0 +1,63 @@ +# logs +*.log +lerna-debug.log* +logs +npm-debug.log* +pnpm-debug.log* +yarn-debug.log* +yarn-error.log* + +# diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# runtime data +*.pid +*.pid.lock +*.seed +pids + +# dependency directory +bower_components +jspm_packages +node_modules +web_modules + +# cache +.cache +.npm +.tmp +.temp +.eslintcache +.stylelintcache +tsconfig.tsbuildinfo + +# environment +*.local + +# macOS +.DS_Store + +# package files +*.7z +*.gz +*.gzip +*.rar +*.tar +*.tar.* +*.tgz +*.zip +*.vsix + +# IDEA +.idea + +# vscode +.history + +# build output +build +dist +release + +package.nls.json +package.nls.*.json diff --git a/templates/vscode/locales/en.json b/templates/vscode/locales/en.json new file mode 100644 index 0000000..a6e8090 --- /dev/null +++ b/templates/vscode/locales/en.json @@ -0,0 +1,5 @@ +{ + "tomjs.commands.hello": "Show Hello", + "description": "This is a Tomjs Extension.", + "displayName": "Tomjs Extension" +} diff --git a/templates/vscode/locales/zh-CN.json b/templates/vscode/locales/zh-CN.json new file mode 100644 index 0000000..94d7d30 --- /dev/null +++ b/templates/vscode/locales/zh-CN.json @@ -0,0 +1,5 @@ +{ + "tomjs.commands.hello": "显示你好", + "description": "这是一个 Tomjs 扩展。", + "displayName": "Tomjs 扩展" +} diff --git a/templates/vscode/locales/zh-TW.json b/templates/vscode/locales/zh-TW.json new file mode 100644 index 0000000..fb98ef6 --- /dev/null +++ b/templates/vscode/locales/zh-TW.json @@ -0,0 +1,5 @@ +{ + "tomjs.commands.hello": "顯示你好", + "description": "這是一個 Tomjs 延伸模組。", + "displayName": "Tomjs 延伸模組" +} diff --git a/templates/vscode/package.json b/templates/vscode/package.json index 0967ef4..8aa2110 100644 --- a/templates/vscode/package.json +++ b/templates/vscode/package.json @@ -1 +1,57 @@ -{} +{ + "name": "vscode-extension", + "displayName": "%displayName%", + "description": "%description%", + "version": "0.0.0", + "publisher": "{{gitOrg}}", + "license": "MIT", + "engines": { + "node": ">=14", + "vscode": "^1.56.0" + }, + "main": "dist/index.js", + "keywords": [ + "vscode" + ], + "categories": [ + "Other" + ], + "activationEvents": [], + "contributes": { + "commands": [ + { + "command": "tomjs.xxx.showHello", + "title": "%tomjs.commands.hello%", + "category": "%displayName%" + } + ] + }, + "repository": { + "type": "git", + "url": "git+{{gitUrl}}.git" + }, + "bugs": { + "url": "git+{{gitUrl}}/issues" + }, + "homepage": "{{gitUrl}}/blob/main/README.md", + "icon": "resources/logo.png", + "vsce": { + "dependencies": false, + "yarn": false + }, + "scripts": { + "dev": "run-p dev:*", + "dev:i18n": "vscode-dev i18n --watch", + "dev:dist": "tsup --watch", + "build": "vscode-dev i18n && tsup --minify" + }, + "dependencies": { + "@tomjs/node": "^2.1.0", + "@tomjs/vscode": "^2.0.1" + }, + "devDependencies": { + "@tomjs/vscode-dev": "^1.2.3", + "@types/vscode": "^1.56.0", + "tsup": "^8.1.0" + } +} diff --git a/templates/vscode/resources/logo.png b/templates/vscode/resources/logo.png new file mode 100644 index 0000000..580b7b6 Binary files /dev/null and b/templates/vscode/resources/logo.png differ diff --git a/templates/vscode/src/index.ts b/templates/vscode/src/index.ts new file mode 100644 index 0000000..6039e40 --- /dev/null +++ b/templates/vscode/src/index.ts @@ -0,0 +1,15 @@ +import { i18n, initExtension } from '@tomjs/vscode'; +import type { ExtensionContext } from 'vscode'; +import { commands, window } from 'vscode'; + +export function activate(context: ExtensionContext) { + initExtension(context); + + context.subscriptions.push( + commands.registerCommand('tomjs.xxx.showHello', async () => { + window.showInformationMessage(i18n.t('tomjs.commands.hello')); + }), + ); +} + +export function deactivate() {} diff --git a/templates/vscode/tsconfig.json b/templates/vscode/tsconfig.json new file mode 100644 index 0000000..3acd04c --- /dev/null +++ b/templates/vscode/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "@tomjs/tsconfig/node.json", + "compilerOptions": {}, + "include": ["src", "package.json", "vite.config.ts"] +} diff --git a/templates/vscode/tsup.config.ts b/templates/vscode/tsup.config.ts new file mode 100644 index 0000000..779f679 --- /dev/null +++ b/templates/vscode/tsup.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig(options => { + return { + entry: ['src/index.ts'], + format: ['cjs'], + target: 'node14', + external: ['vscode'], + clean: true, + splitting: true, + sourcemap: !!options.watch, + }; +});