Skip to content

Commit

Permalink
chore: change to ECMAScript modules (#52)
Browse files Browse the repository at this point in the history
* chore: change to ECMAScript modules

BREAKING CHANGE: This package won't support CJS anymore.
  • Loading branch information
jwasiak authored Apr 18, 2023
1 parent 3c7303b commit 76c257f
Show file tree
Hide file tree
Showing 21 changed files with 13,195 additions and 12,852 deletions.
25 changes: 6 additions & 19 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
"env": {
"browser": true,
"es6": true,
"node": true,
"jest": true
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prefer-arrow",
"jsdoc",
"jest",
"import"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended"
"plugin:@typescript-eslint/recommended"
],
"settings": {
"import/core-modules": [
Expand Down Expand Up @@ -112,12 +113,6 @@
"always"
],
"guard-for-in": "error",
"jest/expect-expect": [
"error",
{
"assertFunctionNames": ["expect", "request.*.expect", "request.**.expect", "request.*.expect*"]
}
],
"max-classes-per-file": "off",
"new-parens": "error",
"no-bitwise": "error",
Expand Down Expand Up @@ -204,14 +199,6 @@
"rules": {
"spaced-comment": "off"
}
},
{
"files": [
"*/cypress/**/*.spec.ts"
],
"rules": {
"jest/expect-expect": "off"
}
}
]
}
23 changes: 3 additions & 20 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Setup
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: '12.x'
- uses: actions/cache@v1
node-version: '18.x'
- uses: actions/cache@v2
id: yarn-cache
with:
path: node_modules
Expand All @@ -31,20 +31,3 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release

notify:
name: Notify
runs-on: ubuntu-latest
if: failure()
needs:
- test
steps:
- uses: technote-space/workflow-conclusion-action@v1
- uses: 8398a7/action-slack@v3
with:
status: ${{ env.WORKFLOW_CONCLUSION }}
fields: repo,message,commit,author,action,eventName,ref,workflow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
if: always()
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"semantic-release-slack-bot",
{
"notifyOnSuccess": true,
"notifyOnFail": true
"notifyOnFail": false
}
]
]
Expand Down
File renamed without changes.
70 changes: 35 additions & 35 deletions example-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,47 @@
"test:e2e": "NODE_ENV=test jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@adminjs/express": "^5.0.0",
"@adminjs/mongoose": "^3.0.0",
"@nestjs/common": "^9.0.5",
"@nestjs/core": "^9.0.5",
"@nestjs/mongoose": "^9.2.0",
"@nestjs/platform-express": "^9.0.5",
"adminjs": "^6.0.0",
"class-transformer": "^0.3.1",
"class-validator": "^0.12.2",
"express": "^4.18.1",
"@adminjs/express": "^5.1.0",
"@adminjs/mongoose": "^3.0.3",
"@nestjs/common": "^9.3.12",
"@nestjs/core": "^9.3.12",
"@nestjs/mongoose": "^9.2.2",
"@nestjs/platform-express": "^9.3.12",
"adminjs": "^7.0.0-beta-v7.5",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"express": "^4.18.2",
"express-formidable": "^1.2.0",
"express-session": "^1.17.1",
"mongoose": "^5.13.14",
"express-session": "^1.17.3",
"mongoose": "^7.0.3",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.0",
"rxjs": "^7.2.0"
"rimraf": "^4.4.1",
"rxjs": "^7.8.0"
},
"devDependencies": {
"@nestjs/cli": "^9.0.0",
"@nestjs/schematics": "^9.0.1",
"@nestjs/testing": "^9.0.5",
"@types/express": "^4.17.13",
"@types/jest": "^26.0.9",
"@nestjs/cli": "^9.3.0",
"@nestjs/schematics": "^9.1.0",
"@nestjs/testing": "^9.3.12",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.0",
"@types/mongoose": "^5.11.97",
"@types/node": "^12.7.5",
"@types/supertest": "^2.0.8",
"cypress": "^4.11.0",
"eslint": "^7.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jest": "^23.13.1",
"eslint-plugin-jsdoc": "^25.4.2",
"@types/node": "^18.15.11",
"@types/supertest": "^2.0.12",
"cypress": "^12.9.0",
"eslint": "^8.37.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-jsdoc": "^40.1.1",
"eslint-plugin-prefer-arrow": "^1.2.1",
"jest": "^24.9.0",
"prettier": "^1.18.2",
"supertest": "^4.0.2",
"ts-jest": "^24.1.0",
"ts-loader": "^6.1.1",
"ts-node": "^8.4.1",
"tsc-watch": "^2.4.0",
"tsconfig-paths": "^3.9.0",
"typescript": "^4.3.5"
"jest": "^29.5.0",
"prettier": "^2.8.7",
"supertest": "^6.3.3",
"ts-jest": "^29.1.0",
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"tsc-watch": "^6.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.0.3"
},
"jest": {
"moduleFileExtensions": [
Expand Down
44 changes: 22 additions & 22 deletions example-app/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,32 @@ AdminJS.registerAdapter(AdminJSMongoose);

@Module({
imports: [
MongooseModule.forRoot('mongodb://localhost:27017/nest'),
AdminModule.createAdminAsync({
imports: [
MongooseSchemasModule,
],
inject: [
getModelToken('Admin'),
MongooseModule.forRoot('mongodb://localhost:27017/nest'),
AdminModule.createAdminAsync({
imports: [
MongooseSchemasModule,
],
inject: [
getModelToken('Admin'),
],
useFactory: (adminModel: Model<Admin>) => ({
adminJsOptions: {
rootPath: '/admin',
resources: [
{ resource: adminModel },
],
useFactory: (adminModel: Model<Admin>) => ({
adminJsOptions: {
rootPath: '/admin',
resources: [
{ resource: adminModel },
],
},
auth: {
authenticate: async (email, password) => Promise.resolve({ email: 'test' }),
cookieName: 'test',
cookiePassword: 'testPass',
},
},
auth: {
authenticate: async (email, password) => Promise.resolve({ email: 'test' }),
cookieName: 'test',
cookiePassword: 'testPass',
},
}),
customLoader: ExpressCustomLoader,
customLoader: ExpressCustomLoader,
}),
MongooseSchemasModule,
MongooseSchemasModule,
],
controllers: [AppController],
providers: [AppService],
})
})
export class AppModule { }
4 changes: 2 additions & 2 deletions example-app/src/mongoose/mongoose.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { AdminSchema } from './admin-model';

@Module({
imports: [
MongooseModule.forFeature([{ name: 'Admin', schema: AdminSchema }]),
MongooseModule.forFeature([{ name: 'Admin', schema: AdminSchema }]),
],
exports: [MongooseModule],
})
})
export class MongooseSchemasModule {}
Loading

0 comments on commit 76c257f

Please sign in to comment.