Skip to content

Commit 58454db

Browse files
authored
v5 (#18)
* chore: rewrite package to esmodules (#16) BREAKING CHANGE: The package won't support CJS anymore. * chore: use componentLoader instead of AdminJS.bundle BREAKING CHANGE: Configuration changed due to AdminJS.bundle being removed, use componentLoader instead
1 parent 9d01941 commit 58454db

25 files changed

+5061
-6079
lines changed

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
'plugin:react/recommended',
99
],
1010
parserOptions: {
11-
ecmaVersion: 2018,
11+
ecmaVersion: 20,
1212
sourceType: 'module',
1313
ecmaFeatures: {
1414
jsx: true,
@@ -17,8 +17,8 @@ module.exports = {
1717
rules: {
1818
'prettier/prettier': 'error',
1919
'react/prop-types': 'off',
20-
'semi': ['error', 'always'],
21-
'quotes': ['error', 'single'],
20+
semi: ['error', 'always'],
21+
quotes: ['error', 'single'],
2222
},
2323
ignorePatterns: ['node_modules', 'lib'],
2424
};

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Setup
1111
uses: actions/setup-node@v2
1212
with:
13-
node-version: '16'
13+
node-version: '18'
1414
- uses: actions/cache@v2
1515
id: yarn-cache
1616
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,4 @@ dist
122122
/lib
123123
/types
124124
example/.adminjs
125+
.nova
File renamed without changes.

jest.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

jest.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"moduleFileExtensions": ["js", "json", "ts", "tsx"],
3+
"rootDir": "./test",
4+
"testEnvironment": "node",
5+
"testRegex": ".test.ts$",
6+
"extensionsToTreatAsEsm": [".ts"],
7+
"transformIgnorePatterns": ["node_modules"],
8+
"transform": {
9+
"^.+\\.(t|j)sx?$": [
10+
"ts-jest",
11+
{
12+
"useESM": true,
13+
"tsconfig": "./tsconfig.test.json",
14+
"isolatedModules": true
15+
}
16+
]
17+
},
18+
"moduleNameMapper": {
19+
"^(\\.{1,2}/.*)\\.js$": "$1"
20+
},
21+
"testTimeout": 10000,
22+
"preset": "ts-jest/presets/default-esm",
23+
"verbose": true,
24+
"silent": true,
25+
"forceExit": true
26+
}

package.json

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{
22
"name": "@adminjs/logger",
33
"version": "4.0.1",
4-
"main": "lib/index.js",
5-
"types": "types/index.d.ts",
4+
"type": "module",
5+
"exports": {
6+
".": {
7+
"import": "./lib/index.js",
8+
"types": "./types/index.d.ts"
9+
}
10+
},
611
"private": false,
712
"repository": "[email protected]:SoftwareBrothers/adminjs-logger.git",
813
"license": "MIT",
@@ -11,8 +16,8 @@
1116
"clean": "rimraf lib types",
1217
"build": "tsc",
1318
"dev": "tsc --watch",
14-
"test": "jest",
15-
"lint": "eslint -c '.eslintrc.js' './src/**/*'",
19+
"test": "NODE_OPTIONS=--experimental-vm-modules dotenv -e .env -- jest --config ./jest.json --runInBand --detectOpenHandles",
20+
"lint": "eslint -c '.eslintrc.cjs' './src/**/*'",
1621
"check:all": "yarn lint && yarn build && yarn test"
1722
},
1823
"husky": {
@@ -21,35 +26,34 @@
2126
}
2227
},
2328
"peerDependencies": {
24-
"@adminjs/design-system": "^3.0.4",
25-
"adminjs": "^6.4.1"
29+
"adminjs": "^7.0.0"
2630
},
2731
"devDependencies": {
28-
"@adminjs/design-system": "^3.0.4",
29-
"@commitlint/cli": "^8.3.5",
30-
"@commitlint/config-conventional": "^8.3.4",
31-
"@semantic-release/git": "^9.0.0",
32-
"@types/jest": "^26.0.14",
33-
"@types/lodash": "^4.14.186",
34-
"@typescript-eslint/eslint-plugin": "^5.16.0",
35-
"@typescript-eslint/parser": "^5.16.0",
36-
"adminjs": "^6.4.1",
37-
"eslint": "^8.11.0",
38-
"eslint-config-prettier": "^8.5.0",
39-
"eslint-plugin-import": "^2.25.4",
40-
"eslint-plugin-prettier": "^3.1.4",
41-
"eslint-plugin-react": "^7.29.4",
32+
"@commitlint/cli": "^17.4.4",
33+
"@commitlint/config-conventional": "^17.4.4",
34+
"@semantic-release/git": "^10.0.1",
35+
"@types/jest": "^29.5.0",
36+
"@types/lodash": "^4.14.191",
37+
"@typescript-eslint/eslint-plugin": "^5.56.0",
38+
"@typescript-eslint/parser": "^5.56.0",
39+
"adminjs": "^7.0.0",
40+
"dotenv-cli": "^7.1.0",
41+
"eslint": "^8.36.0",
42+
"eslint-config-prettier": "^8.8.0",
43+
"eslint-plugin-import": "^2.27.5",
44+
"eslint-plugin-prettier": "^4.2.1",
45+
"eslint-plugin-react": "^7.32.2",
4246
"husky": "^4.3.0",
43-
"jest": "^26.5.3",
44-
"prettier": "^2.0.5",
45-
"rimraf": "^3.0.2",
46-
"semantic-release": "^17.0.7",
47-
"semantic-release-slack-bot": "^1.6.2",
48-
"ts-jest": "^26.4.1",
47+
"jest": "^29.5.0",
48+
"prettier": "^2.8.6",
49+
"rimraf": "^4.4.0",
50+
"semantic-release": "^20.1.3",
51+
"semantic-release-slack-bot": "^4.0.0",
52+
"ts-jest": "^29.0.5",
4953
"ts-node": "^10.9.1",
50-
"typescript": "^4.8.4"
54+
"typescript": "^4.9.5"
5155
},
5256
"dependencies": {
53-
"lodash": "^4.17.20"
57+
"lodash": "^4.17.21"
5458
}
5559
}

src/components/RecordDifference.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import React, { FC } from 'react';
2-
import { BasePropertyProps, flat } from 'adminjs';
31
import {
42
FormGroup,
53
Label,
64
Table as AdminTable,
7-
TableCell,
85
TableBody,
6+
TableCell,
97
TableHead,
108
TableRow,
119
} from '@adminjs/design-system';
12-
import styled from 'styled-components';
10+
import { BasePropertyProps, flat } from 'adminjs';
11+
import React, { FC } from 'react';
12+
import { styled } from 'styled-components';
1313

1414
const Cell = styled(TableCell)`
1515
width: 100%;
@@ -44,9 +44,11 @@ const RecordDifference: FC<BasePropertyProps> = ({ record, property }) => {
4444
<Label>{property.label}</Label>
4545
<Table>
4646
<Head>
47-
<Cell>Property name</Cell>
48-
<Cell>Before</Cell>
49-
<Cell>After</Cell>
47+
<Row>
48+
<Cell>Property name</Cell>
49+
<Cell>Before</Cell>
50+
<Cell>After</Cell>
51+
</Row>
5052
</Head>
5153
<TableBody>
5254
{Object.entries(

src/components/RecordLink.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React, { FC } from 'react';
2-
import { BasePropertyProps, ViewHelpers } from 'adminjs';
31
import { FormGroup, Link } from '@adminjs/design-system';
2+
import { BasePropertyProps, ViewHelpers } from 'adminjs';
3+
import React, { FC } from 'react';
44

5-
import { getLogPropertyName } from '../utils/get-log-property-name';
5+
import { getLogPropertyName } from '../utils/get-log-property-name.js';
66

77
const viewHelpers = new ViewHelpers();
88
const RecordLink: FC<BasePropertyProps> = ({ record, property }) => {

src/components/bundle.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)