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
def level_bfs(): | |
queue = [] | |
queue.append(root) | |
while queue: | |
size = len(queue) | |
node = queue.pop(0) | |
while size: | |
if node.left: |
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
// reference: https://github.com/wclr/yalc/issues/22#issuecomment-719903924 | |
"scripts": { | |
"dev-watch": "tsc-watch --onSuccess \"yalc push\"" | |
} |
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
{ | |
"dependencies": { | |
"B": "file:./B-1.0.0.tgz" | |
} | |
} |
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
$ cd <package> | |
$ yarn pack | |
{package}-{version}.tgz file created! | |
$ cd <project> | |
$ cp <package>/{package}-{version}.tgz /path/to/project/ | |
$ yarn add /path/to/project/{package}-{version}.tgz |
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
// 런타임에 특정 패키지를 바라보는 경로를 수정 | |
function alias() { | |
const moduleAlias = require('module-alias') | |
if (process.env.STAGE !== 'local') { | |
return | |
} | |
// 개발자가 로컬 환경에서 실행하는 경우 | |
const cache: any = {} | |
const typeorm = 'typeorm' |
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
const entity = new ExampleRepository() | |
getRepositoryName(entity) // "validRepositoryName" OR Error |
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
// A/getRepositoryName.ts | |
import { Repository } from "typeorm" | |
export function getRepositoryName(entity: EntityClass) { | |
if (entity instanceof Repository) { | |
return "validRepositoryName" | |
} | |
throw new Error("entity is not a valid typeorm Repository") | |
} |
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
// project/ExampleRepository.ts | |
import { Repository } from "B" | |
export class ExampleRepository extends Repository {} |
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
// B/index.ts | |
export * from "typeorm" |
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
node_modules | |
packageA | |
packageB (symlinked) | |
node_modules | |
typeorm x.y.z (1) | |
typeorm x.y.z (2) |
NewerOlder