mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
build: use typescript for internal Electron JS code (#16441)
This commit is contained in:
22
script/gen-filenames.js
Normal file
22
script/gen-filenames.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const gniPath = path.resolve(__dirname, '../filenames.auto.gni')
|
||||
|
||||
const allDocs = fs.readdirSync(path.resolve(__dirname, '../docs/api'))
|
||||
.map(doc => `docs/api/${doc}`)
|
||||
.concat(
|
||||
fs.readdirSync(path.resolve(__dirname, '../docs/api/structures'))
|
||||
.map(doc => `docs/api/structures/${doc}`)
|
||||
)
|
||||
|
||||
fs.writeFileSync(
|
||||
gniPath,
|
||||
`# THIS FILE IS AUTO-GENERATED, PLEASE DO NOT EDIT BY HAND
|
||||
auto_filenames = {
|
||||
api_docs = [
|
||||
${allDocs.map(doc => ` "${doc}",`).join('\n')}
|
||||
]
|
||||
}
|
||||
`
|
||||
)
|
||||
@@ -75,10 +75,10 @@ const LINTERS = [ {
|
||||
key: 'javascript',
|
||||
roots: ['lib', 'spec', 'script', 'default_app'],
|
||||
ignoreRoots: ['spec/node_modules'],
|
||||
test: filename => filename.endsWith('.js'),
|
||||
test: filename => filename.endsWith('.js') || filename.endsWith('.ts'),
|
||||
run: (opts, filenames) => {
|
||||
const cmd = path.join(SOURCE_ROOT, 'node_modules', '.bin', 'eslint')
|
||||
const args = [ '--cache', ...filenames ]
|
||||
const args = [ '--cache', '--ext', '.js,.ts', ...filenames ]
|
||||
if (opts.fix) args.unshift('--fix')
|
||||
spawnAndCheckExitCode(cmd, args, { cwd: SOURCE_ROOT })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user