|
|
|
@ -1,8 +1,13 @@
|
|
|
|
import { spawn } from 'cross-spawn'
|
|
|
|
import { spawn } from 'cross-spawn'
|
|
|
|
|
|
|
|
import { basename, dirname } from 'path'
|
|
|
|
|
|
|
|
|
|
|
|
export function getGitTimestamp(file: string) {
|
|
|
|
export function getGitTimestamp(file: string) {
|
|
|
|
return new Promise<number>((resolve, reject) => {
|
|
|
|
return new Promise<number>((resolve, reject) => {
|
|
|
|
const child = spawn('git', ['log', '-1', '--pretty="%ci"', file])
|
|
|
|
const cwd = dirname(file)
|
|
|
|
|
|
|
|
const fileName = basename(file)
|
|
|
|
|
|
|
|
const child = spawn('git', ['log', '-1', '--pretty="%ci"', fileName], {
|
|
|
|
|
|
|
|
cwd
|
|
|
|
|
|
|
|
})
|
|
|
|
let output = ''
|
|
|
|
let output = ''
|
|
|
|
child.stdout.on('data', (d) => (output += String(d)))
|
|
|
|
child.stdout.on('data', (d) => (output += String(d)))
|
|
|
|
child.on('close', () => {
|
|
|
|
child.on('close', () => {
|
|
|
|
|