-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
646 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish Any Commit | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- run: corepack enable | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build | ||
run: npm run prepublishOnly --if-present | ||
|
||
- run: npx pkg-pr-new publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Boot } from './lib/boot.js'; | ||
|
||
export default Boot; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Boot } from './lib/boot.js'; | ||
|
||
export default Boot; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import path from 'node:path'; | ||
import { getSourceDirname } from '../lib/utils.js'; | ||
|
||
export default { | ||
/** | ||
* watcher options | ||
* @member Config#watcher | ||
* @property {string} type - event source type | ||
*/ | ||
watcher: { | ||
type: 'default', // default event source | ||
eventSources: { | ||
default: path.join(getSourceDirname(), 'lib', 'event-sources', 'default'), | ||
development: path.join(getSourceDirname(), 'lib', 'event-sources', 'development'), | ||
}, | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default { | ||
watcher: { | ||
type: 'development', | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default { | ||
watcher: { | ||
type: 'development', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './lib/types.js'; | ||
export * from './lib/watcher.js'; | ||
export * from './lib/event-sources/index.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { Application, Agent, ILifecycleBoot } from 'egg'; | ||
import { Watcher } from './watcher.js'; | ||
|
||
export class Boot implements ILifecycleBoot { | ||
#app: Application | Agent; | ||
#watcher: Watcher; | ||
|
||
constructor(appOrAgent: Application | Agent) { | ||
this.#app = appOrAgent; | ||
this.#watcher = this.#app.watcher = this.#app.cluster(Watcher, {}) | ||
.delegate('watch', 'subscribe') | ||
.create(appOrAgent.config) | ||
.on('info', (msg: string, ...args: any[]) => this.#app.coreLogger.info(msg, ...args)) | ||
.on('warn', (msg: string, ...args: any[]) => this.#app.coreLogger.warn(msg, ...args)) | ||
.on('error', (msg: string, ...args: any[]) => this.#app.coreLogger.error(msg, ...args)); | ||
} | ||
|
||
async didLoad(): Promise<void> { | ||
await this.#watcher.ready(); | ||
this.#app.coreLogger.info('[@eggjs/watcher:%s] watcher start success', this.#app.type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Base } from 'sdk-base'; | ||
|
||
export abstract class BaseEventSource extends Base { | ||
abstract watch(file: string): void; | ||
abstract unwatch(file: string): void; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { BaseEventSource } from './base.js'; | ||
|
||
export default class DefaultEventSource extends BaseEventSource { | ||
constructor() { | ||
super(); | ||
// delay emit so that can be listened | ||
setImmediate(() => this.emit('info', '[@eggjs/watcher] defaultEventSource watcher will NOT take effect')); | ||
this.ready(true); | ||
} | ||
|
||
watch() { | ||
this.emit('info', '[@eggjs/watcher] using defaultEventSource watcher.watch() does NOTHING'); | ||
} | ||
|
||
unwatch() { | ||
this.emit('info', '[@eggjs/watcher] using defaultEventSource watcher.unwatch() does NOTHING'); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.