npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@handstudio/hce-component-utils

v1.0.64

Published

utility functions component for HCE Web Services

Downloads

2

Readme

hce-component-utils

현대건설기계의 어드민 웹 어플리케이션 및 프론트 웹 어플리케이션에서 공통으로 사용하는 기능들에 대한 라이브러리 입니다.

How to Install

npm install @handstudio/hce-component-utils

FileUploader module

파일 업로드 미들웨어를 만들어 반환합니다.

How to use (with parameters)

import { initUploader, getUploader } from '@handstudio/hce-component-utils';

(async () => {
  await initUploader({
    name: 'default',
      // Optional, 넘기지 않는 경우 기본값은 default

    type: 'FILE', 
      // 'FILE' | 'BYPASS'
      // 'FILE' -> use local file storage
      // 'BYPASS' -> use another web server

    // case of 'FILE'
    file: {
      storagePath: '/home/ec2-user/upload-files',
        // directory which the uploaded file saved
      selfBaseUrl: 'https://hce-dev.devhand.net'
        // uploaded URL public baseURL
    },

    // case of 'BYPASS'
    bypass: {
      bypassUrl: 'http://10.0.23.1:4000/api/upload', 
        // upload API Endpoint URL
    }
  });

  // register UploadHandler like this:
  app.post('/upload-api', getUploader());

  // or, register named UploaderHandler like this:
  app.post('/uplaod-api-another', getUploader('bypass'));
})();

How to use (with environment variables)

직접 코드로 Uploader관련 Configuration을 넣지 않고, 환경변수를 통해 Uploader를 초기화 할 수 있습니다. 사용되는 환경변수는 다음과 같습니다.

# 업로더 구현체 종류
UPLOADER=BYPASS|FILE # 각각 업로드 API Bypass, 직접 파일 저장을 의미

# BYPASS인 경우 필수 옵션들
UPLOADER_BYPASS_URL=http://10.0.201.2:4000/api/upload # 업로드 API URL

# FILE인 경우 필수 옵션들
UPLOADER_FILE_STORAGE_PATH=/ec2-user/uploaded-files # 파일시스템 path
UPLOADER_SELF_BASE_URL=https://hce-dev.devhand.net # 업로드된 파일의 Public Endpoint의 BaseURL

해당 환경변수를 공급한 후, 다음과 같이 초기화하고 사용합니다.

import { initUploader, getUploader } from '@handstudio/hce-component-utils';

(async () => {
  await initUploader();

  // register UploadHandler like this:
  app.post('/upload-api', getUploader());
})();

MailSender

메일 발송 모듈입니다.

메일 발송 function을 리턴합니다.

How to use (with parameters)

import { initMailSender, getMailSender } from '../lib/mailsender';

(async () => {
  initMailSender({
    serviceType: 'GMAIL',
    // GMAIL, SMTP
    gmailPassword: 'example',
    gmailUser: '[email protected]',
    name: 'gmail'
  });

  const mailSender = getMailSender('gmail');
  mailSender({
    from: '[email protected]',
    to: '[email protected]',
    subject: '현대건설기계 테스트 메일입니다.',
    text: '현대건설기계 테스트 메일입니다.'
  });
})();

How to use (with environment variables)

메일 발송 모듈을 위한 값은 환경 변수로도 setting 할 수 있습니다.

# 메일 서비스 타입 GMAIL | SMTP
MAIL_SERVICE_TYPE=GMAIL 

# 지메일 사용 시 user
[email protected]
# 지메일 사용 시 password
GMAIL_PASSWORD=example

# SMTP 사용 시 host 
SMTP_HOST=todo
# SMTP 사용 시 port
SMTP_PORT=todo
# SMTP 사용 시 user
SMTP_USER=todo
# SMTP 사용 시 password
SMTP_PASSWORD=todo

이메일 템플릿

사용시 환경변수 BASEURL가 필요합니다. 이메일