const transformClasscat = require('ts-transform-classcat').default;
let fuse, app;
let isProduction = false;
+var setVersion = require('./set_version.js').setVersion;
Sparky.task('config', _ => {
fuse = new FuseBox({
});
app = fuse.bundle('app').instructions('>index.tsx');
});
+Sparky.task('version', _ => setVersion());
Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
Sparky.task('env', _ => (isProduction = true));
Sparky.task('copy-assets', () => Sparky.src('assets/*.svg').dest('dist/'));
-Sparky.task('dev', ['clean', 'config', 'copy-assets'], _ => {
+Sparky.task('dev', ['clean', 'config', 'copy-assets', 'version'], _ => {
fuse.dev();
app.hmr().watch();
return fuse.run();
});
-Sparky.task('prod', ['clean', 'env', 'config', 'copy-assets'], _ => {
+Sparky.task('prod', ['clean', 'env', 'config', 'copy-assets', 'version'], _ => {
// fuse.dev({ reload: true }); // remove after demo
return fuse.run();
});
--- /dev/null
+const fs = require('fs');
+
+exports.setVersion = function() {
+ let revision = require('child_process')
+ .execSync('git describe --tags --long')
+ .toString().trim();
+ let line = `export let version: string = "${revision}";`;
+ fs.writeFileSync("./src/version.ts", line);
+}
render() {
if (this.props.data.updated) {
return (
- <span className="font-italics">modified {moment.utc(this.props.data.updated).fromNow()}</span>
+ <span title={this.props.data.updated} className="font-italics">modified {moment.utc(this.props.data.updated).fromNow()}</span>
)
} else {
return (
- <span>{moment.utc(this.props.data.published).fromNow()}</span>
+ <span title={this.props.data.published}>{moment.utc(this.props.data.published).fromNow()}</span>
)
}
}
import { Link } from 'inferno-router';
import { repoUrl } from '../utils';
import { UserService } from '../services';
+import { version } from '../version';
interface NavbarState {
isLoggedIn: boolean;
navbar() {
return (
<nav class="navbar navbar-expand-sm navbar-light bg-light p-0 px-3 shadow">
- <a class="navbar-brand" href="#">
+ <a title={version} class="navbar-brand" href="#">
<svg class="icon mr-2"><use xlinkHref="#icon-mouse"></use></svg>
Lemmy
</a>