mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 04:22:01 +00:00
fix deploy from local (#9969)
Local deployments of this repo would fail because this repo assumes that it's only ever deployed via git connection.
This commit is contained in:
@@ -48,11 +48,13 @@ async function main() {
|
||||
fs.remove(join(outDir, 'serverless-functions/serverless-handler.d.mts')),
|
||||
]);
|
||||
|
||||
// Copy type file for ts test
|
||||
await fs.copyFile(
|
||||
join(outDir, 'index.d.ts'),
|
||||
join(__dirname, 'test/fixtures/15-helpers/ts/types.d.ts')
|
||||
);
|
||||
if (process.env.CI) {
|
||||
// Copy type file for ts test
|
||||
await fs.copyFile(
|
||||
join(outDir, 'index.d.ts'),
|
||||
join(__dirname, 'test/fixtures/15-helpers/ts/types.d.ts')
|
||||
);
|
||||
}
|
||||
|
||||
await fs.copyFile(
|
||||
join(__dirname, 'src/edge-functions/edge-handler-template.js'),
|
||||
|
||||
19
utils/pack.ts
vendored
19
utils/pack.ts
vendored
@@ -6,9 +6,8 @@ import { TurboDryRun } from './types';
|
||||
const rootDir = path.join(__dirname, '..');
|
||||
|
||||
async function main() {
|
||||
const { stdout: sha } = await execa('git', ['rev-parse', '--short', 'HEAD'], {
|
||||
cwd: rootDir,
|
||||
});
|
||||
const sha = await getSha();
|
||||
|
||||
const { stdout: turboStdout } = await execa(
|
||||
'turbo',
|
||||
['run', 'build', '--dry=json'],
|
||||
@@ -50,6 +49,20 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
async function getSha(): Promise<string> {
|
||||
try {
|
||||
const { stdout } = await execa('git', ['rev-parse', '--short', 'HEAD'], {
|
||||
cwd: rootDir,
|
||||
});
|
||||
return stdout;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
console.log('Assuming this is not a git repo. Using "local" as the SHA.');
|
||||
return 'local';
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.log('error running pack:', err);
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user