Skip to content

Commit

Permalink
feat(cli): remove lodash.once in favor of custom implementation (#6979
Browse files Browse the repository at this point in the history
)
  • Loading branch information
skyrpex authored Aug 2, 2024
1 parent c1d4144 commit 524796c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 0 additions & 2 deletions apps/wing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"debug": "^4.3.5",
"glob": "^10.4.2",
"inquirer": "^8.2.6",
"lodash.once": "^4.1.1",
"nanoid": "^3.3.7",
"npm-packlist": "^8.0.2",
"open": "^8.4.2",
Expand All @@ -59,7 +58,6 @@
"devDependencies": {
"@types/debug": "^4.1.12",
"@types/inquirer": "^9.0.7",
"@types/lodash.once": "^4.1.9",
"@types/node": "^20.11.0",
"@types/node-persist": "^3.1.8",
"@types/npm-packlist": "^7.0.3",
Expand Down
2 changes: 1 addition & 1 deletion apps/wing/src/util.before-shutdown.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import once from "lodash.once";
import { once } from "./util.once";

/**
* Based on https://gist.github.com/nfantone/1eaa803772025df69d07f4dbf5df7e58.
Expand Down
14 changes: 14 additions & 0 deletions apps/wing/src/util.once.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export function once<T extends (...args: any[]) => any>(
func: T
): (...args: Parameters<T>) => ReturnType<T> {
let called = false;
let result: ReturnType<T>;

return (...args: Parameters<T>): ReturnType<T> => {
if (!called) {
called = true;
result = func(...args);
}
return result;
};
}
12 changes: 0 additions & 12 deletions pnpm-lock.yaml

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

0 comments on commit 524796c

Please sign in to comment.