Skip to content

Commit

Permalink
fix: move tegg to optional peer deps (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
killagu committed Mar 26, 2024
1 parent 28d029f commit 843fcd0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
11 changes: 10 additions & 1 deletion lib/cmd/dal/gen.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('node:path');
const { ModuleConfigUtil } = require('@eggjs/tegg-common-util');
const Command = require('../../command');

class DalGenCommand extends Command {
Expand All @@ -17,6 +16,16 @@ class DalGenCommand extends Command {
}

async run(context) {
let ModuleConfigUtil;
try {
const commonUtilHelper = require('@eggjs/tegg/helper');
ModuleConfigUtil = commonUtilHelper.ModuleConfigUtil;
} catch {
console.error('should install @eggjs/tegg first');
process.exit(1);
}


const { cwd, argv } = context;
const baseDir = argv.baseDir || cwd;

Expand Down
4 changes: 2 additions & 2 deletions lib/dal-gen.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const assert = require('node:assert');
const { TableModel, TableInfoUtil } = require('@eggjs/dal-decorator');
const { TableModel, TableInfoUtil } = require('@eggjs/tegg/dal');
const { CodeGenerator } = require('@eggjs/dal-runtime');
const { LoaderFactory } = require('@eggjs/tegg-loader');
const { LoaderFactory } = require('@eggjs/tegg/helper');

const moduleDir = process.argv[2];
assert(moduleDir, 'miss module dir');
Expand Down
19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,27 @@
"test": "^3.0.0",
"ts-node": "^10.8.0",
"tsconfig-paths": "^4.1.1",
"ypkgfiles": "^1.6.0",
"@eggjs/tegg-common-util": "^3.33.0",
"@eggjs/dal-runtime": "^3.33.0",
"@eggjs/dal-decorator": "^3.33.0",
"@eggjs/tegg-loader": "^3.33.0",
"@eggjs/tegg": "^3.33.0"
"ypkgfiles": "^1.6.0"
},
"peerDependencies": {
"egg-mock": ">=5.8.3"
"egg-mock": ">=5.8.3",
"@eggjs/tegg": "^3.33.0",
"@eggjs/dal-runtime": "^3.33.0"
},
"peerDependenciesMeta": {
"egg-mock": {
"optional": true
},
"@eggjs/tegg": {
"optional": true
},
"@eggjs/dal-runtime": {
"optional": true
}
},
"devDependencies": {
"@eggjs/dal-runtime": "^3.33.0",
"@eggjs/tegg": "^3.33.0",
"@eggjs/tsconfig": "^1.2.0",
"@types/mocha": "^10.0.1",
"@types/node": "^14.18.36",
Expand Down

0 comments on commit 843fcd0

Please sign in to comment.