chore: use hereby instead of internal job (#11132)

This commit is contained in:
jrandolf 2023-10-11 17:54:26 +02:00 committed by GitHub
parent e45f20b52a
commit 7a38586d9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 430 additions and 118 deletions

352
package-lock.json generated
View File

@ -2867,6 +2867,15 @@
"sprintf-js": "~1.0.2" "sprintf-js": "~1.0.2"
} }
}, },
"node_modules/array-back": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz",
"integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/array-buffer-byte-length": { "node_modules/array-buffer-byte-length": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz",
@ -3519,6 +3528,92 @@
"node": ">=0.1.90" "node": ">=0.1.90"
} }
}, },
"node_modules/command-line-usage": {
"version": "6.1.3",
"resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.3.tgz",
"integrity": "sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==",
"dev": true,
"dependencies": {
"array-back": "^4.0.2",
"chalk": "^2.4.2",
"table-layout": "^1.0.2",
"typical": "^5.2.0"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/command-line-usage/node_modules/ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"dependencies": {
"color-convert": "^1.9.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/command-line-usage/node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"dependencies": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/command-line-usage/node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"dependencies": {
"color-name": "1.1.3"
}
},
"node_modules/command-line-usage/node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"dev": true
},
"node_modules/command-line-usage/node_modules/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
"dev": true,
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/command-line-usage/node_modules/has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/command-line-usage/node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"dependencies": {
"has-flag": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/commander": { "node_modules/commander": {
"version": "2.20.3", "version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
@ -3731,6 +3826,15 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/deep-extend": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
"dev": true,
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/deep-is": { "node_modules/deep-is": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
@ -5004,6 +5108,15 @@
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
"dev": true "dev": true
}, },
"node_modules/fastest-levenshtein": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz",
"integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==",
"dev": true,
"engines": {
"node": ">= 4.9.1"
}
},
"node_modules/fastq": { "node_modules/fastq": {
"version": "1.15.0", "version": "1.15.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz",
@ -5925,6 +6038,26 @@
"he": "bin/he" "he": "bin/he"
} }
}, },
"node_modules/hereby": {
"version": "1.8.7",
"resolved": "https://registry.npmjs.org/hereby/-/hereby-1.8.7.tgz",
"integrity": "sha512-n8QoMe1eSZig8S/kCjJ6zVNjH65QgSoZvwL70fliHKgt9nInICC1inH0qWW9EyUq0XFW1Vz+vNG40iG2laLLvg==",
"dev": true,
"dependencies": {
"command-line-usage": "^6.1.3",
"fastest-levenshtein": "^1.0.16",
"import-meta-resolve": "^2.2.2",
"minimist": "^1.2.8",
"picocolors": "^1.0.0",
"pretty-ms": "^8.0.0"
},
"bin": {
"hereby": "bin/hereby.js"
},
"engines": {
"node": ">= 12.20"
}
},
"node_modules/hosted-git-info": { "node_modules/hosted-git-info": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz",
@ -6094,6 +6227,16 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/import-meta-resolve": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-2.2.2.tgz",
"integrity": "sha512-f8KcQ1D80V7RnqVm+/lirO9zkOxjGxhaTC1IPrBGd3MEfNgmNG67tSUO9gTi2F3Blr2Az6g1vocaxzkVnWl9MA==",
"dev": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/imurmurhash": { "node_modules/imurmurhash": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
@ -8737,6 +8880,18 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/parse-ms": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-3.0.0.tgz",
"integrity": "sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==",
"dev": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/parsel-js": { "node_modules/parsel-js": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/parsel-js/-/parsel-js-1.1.2.tgz", "resolved": "https://registry.npmjs.org/parsel-js/-/parsel-js-1.1.2.tgz",
@ -9059,6 +9214,21 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1" "url": "https://github.com/chalk/ansi-styles?sponsor=1"
} }
}, },
"node_modules/pretty-ms": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz",
"integrity": "sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==",
"dev": true,
"dependencies": {
"parse-ms": "^3.0.0"
},
"engines": {
"node": ">=14.16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/proc-log": { "node_modules/proc-log": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-3.0.0.tgz", "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-3.0.0.tgz",
@ -9630,6 +9800,15 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/reduce-flatten": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz",
"integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==",
"dev": true,
"engines": {
"node": ">=6"
}
},
"node_modules/regexp.prototype.flags": { "node_modules/regexp.prototype.flags": {
"version": "1.5.1", "version": "1.5.1",
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz",
@ -10480,6 +10659,21 @@
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
"dev": true "dev": true
}, },
"node_modules/table-layout": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz",
"integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==",
"dev": true,
"dependencies": {
"array-back": "^4.0.1",
"deep-extend": "~0.6.0",
"typical": "^5.2.0",
"wordwrapjs": "^4.0.0"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/tapable": { "node_modules/tapable": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
@ -11316,6 +11510,15 @@
"node": ">=14.17" "node": ">=14.17"
} }
}, },
"node_modules/typical": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz",
"integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/unbox-primitive": { "node_modules/unbox-primitive": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
@ -11576,6 +11779,19 @@
"node": ">=14.14.0" "node": ">=14.14.0"
} }
}, },
"node_modules/wordwrapjs": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz",
"integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==",
"dev": true,
"dependencies": {
"reduce-flatten": "^2.0.0",
"typical": "^5.2.0"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/workerpool": { "node_modules/workerpool": {
"version": "6.2.1", "version": "6.2.1",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
@ -11937,6 +12153,8 @@
}, },
"devDependencies": { "devDependencies": {
"@types/node": "18.17.15", "@types/node": "18.17.15",
"execa": "8.0.1",
"hereby": "1.8.7",
"mitt": "3.0.1", "mitt": "3.0.1",
"parsel-js": "1.1.2", "parsel-js": "1.1.2",
"rxjs": "7.8.1" "rxjs": "7.8.1"
@ -11950,6 +12168,116 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"packages/puppeteer-core/node_modules/execa": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz",
"integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==",
"dev": true,
"dependencies": {
"cross-spawn": "^7.0.3",
"get-stream": "^8.0.1",
"human-signals": "^5.0.0",
"is-stream": "^3.0.0",
"merge-stream": "^2.0.0",
"npm-run-path": "^5.1.0",
"onetime": "^6.0.0",
"signal-exit": "^4.1.0",
"strip-final-newline": "^3.0.0"
},
"engines": {
"node": ">=16.17"
},
"funding": {
"url": "https://github.com/sindresorhus/execa?sponsor=1"
}
},
"packages/puppeteer-core/node_modules/get-stream": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz",
"integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==",
"dev": true,
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"packages/puppeteer-core/node_modules/human-signals": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz",
"integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==",
"dev": true,
"engines": {
"node": ">=16.17.0"
}
},
"packages/puppeteer-core/node_modules/is-stream": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
"integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==",
"dev": true,
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"packages/puppeteer-core/node_modules/mimic-fn": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
"integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
"dev": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"packages/puppeteer-core/node_modules/npm-run-path": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
"integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
"dev": true,
"dependencies": {
"path-key": "^4.0.0"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"packages/puppeteer-core/node_modules/onetime": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
"integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
"dev": true,
"dependencies": {
"mimic-fn": "^4.0.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"packages/puppeteer-core/node_modules/path-key": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
"integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
"dev": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"packages/puppeteer-core/node_modules/rxjs": { "packages/puppeteer-core/node_modules/rxjs": {
"version": "7.8.1", "version": "7.8.1",
"dev": true, "dev": true,
@ -11958,6 +12286,30 @@
"tslib": "^2.1.0" "tslib": "^2.1.0"
} }
}, },
"packages/puppeteer-core/node_modules/signal-exit": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"dev": true,
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"packages/puppeteer-core/node_modules/strip-final-newline": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
"integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==",
"dev": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"packages/puppeteer-core/node_modules/tslib": { "packages/puppeteer-core/node_modules/tslib": {
"version": "2.6.2", "version": "2.6.2",
"dev": true, "dev": true,

View File

@ -0,0 +1,68 @@
import {mkdir, readFile, writeFile} from 'fs/promises';
import esbuild from 'esbuild';
import {execa} from 'execa';
import {task} from 'hereby';
export const generateVersionTask = task({
name: 'generate:version',
run: async () => {
const {version} = JSON.parse(await readFile('package.json', 'utf8'));
await mkdir('src/generated', {recursive: true});
await writeFile(
'src/generated/version.ts',
(await readFile('src/templates/version.ts.tmpl', 'utf8')).replace(
'PACKAGE_VERSION',
version
)
);
if (process.env['PUBLISH']) {
await writeFile(
'../../versions.js',
(
await readFile('../../versions.js', {
encoding: 'utf-8',
})
).replace("'NEXT'", `'v${version}'`)
);
}
},
});
export const generateInjectedTask = task({
name: 'generate:injected',
run: async () => {
const {
outputFiles: [{text}],
} = await esbuild.build({
entryPoints: ['src/injected/injected.ts'],
bundle: true,
format: 'cjs',
platform: 'browser',
target: 'ES2022',
minify: true,
write: false,
});
const template = await readFile('src/templates/injected.ts.tmpl', 'utf8');
await mkdir('src/generated', {recursive: true});
await writeFile(
'src/generated/injected.ts',
template.replace('SOURCE_CODE', JSON.stringify(text))
);
},
});
export const generateTask = task({
name: 'generate',
dependencies: [generateVersionTask, generateInjectedTask],
});
export const buildTscTask = task({
name: 'build:tsc',
dependencies: [generateTask],
run: async () => {
await execa('tsc', ['-b']);
await execa('rollup', ['-c', 'rollup.third_party.config.mjs']);
await writeFile('lib/esm/package.json', JSON.stringify({type: 'module'}));
},
});

View File

@ -57,27 +57,6 @@
"build:types" "build:types"
] ]
}, },
"generate:sources": {
"command": "tsx tools/generate_sources.ts",
"clean": "if-file-deleted",
"files": [
"../../versions.js",
"src/{injected,templates}/**",
"tools/generate_sources.ts"
],
"output": [
"src/generated/*.ts"
]
},
"generate:package-json": {
"command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json",
"files": [
"../../tools/generate_module_package_json.ts"
],
"output": [
"lib/esm/package.json"
]
},
"build:docs": { "build:docs": {
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"", "command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
"files": [ "files": [
@ -90,20 +69,19 @@
] ]
}, },
"build:tsc": { "build:tsc": {
"command": "tsc -b && rollup --config rollup.third_party.config.mjs", "command": "hereby build:tsc",
"clean": "if-file-deleted", "clean": "if-file-deleted",
"dependencies": [ "dependencies": [
"generate:package-json",
"generate:sources",
"../browsers:build" "../browsers:build"
], ],
"files": [ "files": [
"{compat,src,third_party}/**", "rollup.third_party.config.mjs",
"rollup.third_party.config.mjs" "{src,third_party}/**",
"../../versions.js",
"!src/generated"
], ],
"output": [ "output": [
"lib/{cjs,esm}/**", "lib/{cjs,esm}/**"
"!lib/esm/package.json"
] ]
}, },
"build:types": { "build:types": {
@ -148,9 +126,11 @@
"ws": "8.14.2" "ws": "8.14.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "18.17.15",
"execa": "8.0.1",
"hereby": "1.8.7",
"mitt": "3.0.1", "mitt": "3.0.1",
"parsel-js": "1.1.2", "parsel-js": "1.1.2",
"rxjs": "7.8.1", "rxjs": "7.8.1"
"@types/node": "18.17.15"
} }
} }

View File

@ -1,88 +0,0 @@
#!/usr/bin/env node
import {mkdir, mkdtemp, readFile, rm, writeFile} from 'fs/promises';
import path, {join, resolve} from 'path';
import {chdir} from 'process';
import esbuild from 'esbuild';
import {job} from '../../../tools/internal/job.js';
const packageRoot = resolve(join(__dirname, '..'));
chdir(packageRoot);
(async () => {
await job('', async ({outputs}) => {
await Promise.all(
outputs.map(outputs => {
return mkdir(outputs, {recursive: true});
})
);
})
.outputs(['src/generated'])
.build();
const versionJob = job('', async ({inputs, outputs}) => {
const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version;
await writeFile(
outputs[0]!,
(await readFile(inputs[1]!, 'utf8')).replace('PACKAGE_VERSION', version)
);
})
.inputs(['package.json', 'src/templates/version.ts.tmpl'])
.outputs(['src/generated/version.ts'])
.build();
const injectedJob = job('', async ({name, inputs, outputs}) => {
const input = inputs.find(input => {
return input.endsWith('injected.ts');
})!;
const template = await readFile(
inputs.find(input => {
return input.includes('injected.ts.tmpl');
})!,
'utf8'
);
const tmp = await mkdtemp(name);
await esbuild.build({
entryPoints: [input],
bundle: true,
outdir: tmp,
format: 'cjs',
platform: 'browser',
target: 'ES2022',
minify: true,
});
const baseName = path.basename(input);
const content = await readFile(
path.join(tmp, baseName.replace('.ts', '.js')),
'utf-8'
);
const scriptContent = template.replace(
'SOURCE_CODE',
JSON.stringify(content)
);
await writeFile(outputs[0]!, scriptContent);
await rm(tmp, {recursive: true, force: true});
})
.inputs(['src/templates/injected.ts.tmpl', 'src/injected/**/*.ts'])
.outputs(['src/generated/injected.ts'])
.build();
await Promise.all([versionJob, injectedJob]);
if (process.env['PUBLISH']) {
await job('', async ({inputs}) => {
const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version;
await writeFile(
inputs[1]!,
(
await readFile(inputs[1]!, {
encoding: 'utf-8',
})
).replace("'NEXT'", `'v${version}'`)
);
})
.inputs(['package.json', '../../versions.js'])
.build();
}
})();