Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve lifecycle deprecated message #275

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/egg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
* @param {string} [name] scope name, default is empty string
*/
beforeStart(scope: Fun, name?: string) {
this.deprecate('Please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');
this.deprecate('`beforeStart` was deprecated, please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');

Check warning on line 236 in src/egg.ts

View check run for this annotation

Codecov / codecov/patch

src/egg.ts#L236

Added line #L236 was not covered by tests
this.lifecycle.registerBeforeStart(scope, name ?? '');
}

Expand Down Expand Up @@ -276,7 +276,7 @@
* mysql.ready(done);
*/
readyCallback(name: string, opts: object) {
this.deprecate('Please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');
this.deprecate('`readyCallback` was deprecated, please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');

Check warning on line 279 in src/egg.ts

View check run for this annotation

Codecov / codecov/patch

src/egg.ts#L279

Added line #L279 was not covered by tests
return this.lifecycle.legacyReadyCallback(name, opts);
}

Expand All @@ -293,7 +293,7 @@
* @param {Function} fn - the function that can be generator function or async function.
*/
beforeClose(fn: Fun) {
this.deprecate('Please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');
this.deprecate('`beforeClose` was deprecated, please use "Life Cycles" instead, see https://www.eggjs.org/advanced/loader#life-cycles');

Check warning on line 296 in src/egg.ts

View check run for this annotation

Codecov / codecov/patch

src/egg.ts#L296

Added line #L296 was not covered by tests
this.lifecycle.registerBeforeClose(fn);
}

Expand Down
Loading