@preval sourceCode

This commit is contained in:
Alex Gleason 2021-03-30 12:43:45 -05:00
parent dfa1443832
commit f97bba2308
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 12 additions and 10 deletions

View file

@ -7,16 +7,7 @@ import { connect } from 'react-redux';
import { openModal } from '../../../actions/modal';
import { logOut } from 'soapbox/actions/auth';
import { isStaff } from 'soapbox/utils/accounts';
import pkg from '../../../../../package.json';
const shortRepoName = url => new URL(url).pathname.substring(1);
const sourceCode = {
name: pkg.name,
url: pkg.repository.url,
repository: shortRepoName(pkg.repository.url),
version: pkg.version,
};
import sourceCode from 'soapbox/utils/code';
const mapStateToProps = state => {
const me = state.get('me');

11
app/soapbox/utils/code.js Normal file
View file

@ -0,0 +1,11 @@
// @preval
const pkg = require('../../../package.json');
const shortRepoName = url => new URL(url).pathname.substring(1);
module.exports = {
name: pkg.name,
url: pkg.repository.url,
repository: shortRepoName(pkg.repository.url),
version: pkg.version,
};