-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
127 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2783,14 +2783,6 @@ var __webpack_exports__ = {}; | |
|
||
// EXTERNAL MODULE: ./node_modules/.pnpm/@[email protected]/node_modules/@actions/core/lib/core.js | ||
var core = __nccwpck_require__(93); | ||
;// CONCATENATED MODULE: ./src/indentMultiline.js | ||
const indentMultiline = (message, spaces = 2) => { | ||
const output = []; | ||
message.split('\n').forEach((line) => { | ||
output.push(' '.repeat(spaces) + line); | ||
}); | ||
return output.join('\n'); | ||
}; | ||
;// CONCATENATED MODULE: external "node:fs" | ||
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs"); | ||
;// CONCATENATED MODULE: external "node:fs/promises" | ||
|
@@ -2824,7 +2816,6 @@ const readLog = async (name) => { | |
|
||
|
||
|
||
|
||
function pidIsRunning(pid) { | ||
try { | ||
process.kill(pid, 0); | ||
|
@@ -2834,6 +2825,14 @@ function pidIsRunning(pid) { | |
} | ||
} | ||
|
||
function indentMultiline(message, spaces = 2) { | ||
const output = []; | ||
message.split('\n').forEach((line) => { | ||
output.push(' '.repeat(spaces) + line); | ||
}); | ||
return output.join('\n'); | ||
} | ||
|
||
async function post() { | ||
const pid = parseInt((0,core.getState)('pid')); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6042,14 +6042,8 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq | |
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path"); | ||
// EXTERNAL MODULE: ./node_modules/.pnpm/[email protected]/node_modules/tcp-port-used/index.js | ||
var tcp_port_used = __nccwpck_require__(8351); | ||
;// CONCATENATED MODULE: ./src/indentMultiline.js | ||
const indentMultiline = (message, spaces = 2) => { | ||
const output = []; | ||
message.split('\n').forEach((line) => { | ||
output.push(' '.repeat(spaces) + line); | ||
}); | ||
return output.join('\n'); | ||
}; | ||
;// CONCATENATED MODULE: external "url" | ||
const external_url_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("url"); | ||
// EXTERNAL MODULE: external "crypto" | ||
var external_crypto_ = __nccwpck_require__(6113); | ||
;// CONCATENATED MODULE: ./src/inputs.js | ||
|
@@ -6069,33 +6063,6 @@ const token = (0,external_crypto_.randomBytes)(24).toString('hex'); | |
const host = (0,core.getInput)('host', { trimWhitespace: true }); | ||
const port = parseInt((0,core.getInput)('port', { trimWhitespace: true })); | ||
|
||
;// CONCATENATED MODULE: external "node:fs" | ||
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs"); | ||
;// CONCATENATED MODULE: external "node:fs/promises" | ||
const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises"); | ||
// EXTERNAL MODULE: external "os" | ||
var external_os_ = __nccwpck_require__(2037); | ||
;// CONCATENATED MODULE: ./src/logs.js | ||
|
||
|
||
|
||
|
||
|
||
const logDir = external_node_path_namespaceObject.resolve(external_os_.tmpdir(), 'turborepo-remote-cache-gh-action'); | ||
|
||
if (!external_node_fs_namespaceObject.existsSync(logDir)) { | ||
external_node_fs_namespaceObject.mkdirSync(logDir, { recursive: true }); | ||
} | ||
|
||
const logFile = (name) => external_node_path_namespaceObject.resolve(logDir, name); | ||
|
||
const readLog = async (name) => { | ||
try { | ||
return await promises_namespaceObject.readFile(logFile(name), 'utf8'); | ||
} catch (e) { | ||
return ''; | ||
} | ||
}; | ||
;// CONCATENATED MODULE: ./src/start.js | ||
|
||
|
||
|
@@ -6105,6 +6072,7 @@ const readLog = async (name) => { | |
|
||
|
||
|
||
const start_dirname = (0,external_node_path_namespaceObject.dirname)((0,external_url_namespaceObject.fileURLToPath)(import.meta.url)); | ||
|
||
async function getPort() { | ||
if (port) { | ||
|
@@ -6125,7 +6093,7 @@ async function main() { | |
(0,core.debug)('Starting Turbo Cache Server...'); | ||
const subprocess = (0,external_node_child_process_namespaceObject.spawn)( | ||
'node', | ||
[(0,external_node_path_namespaceObject.resolve)(process.cwd(), 'dist/server/index.cjs')], | ||
[(0,external_node_path_namespaceObject.resolve)(start_dirname, '..', 'start_and_log')], | ||
{ | ||
detached: true, | ||
stdio: 'ignore', | ||
|
@@ -6156,9 +6124,7 @@ async function main() { | |
(0,core.exportVariable)('TURBO_TOKEN', token); | ||
(0,core.exportVariable)('TURBO_TEAM', teamId); | ||
} catch (e) { | ||
const errors = await readLog('err'); | ||
const errorMessage = errors ? `\nErrors: ${indentMultiline(errors)}` : ''; | ||
throw new Error(`Turbo server failed to start on port: ${port}${errorMessage}`); | ||
throw new Error(`Turbo server failed to start on port: ${port}`); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module"; | ||
/******/ /* webpack/runtime/compat */ | ||
/******/ | ||
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1) + "/"; | ||
/******/ | ||
/************************************************************************/ | ||
var __webpack_exports__ = {}; | ||
|
||
;// CONCATENATED MODULE: external "node:child_process" | ||
const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process"); | ||
;// CONCATENATED MODULE: external "node:fs" | ||
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs"); | ||
;// CONCATENATED MODULE: external "node:path" | ||
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path"); | ||
;// CONCATENATED MODULE: external "url" | ||
const external_url_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("url"); | ||
;// CONCATENATED MODULE: external "node:fs/promises" | ||
const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises"); | ||
;// CONCATENATED MODULE: external "os" | ||
const external_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("os"); | ||
;// CONCATENATED MODULE: ./src/logs.js | ||
|
||
|
||
|
||
|
||
|
||
const logDir = external_node_path_namespaceObject.resolve(external_os_namespaceObject.tmpdir(), 'turborepo-remote-cache-gh-action'); | ||
|
||
if (!external_node_fs_namespaceObject.existsSync(logDir)) { | ||
external_node_fs_namespaceObject.mkdirSync(logDir, { recursive: true }); | ||
} | ||
|
||
const logFile = (name) => external_node_path_namespaceObject.resolve(logDir, name); | ||
|
||
const readLog = async (name) => { | ||
try { | ||
return await fsPromises.readFile(logFile(name), 'utf8'); | ||
} catch (e) { | ||
return ''; | ||
} | ||
}; | ||
;// CONCATENATED MODULE: ./src/start_and_log.js | ||
|
||
|
||
|
||
|
||
|
||
|
||
const start_and_log_dirname = (0,external_node_path_namespaceObject.dirname)((0,external_url_namespaceObject.fileURLToPath)(import.meta.url)); | ||
|
||
const subprocess = (0,external_node_child_process_namespaceObject.spawn)('node', [(0,external_node_path_namespaceObject.resolve)(start_and_log_dirname, '..', 'server', 'index.cjs')]); | ||
|
||
subprocess.stdout.pipe((0,external_node_fs_namespaceObject.createWriteStream)(logFile('out'))); | ||
subprocess.stderr.pipe((0,external_node_fs_namespaceObject.createWriteStream)(logFile('err'))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,10 @@ | ||
const fs = require('node:fs'); | ||
const { logFile } = require('./logs.js'); | ||
const { createApp } = require('turborepo-remote-cache'); | ||
|
||
const handleError = (err) => { | ||
fs.writeFileSync(logFile('err'), err.message); | ||
process.exit(1); | ||
}; | ||
const app = createApp({trustProxy: true}); | ||
|
||
try { | ||
const { createApp } = require('turborepo-remote-cache'); | ||
|
||
const app = createApp({ | ||
trustProxy: true, | ||
logger: { | ||
level: 'debug', | ||
stream: fs.createWriteStream(logFile('out')), | ||
}, | ||
}); | ||
|
||
app.listen({ host: process.env.HOST, port: process.env.PORT }, (err) => { | ||
if (err) { | ||
handleError(err); | ||
} | ||
}); | ||
} catch (err) { | ||
handleError(err); | ||
} | ||
app.listen({ host: process.env.HOST, port: process.env.PORT }, (err) => { | ||
if (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
}); |
Oops, something went wrong.