build: auto generate electron.d.ts in the spec runner if it is missing

This commit is contained in:
Samuel Attard 2019-03-10 16:24:27 -07:00
Родитель ca701bb9af
Коммит 3656d12cba
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 191FEF027779CC6C
3 изменённых файлов: 26 добавлений и 11 удалений

Просмотреть файл

@ -33,9 +33,24 @@ async function main () {
await getSpecHash().then(saveSpecHash)
}
if (!fs.existsSync(path.resolve(__dirname, '../electron.d.ts'))) {
console.log('Generating electron.d.ts as it is missing')
generateTypeDefinitions()
}
await runElectronTests()
}
function generateTypeDefinitions () {
const { status } = childProcess.spawnSync('npm', ['run', 'create-typescript-definitions'], {
cwd: path.resolve(__dirname, '..'),
stdio: 'inherit'
})
if (status !== 0) {
throw new Error(`Electron typescript definition generation failed with exit code: ${status}.`)
}
}
function loadLastSpecHash () {
return fs.existsSync(specHashPath)
? fs.readFileSync(specHashPath, 'utf8').split('\n')

20
spec/package-lock.json сгенерированный
Просмотреть файл

@ -5,9 +5,9 @@
"requires": true,
"dependencies": {
"abstract-socket": {
"version": "github:nornagon/node-abstractsocket#7d9c770f9ffef14373349034f8820ff059879845",
"from": "github:nornagon/node-abstractsocket#v8-compat",
"dev": true,
"version": "2.0.0",
"resolved": "github:nornagon/node-abstractsocket#7d9c770f9ffef14373349034f8820ff059879845",
"optional": true,
"requires": {
"bindings": "^1.2.1",
"nan": "^2.0.9"
@ -65,14 +65,14 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.4.0.tgz",
"integrity": "sha512-7znEVX22Djn+nYjxCWKDne0RRloa9XfYa84yk3s+HkE3LpDYZmhArYr9O9huBoHY3/oXispx5LorIX7Sl2CgSQ==",
"dev": true,
"optional": true,
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"bl": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
"resolved": "http://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
"integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==",
"optional": true,
"requires": {
@ -468,7 +468,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"dev": true
"optional": true
},
"find-up": {
"version": "3.0.0",
@ -785,7 +785,7 @@
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
"mkdirp": {
@ -984,7 +984,7 @@
},
"os-homedir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"optional": true
},
@ -1156,7 +1156,7 @@
},
"readable-stream": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"requires": {
"core-util-is": "~1.0.0",
@ -1365,7 +1365,7 @@
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"

Просмотреть файл

@ -7,7 +7,6 @@
"postinstall": "node ../tools/run-if-exists.js node_modules/robotjs node-gyp rebuild"
},
"devDependencies": {
"abstract-socket": "github:nornagon/node-abstractsocket#v8-compat",
"basic-auth": "^2.0.1",
"bluebird": "^3.5.3",
"chai": "^4.2.0",
@ -33,6 +32,7 @@
"yargs": "^12.0.5"
},
"optionalDependencies": {
"abstract-socket": "github:nornagon/node-abstractsocket#v8-compat",
"robotjs": "github:nornagon/robotjs#node-12"
}
}