mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-07 12:57:47 +00:00
[redwood] Fix file permissions and add support for build script (#4999)
Some files require execution privileges, such as Prisma, so we must preserve the file mode. We also want redwood to behave the same as other frameworks and use `yarn build` if available.
This commit is contained in:
@@ -3,6 +3,7 @@ const { createHash } = require('crypto');
|
||||
const path = require('path');
|
||||
const _fetch = require('node-fetch');
|
||||
const fetch = require('./fetch-retry.js');
|
||||
const fileModeSymbol = Symbol('fileMode');
|
||||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
||||
|
||||
async function nowDeploy(bodies, randomness, uploadNowJson) {
|
||||
@@ -14,7 +15,9 @@ async function nowDeploy(bodies, randomness, uploadNowJson) {
|
||||
sha: digestOfFile(bodies[n]),
|
||||
size: bodies[n].length,
|
||||
file: n,
|
||||
mode: path.extname(n) === '.sh' ? 0o100755 : 0o100644,
|
||||
mode:
|
||||
bodies[n][fileModeSymbol] ||
|
||||
(path.extname(n) === '.sh' ? 0o100755 : 0o100644),
|
||||
}));
|
||||
|
||||
const { FORCE_BUILD_IN_REGION, NOW_DEBUG, VERCEL_DEBUG } = process.env;
|
||||
@@ -80,9 +83,7 @@ async function nowDeploy(bodies, randomness, uploadNowJson) {
|
||||
}
|
||||
|
||||
function digestOfFile(body) {
|
||||
return createHash('sha1')
|
||||
.update(body)
|
||||
.digest('hex');
|
||||
return createHash('sha1').update(body).digest('hex');
|
||||
}
|
||||
|
||||
async function filePost(body, digest) {
|
||||
@@ -247,4 +248,5 @@ module.exports = {
|
||||
fetchWithAuth,
|
||||
nowDeploy,
|
||||
fetchTokenWithRetry,
|
||||
fileModeSymbol,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user