Skip to content

Commit 292509f

Browse files
committed
chore: update packages for esm
BREAKING CHANGE: The package won't support CJS anymore.
1 parent ad6d281 commit 292509f

16 files changed

+1979
-4966
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
'plugin:react/recommended',
88
],
99
parserOptions: {
10-
ecmaVersion: 2018,
10+
ecmaVersion: 2020,
1111
sourceType: 'module',
1212
ecmaFeatures: {
1313
jsx: true,

.github/workflows/push.yml

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ env:
77
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
88
jobs:
99
test:
10-
name: test
10+
name: Test and Publish
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v2
1515
- name: Setup
1616
uses: actions/setup-node@v2
1717
with:
18-
node-version: '14.x'
19-
- uses: actions/cache@v1
18+
node-version: '18.x'
19+
- uses: actions/cache@v2
2020
id: yarn-cache
2121
with:
2222
path: node_modules
@@ -30,40 +30,6 @@ jobs:
3030
run: yarn lint
3131
- name: Build
3232
run: yarn build
33-
- name: Test
34-
run: yarn test
35-
36-
publish:
37-
name: Publish
38-
needs: test
39-
if: |
40-
github.event_name == 'push'
41-
&& (
42-
contains(github.ref, 'refs/heads/next')
43-
|| contains(github.ref, 'refs/heads/main')
44-
|| contains(github.ref, 'refs/heads/next-major')
45-
|| contains(github.ref, 'refs/heads/beta')
46-
)
47-
runs-on: ubuntu-latest
48-
steps:
49-
- name: Checkout
50-
uses: actions/checkout@v2
51-
- name: Setup
52-
uses: actions/setup-node@v2
53-
with:
54-
node-version: '14.x'
55-
- uses: actions/cache@v1
56-
id: yarn-cache
57-
with:
58-
path: node_modules
59-
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
60-
restore-keys: |
61-
${{ runner.os }}-node_modules-
62-
- name: Install
63-
if: steps.yarn-cache.outputs.cache-hit != 'true'
64-
run: yarn install
65-
- name: Build
66-
run: yarn build
6733
- name: Release
6834
env:
6935
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
File renamed without changes.

jest.config.cjs

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

package.json

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "module",
55
"exports": {
66
".": {
7-
"import": "./build/index.js",
7+
"import": "./lib/index.js",
88
"types": "./types/index.d.ts"
99
}
1010
},
@@ -15,9 +15,7 @@
1515
"release": "semantic-release",
1616
"build": "tsc",
1717
"dev": "tsc --watch",
18-
"test": "jest",
19-
"lint": "eslint './src/**/*'",
20-
"check:all": "yarn lint && yarn build && yarn test"
18+
"lint": "eslint './src/**/*'"
2119
},
2220
"husky": {
2321
"hooks": {
@@ -30,42 +28,31 @@
3028
},
3129
"devDependencies": {
3230
"@adminjs/design-system": "^3.1.0",
33-
"@adminjs/express": "^4.0.1",
34-
"@commitlint/cli": "^11.0.0",
35-
"@commitlint/config-conventional": "^11.0.0",
36-
"@semantic-release/git": "^9.0.0",
37-
"@types/express": "^4.17.9",
38-
"@types/jest": "^29.4.1",
39-
"@types/json2csv": "^5.0.1",
40-
"@types/xml": "^1.0.5",
41-
"@types/xml2js": "^0.4.5",
42-
"@typescript-eslint/eslint-plugin": "^5.55.0",
43-
"@typescript-eslint/parser": "^5.55.0",
31+
"@commitlint/cli": "^17.4.4",
32+
"@commitlint/config-conventional": "^17.4.4",
33+
"@semantic-release/git": "^10.0.1",
34+
"@types/json2csv": "^5.0.3",
35+
"@types/xml": "^1.0.8",
36+
"@types/xml2js": "^0.4.11",
37+
"@typescript-eslint/eslint-plugin": "^5.56.0",
38+
"@typescript-eslint/parser": "^5.56.0",
4439
"adminjs": "^6.0.0",
45-
"date-fns": "^2.16.1",
40+
"date-fns": "^2.29.3",
4641
"eslint": "^8.36.0",
47-
"eslint-config-prettier": "^8.7.0",
42+
"eslint-config-prettier": "^8.8.0",
4843
"eslint-plugin-import": "^2.27.5",
4944
"eslint-plugin-prettier": "^4.2.1",
5045
"eslint-plugin-react": "^7.32.2",
51-
"express": "^4.17.1",
52-
"express-formidable": "^1.2.0",
53-
"express-session": "^1.17.2",
5446
"husky": "^4.3.0",
55-
"jest": "^29.5.0",
56-
"prettier": "^2.7.1",
57-
"semantic-release": "^17.2.2",
58-
"ts-jest": "^29.0.5",
47+
"prettier": "^2.8.6",
48+
"semantic-release": "^20.1.3",
5949
"ts-node": "^10.9.1",
6050
"typescript": "^4.9.5"
6151
},
6252
"dependencies": {
63-
"@adminjs/mongoose": "^2.0.0",
64-
"@types/mongoose": "^5.7.37",
6553
"csvtojson": "^2.0.10",
66-
"file-saver": "^2.0.2",
54+
"file-saver": "^2.0.5",
6755
"json2csv": "^5.0.3",
68-
"mongoose": "^5.10.11",
6956
"xml": "^1.0.1",
7057
"xml2js": "^0.4.23"
7158
}

src/components/ExportComponent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import React, { FC, useState } from 'react';
22
import { ActionProps, ApiClient, useNotice } from 'adminjs';
33
import { Box, Button, Loader, Text } from '@adminjs/design-system';
44
import { saveAs } from 'file-saver';
5-
import { Exporters, ExporterType } from '../exporter.type.js';
65
import format from 'date-fns/format';
76

7+
import { Exporters, ExporterType } from '../exporter.type.js';
8+
89
export const mimeTypes: Record<ExporterType, string> = {
910
json: 'application/json',
1011
csv: 'text/csv',

src/export.handler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import { ActionHandler, ActionResponse } from 'adminjs';
2+
13
import { Parsers } from './parsers.js';
24
import { getRecords } from './utils.js';
3-
import { ActionHandler, ActionResponse } from 'adminjs';
45

56
export const exportHandler: ActionHandler<ActionResponse> = async (
67
request,

src/import.handler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ActionHandler, ActionResponse } from 'adminjs';
22
import fs from 'fs';
33
import util from 'util';
4+
45
import { getFileFromRequest, getImporterByFileName } from './utils.js';
56

67
const readFile = util.promisify(fs.readFile);

src/importExportFeature.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { buildFeature, FeatureType } from 'adminjs';
2+
23
import { bundleComponents } from './components/bundleComponents.js';
34
import { postActionHandler } from './utils.js';
45
import { exportHandler } from './export.handler.js';

src/modules/csv/csv.importer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import csv from 'csvtojson';
2+
23
import { Importer } from '../../parsers.js';
34
import { saveRecords } from '../../utils.js';
45

src/modules/xml/xml.importer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { Importer } from '../../parsers.js';
21
import xml2js from 'xml2js';
2+
3+
import { Importer } from '../../parsers.js';
34
import { saveRecords } from '../../utils.js';
45

56
export const xmlImporter: Importer = async (xmlString, resource) => {

src/parsers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { BaseRecord, BaseResource } from 'adminjs';
2+
23
import { ExporterType } from './exporter.type.js';
34
import { jsonExporter } from './modules/json/json.exporter.js';
45
import { jsonImporter } from './modules/json/json.importer.js';

src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
Filter,
99
ValidationError,
1010
} from 'adminjs';
11+
1112
import { csvImporter } from './modules/csv/csv.importer.js';
1213
import { jsonImporter } from './modules/json/json.importer.js';
1314
import { xmlImporter } from './modules/xml/xml.importer.js';

test/export-csv.test.ts

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

test/feature.test.ts

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

0 commit comments

Comments
 (0)