mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 12:57:46 +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')),
|
fs.remove(join(outDir, 'serverless-functions/serverless-handler.d.mts')),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Copy type file for ts test
|
if (process.env.CI) {
|
||||||
await fs.copyFile(
|
// Copy type file for ts test
|
||||||
join(outDir, 'index.d.ts'),
|
await fs.copyFile(
|
||||||
join(__dirname, 'test/fixtures/15-helpers/ts/types.d.ts')
|
join(outDir, 'index.d.ts'),
|
||||||
);
|
join(__dirname, 'test/fixtures/15-helpers/ts/types.d.ts')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await fs.copyFile(
|
await fs.copyFile(
|
||||||
join(__dirname, 'src/edge-functions/edge-handler-template.js'),
|
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, '..');
|
const rootDir = path.join(__dirname, '..');
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const { stdout: sha } = await execa('git', ['rev-parse', '--short', 'HEAD'], {
|
const sha = await getSha();
|
||||||
cwd: rootDir,
|
|
||||||
});
|
|
||||||
const { stdout: turboStdout } = await execa(
|
const { stdout: turboStdout } = await execa(
|
||||||
'turbo',
|
'turbo',
|
||||||
['run', 'build', '--dry=json'],
|
['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 => {
|
main().catch(err => {
|
||||||
console.log('error running pack:', err);
|
console.log('error running pack:', err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user