Skip to content

Instantly share code, notes, and snippets.

@nicolasmendonca
Last active April 26, 2021 13:43
Show Gist options
  • Save nicolasmendonca/e9f579230c55a2e0add9bea3b5c681af to your computer and use it in GitHub Desktop.
Save nicolasmendonca/e9f579230c55a2e0add9bea3b5c681af to your computer and use it in GitHub Desktop.
Create react npm package
{
"printWidth": 160,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "always"
}
module.exports = {
presets: [['@babel/preset-env', {targets: {node: 'current'}}], '@babel/preset-typescript'],
};
{
"name": "app-name",
"version": "1.0.0",
"main": "dist/index.js",
"license": "MIT",
"scripts": {
"watch": "tsc --watch",
"build": "rimraf dist && tsc",
"test": "jest"
},
"files": [
"dist"
],
"devDependencies": {
"@babel/core": "^7.13.16",
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
"@babel/preset-env": "^7.13.15",
"@babel/preset-typescript": "^7.13.0",
"babel-jest": "^26.6.3",
"rimraf": "^3.0.2"
},
"jest": {
"modulePathIgnorePatterns": [
"<rootDir>/dist"
]
}
}
// .vscode/settings.json
{
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false
}
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"components/*": ["./src/components/*"], // OPTIONAL: config for resolving absolute paths
"context/*": ["./src/context/*"] // OPTIONAL: config for resolving absolute paths
},
"outDir": "dist",
"module": "esnext",
"lib": ["dom", "esnext"],
"moduleResolution": "node",
"jsx": "react",
"sourceMap": true,
"declaration": true,
"esModuleInterop": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"allowSyntheticDefaultImports": true
},
"include": ["src"],
"exclude": ["node_modules", "dist", "example"]
}
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment