Skip to content

Commit a1b5cf1

Browse files
committed
🔢 Pull version in at the Babel stage
1 parent 15627eb commit a1b5cf1

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

.eslintrc.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ env:
1111
plugins:
1212
- react
1313

14-
ecmaFeatures:
15-
modules: true
14+
globals:
15+
GIT_TAG: false
16+
GIT_COMMIT: false
1617

1718
parserOptions:
1819
sourceType: module

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"babel-eslint": "^8.0.0",
4646
"babel-jest": "^21.0.2",
4747
"babel-loader": "^7.1.0",
48+
"babel-plugin-git-version": "^0.2.0",
4849
"babel-plugin-transform-object-rest-spread": "^6.16.0",
4950
"babel-polyfill": "^6.16.0",
5051
"babel-preset-es2015": "^6.16.0",
@@ -73,6 +74,7 @@
7374
},
7475
"babel": {
7576
"plugins": [
77+
["git-version", { "commitLength": 8 }],
7678
"transform-object-rest-spread"
7779
],
7880
"presets": [

src/formatters/module.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import DocChomp from 'doc-chomp';
22

3-
import { name, version } from '../../package.json';
3+
const version = `${GIT_TAG} (${GIT_COMMIT})`;
44

55
export default ({ passElementProps }, imports, statics, jsx) => {
66
let moduleText = DocChomp`
7-
// Module generated from Markdown by ${name} v${version}
7+
// Module generated from Markdown by Markdown Component Loader ${version}
88
${imports}
99
MarkdownComponent.propTypes = {
1010
className: PropTypes.string,

yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,10 @@ babel-plugin-check-es2015-constants@^6.22.0:
557557
dependencies:
558558
babel-runtime "^6.22.0"
559559

560+
babel-plugin-git-version@^0.2.0:
561+
version "0.2.0"
562+
resolved "https://registry.yarnpkg.com/babel-plugin-git-version/-/babel-plugin-git-version-0.2.0.tgz#613afd28ae1da8e5ef98249be1b5aca74a13f8f5"
563+
560564
babel-plugin-istanbul@^4.0.0:
561565
version "4.1.5"
562566
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz#6760cdd977f411d3e175bb064f2bc327d99b2b6e"

0 commit comments

Comments
 (0)