Skip to content

Commit

Permalink
feat: update @artus/core to 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
thonatos committed Jan 4, 2024
1 parent 0cc03d5 commit 3ae0ad2
Show file tree
Hide file tree
Showing 36 changed files with 126 additions and 179 deletions.
89 changes: 33 additions & 56 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 13 additions & 12 deletions packages/apps/artusx-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@
"build": "",
"tsc": "rm -rf dist && tsc"
},
"devDependencies": {
"@artus/tsconfig": "^1.0.1",
"@types/cron": "^2.0.0",
"@types/fs-extra": "^11.0.1",
"@types/node": "^18.11.17",
"@types/validator": "^13.7.12",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
"typescript": "^4.9.4"
},
"dependencies": {
"@artus/core": "^1.0.3",
"@artus/pipeline": "^0.2.2",
"@artus/core": "^2.x",
"@artus/pipeline": "^0.2",
"@artusx/core": "workspace:*",
"@artusx/utils": "workspace:*",
"cron": "^2.2.0",
"dayjs": "^1.11.7",
"dotenv": "^16.0.3",
Expand All @@ -33,5 +24,15 @@
"sequelize-typescript": "^2.1.5",
"@artusx/plugin-sequelize": "workspace:*",
"@artusx/plugin-redis": "workspace:*"
},
"devDependencies": {
"@artus/tsconfig": "^1.0.1",
"@types/cron": "^2.0.0",
"@types/fs-extra": "^11.0.1",
"@types/node": "^18.11.17",
"@types/validator": "^13.7.12",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
"typescript": "^4.9.4"
}
}
30 changes: 8 additions & 22 deletions packages/apps/artusx-api/src/app/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
import 'reflect-metadata';
import { ArtusApplication, ArtusInjectEnum, Scanner } from '@artus/core';

export async function start(options: any = {}) {
const scanner = new Scanner({
needWriteFile: false,
configDir: 'config',
extensions: ['.ts'],
framework: options.framework || { path: __dirname },
exclude: options.exclude || ['bin', 'test', 'coverage', 'src']
import path from 'path';
import { Application } from '@artusx/utils';

export async function start(options?: any) {
const app = await Application.start({
...options,
root: path.resolve(__dirname),
configDir: 'config'
});

const baseDir = options.baseDir || process.cwd();
const manifest = await scanner.scan(baseDir);

const artusEnv = options.artusEnv || 'default';
const app = new ArtusApplication({
env: 'default',
containerName: ArtusInjectEnum.DefaultContainerName
});
await app.load(manifest[artusEnv], baseDir);

await app.run();

return app;
}
4 changes: 0 additions & 4 deletions packages/apps/artusx-api/src/app/config/config.default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import checkAuth from '../middleware/checkAuth';
dotenv.config();

export default {
framework: {
package: '@artusx/core'
},

port: 7001,
middlewares: [checkAuth],

Expand Down
5 changes: 5 additions & 0 deletions packages/apps/artusx-api/src/app/config/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export default {
artusx: {
enable: true,
package: '@artusx/core'
},

redis: {
enable: true,
package: '@artusx/plugin-redis'
Expand Down
13 changes: 6 additions & 7 deletions packages/apps/artusx-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
},
"dependencies": {
"nodemon": "~3.0.2",
"@artus/core": "~2.2.0",
"@artus/core": "^2.x",
"@artusx/core": "workspace:*",
"@artusx/run": "workspace:*",
"@artusx/plugin-application-http": "workspace:*",
"tslib": "~2.6.2",
"typescript": "~5.3.3",
"@artusx/utils": "workspace:*",
"reflect-metadata": "^0.1.13"
},
"devDependencies": {
"@artus/tsconfig": "~1.0.1",
"@types/node": "~20.10.6",
"nodemon": "~3.0.2",
"ts-node": "~10.9.2",
"@types/node": "~20.10.6",
"@artus/tsconfig": "~1.0.1"
"tslib": "~2.6.2",
"typescript": "~5.3.3"
}
}
3 changes: 1 addition & 2 deletions packages/apps/artusx-web/src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import path from 'path';
import { Application } from '@artusx/run';
import { Application } from '@artusx/utils';

(async () => {
const app = await Application.start({
root: path.resolve(__dirname),
name: 'app',
configDir: 'config'
});

Expand Down
6 changes: 1 addition & 5 deletions packages/apps/artusx-web/src/config/config.default.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
export default {
framework: {
package: '@artusx/core'
}
};
export default {};
8 changes: 3 additions & 5 deletions packages/apps/artusx-web/src/config/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
export default {
redis: {
enable: false
},
sequelize: {
enable: false
artusx: {
enable: true,
package: '@artusx/core'
}
};
5 changes: 2 additions & 3 deletions packages/apps/artusx-web/src/controller/home.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { GET, HTTPController } from '@artusx/plugin-application-http';

import { HTTPContext } from '@artusx/plugin-application-http';
import { GET, HTTPController } from '../types';
import type { HTTPContext } from '../types';

@HTTPController()
export default class HomeController {
Expand Down
1 change: 1 addition & 0 deletions packages/apps/artusx-web/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@artusx/core/lib/types';
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3ae0ad2

Please sign in to comment.