spoclip-kit
v5.0.0
Published
TypeScript utility library for internal use
Readme
Spoclip Kit
TypeScript utility library for internal use.
Installation
npm install spoclip-kitUsage
Import specific modules
import {
calculateOriginalDownloadCostWon,
isDownloadDurationAllowed,
} from 'spoclip-kit/libs';
// 10초 미만은 다운로드 불가
isDownloadDurationAllowed(8); // false
isDownloadDurationAllowed(60); // true
// 30초 무료 + 초과분 100원/분 (멤버십 구분 없음)
calculateOriginalDownloadCostWon(60); // 50 (30초 초과분 30초 과금)
// 전체 영상 10% 할인
calculateOriginalDownloadCostWon(60, { isFullVideo: true }); // 45
// 중복 화각 동시 다운로드 (단일 화각 비용 × 화각 수)
calculateOriginalDownloadCostWon(60, { angleCount: 3 }); // 150Development
Setup
npm installPublishing
spoclip 계정으로 로그인 후
npm run loginnpm run release:patch
npm run release:minor
npm run release:major새로운 진입점 정의
1. src/new-module
- 파일 생성
src
new-module
index.ts // re-export new-feature.ts
new-feature.ts- main entry point 에서 export
// Main entry point for spoclip-kit
export * from './libs';
export * from './types';
// ...
export * from './new-module';2. Update tsup.config.ts
export default defineConfig({
entry: {
index: 'src/index.ts',
libs: 'src/libs/index.ts',
types: 'src/types/index.ts',
'new-module': 'src/new-module/index.ts',
},
// ...
});3. Update package.json
{
"name": "spoclip-kit",
// ...
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.js"
},
"./libs": {
"types": "./dist/libs.d.ts",
"require": "./dist/libs.cjs",
"import": "./dist/libs.js"
},
"./new-module": {
"types": "./dist/new-module.d.ts",
"require": "./dist/new-module.cjs",
"import": "./dist/new-module.js"
}
}
// ...
}