-
Notifications
You must be signed in to change notification settings - Fork 15
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
112 additions
and
169 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
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
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,49 @@ | ||
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 "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 subprocess = (0,external_node_child_process_namespaceObject.spawn)('node', [(0,external_node_path_namespaceObject.resolve)(process.cwd(), 'dist/server/index.cjs')], {env: process.env, stdio: 'pipe'}); | ||
|
||
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.