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

23.07.17 #11

Open
1 of 3 tasks
kakasoo opened this issue Jul 17, 2023 · 3 comments
Open
1 of 3 tasks

23.07.17 #11

kakasoo opened this issue Jul 17, 2023 · 3 comments
Assignees
Labels

Comments

@kakasoo
Copy link
Owner

kakasoo commented Jul 17, 2023

  • 1일 1알고리즘
  • 1일 1번역
    • [링크 이름](실제 링크 경로)
  • study (2시간 이상)
@kakasoo kakasoo added the TIL label Jul 17, 2023
@kakasoo kakasoo self-assigned this Jul 17, 2023
@kakasoo
Copy link
Owner Author

kakasoo commented Jul 17, 2023

function b () {
    let i = 0;
    
    while(true){
        console.log('in');
        i++;
        if (i % 1000 === 0) {
            new Promise((res) => {
                setTimeout(() => {
                    console.log('ok');
                }, 3000);            
            })               
        }
    }
    console.log('out');
}

이 함수에서 내부의 setTimeout이 있는 Promise는 동작하지 않는다. 호출 스택에 있을 b가 끝나지 않기 때문이다. setTimeout의 시간에 도달한다고 하더라도, 호출 스택이 비지 않으면 이벤트 루프는 이벤트 큐의 함수를 호출 스택으로 내보내지 않는다.

@kakasoo
Copy link
Owner Author

kakasoo commented Jul 17, 2023

블로킹 Vs. 논블로킹, 동기 Vs. 비동기

오랜만에 봐도 좋은 글이다.

@kakasoo
Copy link
Owner Author

kakasoo commented Jul 17, 2023

회사 내에 배포되어 있는 라이브러리를 보고 npm Pro 결제 없이도 private하게 라이브러리를 배포할 수 있는 걸 알았다.
배포할 패키지가 있는 레포지토리에서 package.json에 pubhlishConfig를 추가 하고, .npmrc 파일을 만들어서 아래와 같이 내용을 추가한다.

// 배포하려는 라이브러리 쪽 package.json
{
  "name": "@username/repositoryName",
  "publishConfig": {
    "registry": "https://npm.pkg.github.com/"
  },
  ...
}
# 배포하려는 라이브러리 쪽 .npmrc
@username:registry=https://npm.pkg.github.com/

이후에 패키지를 다운 받는 쪽에서도 .npmrc 파일을 추가하여 해당 패키지만 github packages에서 install될 수 있도록 하면 된다.
만약 install에 실패하는 경우, private repository기 때문에 접근 권한이 없어서 일 수 있다.

npm login --registry https://npm.pkg.github.com/

이 경우 npm login을 해두면 된다. ( --auth-type=legacy 는 이제 먹히지 않는 듯 하다. 패스워드 대신 github accessToken을 사용하자. )

reference

npm, github의 username, organization name이 같다면?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant