Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteKiwi committed Mar 1, 2022
1 parent f1d5a75 commit f19b92e
Show file tree
Hide file tree
Showing 14 changed files with 3,469 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: '@kiwi-lib/eslint-config',
};
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
branches: [ main, develop ]

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Install
- name: Install
run: |
yarn
# Test
- name: Test
run: |
yarn run test
# yarn run test:cov
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# compiled output
/lib
/node_modules

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Yarn2
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
19 changes: 19 additions & 0 deletions .scripts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { publish } from './publish';

const scripts: Record<string, (...args: string[]) => Promise<void>> = {
publish,
};

async function run(scriptName: string) {
const script = scripts[scriptName];
if (!script) {
console.error('스크립트 이름을 확인해주세요');
return;
}

const args = process.argv.slice(3);
await script(...args);
process.exit();
}

run(process.argv[2]);
6 changes: 6 additions & 0 deletions .scripts/publish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { cmd } from './utils';

export async function publish() {
await cmd('yarn run build');
await cmd('yarn npm publish --access=public');
}
11 changes: 11 additions & 0 deletions .scripts/utils/cmd.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { exec as _exec } from 'child_process';
import { promisify } from 'util';

const exec = promisify(_exec);
export async function cmd(command: string): Promise<string> {
console.log(`$ ${command}`);
const { stdout, stderr } = await exec(command);
if (stderr) throw new Error(stderr);
console.log(stdout);
return stderr;
}
1 change: 1 addition & 0 deletions .scripts/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './cmd';
16 changes: 16 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: 'src',
testRegex: '.*\\.spec\\.ts$',
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
collectCoverageFrom: ['**/*.(t|j)s', '!**/index.ts'],
coveragePathIgnorePatterns: ['<rootDir>/index.ts'],
moduleNameMapper: {
'^@core/(.*)$': '<rootDir>/core/$1',
},
coverageDirectory: '../coverage',
testEnvironment: 'node',
testTimeout: 60000,
};
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "the-camp",
"version": "0.0.1",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": "[email protected]:whitekiwi/the-camp.git",
"author": "Whitekiwi <[email protected]>",
"scripts": {
"lint": "eslint \"{{src}/**/*.ts,**.js}\" --fix",
"test": "jest --forceExit",
"test:watch": "jest --watch",
"test:cov": "jest --coverage --forceExit",
"prebuild": "rimraf ./lib",
"build": "yarn run prebuild && tsc --project tsconfig.build.json",
"script": "ts-node .scripts/index.ts"
},
"devDependencies": {
"@kiwi-lib/eslint-config": "^1",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.21",
"jest": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"ts-node": "^10.5.0",
"tsconfig-paths": "^3.12.0",
"typescript": "^4.6.2"
},
"license": "MIT",
"homepage": "https://github.com/whitekiwi/the-camp",
"bugs": {
"url": "https://github.com/whitekiwi/the-camp/issues",
"email": "[email protected]"
},
"keywords": [
"kiwi-lib"
],
"files": [
"lib"
],
"prettier": "@kiwi-lib/eslint-config/prettier.config",
"dependencies": {
"axios": "^0.26.0"
}
}
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
async function main() {
console.log('test');
}
main();
5 changes: 5 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["src"],
"exclude": ["lib", "test", ".scripts", "**/*spec.ts"]
}
5 changes: 5 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["src", "test", ".scripts", "**/*spec.ts", "**.js", "**.json"],
"exclude": ["lib"]
}
25 changes: 25 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2021",
"sourceMap": true,
"inlineSources": true,
"outDir": "./lib",
"baseUrl": "./",
"incremental": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"paths": {
"@core/*": ["./src/core/*"]
}
}
}
Loading

0 comments on commit f19b92e

Please sign in to comment.