Skip to content

Commit

Permalink
Maintenance: build, esm, dependency and linting (#84)
Browse files Browse the repository at this point in the history
This is major maintenance commit that improves the build process.
It does not change the functionality of the library.

* Use file extensions in imports. Extensionless imports are not supported in esm.
  This required adding .js in all import statements
* Provide esm module along with commonjs module
* Base the demo on the esm module
* Upgrade eslint to 9.0.0. json based config file is now deprecated.
  Migrate to eslint.config.js
* Above changes also should fix the broken build process in the CI
  Build it in more recent node versions too.
* Bump version to 2.4.0
  • Loading branch information
santhoshtr authored Nov 28, 2024
1 parent 4e81ec1 commit 385356f
Show file tree
Hide file tree
Showing 31 changed files with 2,066 additions and 4,932 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x]
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
3 changes: 1 addition & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Banana i18n Demo</title>
<meta name="author" content="Santhosh Thottingal">
<script src="../dist/banana-i18n.js"></script>
<script src="js/demo.js"></script>
<script src="js/demo.js" type="module"></script>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>

Expand Down
2 changes: 2 additions & 0 deletions demo/js/demo.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Banana from '../../dist/esm/banana-i18n.js'

const banana = new Banana()

function updateText () {
Expand Down
21 changes: 21 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";

export default [
{
files: ["**/*.{js,mjs,cjs,ts}"],
ignores: ["dist/**/*"],
},
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.mocha
}
}
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
Loading

0 comments on commit 385356f

Please sign in to comment.