Skip to content

Commit

Permalink
Improve compatibility between CJS and ESM modules (#67)
Browse files Browse the repository at this point in the history
* Improve compatibility between CJS and ESM modules

Changes how we export the library to rely in named exports.

* v5.0.0-0

* v5.0.0-1
  • Loading branch information
pirelenito authored May 5, 2021
1 parent e7310df commit a08b8ad
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ npm install --save-dev git-revision-webpack-plugin
Then, simply configure it as a plugin in the webpack config:

```javascript
var GitRevisionPlugin = require('git-revision-webpack-plugin')
const { GitRevisionPlugin } = require('git-revision-webpack-plugin')

module.exports = {
plugins: [new GitRevisionPlugin()],
Expand Down Expand Up @@ -70,7 +70,7 @@ Example using the [DefinePlugin](https://webpack.js.org/plugins/define-plugin/#u

```javascript
const webpack = require('webpack')
const GitRevisionPlugin = require('git-revision-webpack-plugin')
const { GitRevisionPlugin } = require('git-revision-webpack-plugin')
const gitRevisionPlugin = new GitRevisionPlugin()

module.exports = {
Expand All @@ -95,7 +95,7 @@ The plugin requires no configuration by default, but it is possible to configure
If you need [lightweight tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging#_lightweight_tags) support, you may turn on `lightweightTags` option in this way:

```javascript
var GitRevisionPlugin = require('git-revision-webpack-plugin')
const { GitRevisionPlugin } = require('git-revision-webpack-plugin')

module.exports = {
plugins: [
Expand All @@ -111,7 +111,7 @@ module.exports = {
If you need branch name support, you may turn on `branch` option in this way:

```javascript
var GitRevisionPlugin = require('git-revision-webpack-plugin')
const { GitRevisionPlugin } = require('git-revision-webpack-plugin')

module.exports = {
plugins: [
Expand All @@ -129,7 +129,7 @@ To change the default `git` command used to read the value of `COMMITHASH`.
This configuration is not not meant to accept arbitrary user input and it is executed by the plugin without any sanitization.

```javascript
var GitRevisionPlugin = require('git-revision-webpack-plugin')
const { GitRevisionPlugin } = require('git-revision-webpack-plugin')

module.exports = {
plugins: [
Expand All @@ -147,7 +147,7 @@ To change the default `git` command used to read the value of `VERSION`.
This configuration is not not meant to accept arbitrary user input and it is executed by the plugin without any sanitization.

```javascript
var GitRevisionPlugin = require('git-revision-webpack-plugin')
const { GitRevisionPlugin } = require('git-revision-webpack-plugin')

module.exports = {
plugins: [
Expand All @@ -165,7 +165,7 @@ To change the default `git` command used to read the value of `BRANCH`.
This configuration is not not meant to accept arbitrary user input and it is executed by the plugin without any sanitization.

```javascript
var GitRevisionPlugin = require('git-revision-webpack-plugin')
const { GitRevisionPlugin } = require('git-revision-webpack-plugin')

module.exports = {
plugins: [
Expand All @@ -183,7 +183,7 @@ To change the default `git` command used to read the value of `LASTCOMMITDATETIM
This configuration is not not meant to accept arbitrary user input and it is executed by the plugin without any sanitization.

```javascript
var GitRevisionPlugin = require('git-revision-webpack-plugin')
const { GitRevisionPlugin } = require('git-revision-webpack-plugin')

module.exports = {
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.0.1",
"version": "5.0.0-1",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface GitRevisionPluginOptions {
lightweightTags?: boolean
}

export default class GitRevisionPlugin {
export class GitRevisionPlugin {
gitWorkTree?: string
commithashCommand: string
versionCommand: string
Expand Down
2 changes: 1 addition & 1 deletion test/integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import webpack from 'webpack'
import fs from 'fs-extra'
import path from 'path'
import GitRevisionPlugin from '../src'
import { GitRevisionPlugin } from '../src'

const sourceProject = path.join(__dirname, '../fixtures/project')
const sourceGitRepository = path.join(__dirname, '../fixtures/git-repository')
Expand Down
2 changes: 1 addition & 1 deletion test/unit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Compiler } from 'webpack'
import GitRevisionPlugin from '../src'
import { GitRevisionPlugin } from '../src'

jest.mock('../src/build-file', () => jest.fn())
// eslint-disable-next-line import/first
Expand Down

0 comments on commit a08b8ad

Please sign in to comment.