Просмотр исходного кода

chore: use consistent ts-check comments in scripts

Evan You 3 лет назад
Родитель
Сommit
a871fd0cc0
6 измененных файлов с 9 добавлено и 6 удалено
  1. 2 2
      scripts/build.js
  2. 2 1
      scripts/dev.js
  3. 1 0
      scripts/pre-dev-sfc.js
  4. 1 0
      scripts/preinstall.js
  5. 1 0
      scripts/utils.js
  6. 2 3
      scripts/verifyCommit.js

+ 2 - 2
scripts/build.js

@@ -1,3 +1,5 @@
+// @ts-check
+
 /*
 Produces production builds and stitches together d.ts files.
 
@@ -14,11 +16,9 @@ nr build core --formats cjs
 ```
 */
 
-// @ts-check
 import fs from 'node:fs/promises'
 import { existsSync, readFileSync } from 'node:fs'
 import path from 'node:path'
-import { fileURLToPath } from 'node:url'
 import minimist from 'minimist'
 import { gzipSync } from 'node:zlib'
 import { compress } from 'brotli'

+ 2 - 1
scripts/dev.js

@@ -1,8 +1,9 @@
+// @ts-check
+
 // Using esbuild for faster dev builds.
 // We are still using Rollup for production builds because it generates
 // smaller files w/ better tree-shaking.
 
-// @ts-check
 import esbuild from 'esbuild'
 import { resolve, relative, dirname } from 'node:path'
 import { fileURLToPath } from 'node:url'

+ 1 - 0
scripts/pre-dev-sfc.js

@@ -1,3 +1,4 @@
+// @ts-check
 import fs from 'node:fs'
 
 const packagesToCheck = [

+ 1 - 0
scripts/preinstall.js

@@ -1,3 +1,4 @@
+// @ts-check
 if (!/pnpm/.test(process.env.npm_execpath || '')) {
   console.warn(
     `\u001b[33mThis repository requires using pnpm as the package manager ` +

+ 1 - 0
scripts/utils.js

@@ -1,3 +1,4 @@
+// @ts-check
 import fs from 'node:fs'
 import chalk from 'chalk'
 import { createRequire } from 'node:module'

+ 2 - 3
scripts/verifyCommit.js

@@ -1,10 +1,9 @@
+// @ts-check
 import chalk from 'chalk'
 import { readFileSync } from 'fs'
 import path from 'path'
-import { fileURLToPath } from 'url'
 
-const dirname = path.dirname(fileURLToPath(import.meta.url), '..')
-const msgPath = path.resolve(dirname, '../.git/COMMIT_EDITMSG')
+const msgPath = path.resolve('.git/COMMIT_EDITMSG')
 const msg = readFileSync(msgPath, 'utf-8').trim()
 
 const commitRE =