Skip to content

Commit

Permalink
Convert to ESM (#72)
Browse files Browse the repository at this point in the history
* Convert to ESM

* Switch to npm from yarn

* Cleanup module imports

* Fix babel config for jest
  • Loading branch information
job13er authored Sep 27, 2023
1 parent 1404419 commit 2460a59
Show file tree
Hide file tree
Showing 32 changed files with 9,079 additions and 4,261 deletions.
File renamed without changes.
12 changes: 12 additions & 0 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ module.exports = {
jest: false,
},

parser: '@babel/eslint-parser',
parserOptions: {
babelOptions: {
plugins: [
'@babel/plugin-syntax-import-assertions'
],
},
requireConfigFile: false,
sourceType: 'module',
},

rules: {
'arrow-parens': 'off', // conflicts with prettier
'comma-dangle': ['error', 'only-multiline'], // conflicts with prettier
Expand All @@ -22,5 +33,6 @@ module.exports = {
'operator-linebreak': 'off', // conflicts with prettier
'semi-style': 'off', // conflicts with prettier
semi: ['error', 'never'], // to match prettier settings
'import/extensions': ['error', 'ignorePackages'],
},
}
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- run: yarn install
node-version: 18.x
- run: npm install
- run: VERBOSE=1 ./bin/cli.js check
- run: yarn test
- run: npm run test
- run: VERBOSE=1 ./bin/cli.js bump
- run: VERBOSE=1 ./bin/cli.js publish
3 changes: 3 additions & 0 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'**/*.{js,jsx,json,css}': ['prettier --config .prettierrc.cjs --write'],
}
3 changes: 0 additions & 3 deletions .lintstagedrc.js

This file was deleted.

File renamed without changes.
4 changes: 4 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-syntax-import-assertions"]
}
10 changes: 6 additions & 4 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

/* eslint-disable no-console */

const chalk = require('chalk')
const program = require('commander')
const {name, version} = require('../package.json')
const {createBumpr} = require('../src/cli')
import chalk from 'chalk'
import program from 'commander'
import pkgJson from '../package.json' assert {type: 'json'}
import {createBumpr} from '../src/cli.js'

const {name, version} = pkgJson

function handleError(error) {
const msg = error.message ? error.message : error
Expand Down
9 changes: 6 additions & 3 deletions jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ module.exports = {
coverageThreshold: {
global: {
branches: 100,
statements: 100
}
statements: 100,
},
},
testEnvironment: 'node',
testMatch: ['<rootDir>/**/tests/*.test.js']
testMatch: ['<rootDir>/**/tests/*.test.js'],
transform: {
'^.+\\.[t|j]sx?$': 'babel-jest',
},
}
Loading

0 comments on commit 2460a59

Please sign in to comment.