Created
February 23, 2023 06:59
-
-
Save gbelot2003/212cc64d3d1439beabc2950bf0edac9a to your computer and use it in GitHub Desktop.
simple sh to init typescript and nodejs with jest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
npm init -y | |
mkdir src | |
mkdir test | |
#git clone https://gist.github.com/f69ac30736183bafeb56903b818d9f78.git docker | |
npm i typescript | |
npm i -D jest | |
npm i -D ts-jest | |
npm i -D ts-node | |
npm i -D @types/jest | |
### | |
echo "{ | |
\"compilerOptions\":{ | |
\"module\":\"commonjs\" | |
\"noImplicitAny\": true, | |
\"removeComments\": true, | |
\"preserveConstEnums\": true, | |
\"sourceMap\": true, | |
\"target\": \"ES6\", | |
\"esModuleInterop\": true, | |
\"resolveJsonModule\": true | |
\"outDir\": \"dist/\" | |
}, | |
\"include\": [\"src\",\"test\"], | |
\"exclude\": [\"node_modules\"] | |
}" >> tsconfig.json | |
echo "module.export = { | |
preset: 'ts-jest', | |
testEnvironment: node | |
}">>jest.config.js | |
echo "describe('abc', () => { | |
it('cbd', () => { | |
expect(1).toBe(1) | |
}) | |
})" >> test/example.test.ts | |
echo " | |
{ | |
"defaultSeverity": "error", | |
"extends": [ | |
"tslint:recommended" | |
], | |
"jsRules": {}, | |
"rules": { | |
"no-console": "false" | |
}, | |
"rulesDirectory": [] | |
} | |
">>tslint.json | |
echo " | |
/node_modules | |
/dist | |
" >> .gitignore | |
echo " | |
/node_modules | |
/dist | |
" >> .dockerignore | |
#git init |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment