@mornya/vessel
Version:
Creates/publishes a Node.js module with no build configuration.
99 lines (96 loc) • 3.77 kB
JavaScript
/*
* export되는 내용은 기본 package.json 구조와 필수 값들에 대한 템플릿이며,
* 생성된 프로젝트의 package.json과 병합된다.
* 아래 오브젝트 순서대로 생성되며, json 파일로 관리하면 validation이 체크되기 때문에 따로 js 파일로 관리한다.
*/
const path = require('path');
const ownPackageJsonData = require('../package.json');
// 생성된 프로젝트의 경로명을 패키지명으로 사용
const cwd = process.cwd();
const name = cwd.slice(cwd.lastIndexOf(path.sep) + 1);
/* prettier-ignore */
const keywords = [
name.replace(/[@$]?(\w*)\/?.*/, (_$0, $1) => $1),
'vessel',
'front-end',
'back-end',
]
const ownDependencies = ownPackageJsonData.dependencies;
module.exports = {
name,
version: '0.1.0',
description: 'The project created by vessel.',
keywords,
homepage: `https://github.com/mornya/${name}`,
bugs: `https://github.com/mornya/${name}/issues`,
license: 'ISC',
author: '', // init 실행시 입력
private: false,
repository: {
type: 'git',
url: `git+https://github.com/mornya/${name}.git`,
},
main: './dist/index.js',
module: './esm/index.js',
types: './dist', // 빌드되어 나온 *.d.ts에 대한 경로 (./types 아님 주의)
scripts: {
// postinstall, postuninstall은 추가하지 않는다.
// (해당 라이브러리가 애플리케이션에 install 될 경우에도 실행됨)
setup: 'husky && lintest install || exit 0',
prepublishOnly: 'vessel prepublish && vessel build',
login: 'vessel login',
clean: 'vessel clean',
build: 'vessel build',
'build:esm': 'vessel build --esm',
watch: 'vessel build --watch',
format: 'prettier --write --ignore-path .prettierignore ./src ./types',
check: 'vessel check',
init: 'lintest uninstall && lintest export',
lint: 'lintest lint',
'lint:fix': 'lintest lint --fix',
test: 'lintest test',
'test:watch': 'lintest test --watch',
'test:coverage': 'lintest test --coverage',
sonar: 'sonar-scanner',
},
sideEffects: false,
publishConfig: ownPackageJsonData.publishConfig,
files: [
'dist',
'!dist/test', // except whole test directory
'!dist/**/@setup.d.ts', // except test setup defination file
'!dist/**/@setup.js', // except test setup file
'!dist/**/*.test.d.ts', // except test defination files
'!dist/**/*.test.js', // except test files
'esm',
'!esm/test', // except whole test directory
'!esm/**/@setup.d.ts', // except test setup defination file
'!esm/**/@setup.js', // except test setup file
'!esm/**/*.test.d.ts', // except test defination files
'!esm/**/*.test.js', // except test files
'CHANGELOG.md',
'LICENSE',
'README.md',
],
engines: ownPackageJsonData.engines,
dependencies: {},
devDependencies: {
'@lintest/core': ownDependencies['@lintest/core'], // for lintest
'@types/jest': ownDependencies['@types/jest'], // tsconfig.json에서 사용
'@types/node': ownDependencies['@types/node'], // tsconfig.json에서 사용
'@types/react': ownDependencies['@types/react'], // tsconfig.json에서 사용 (for TSX)
'@types/react-dom': ownDependencies['@types/react-dom'], // tsconfig.json에서 사용 (for TSX)
eslint: ownDependencies.eslint, // eslint for lintest
husky: ownDependencies.husky,
'lint-staged': ownDependencies['lint-staged'],
prettier: ownDependencies.prettier,
typescript: ownDependencies.typescript, // typescript
},
'lint-staged': {
'*.{css,scss}': ['prettier --write --ignore-path .prettierignore'],
'*.{ts,tsx}': ['prettier --write --ignore-path .prettierignore', 'lintest check', 'lintest lint'],
},
vessel: {
minVersion: ownPackageJsonData.version,
},
};