Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve compatibility between CJS and ESM modules #67

Merged
merged 4 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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