Skip to content

Instantly share code, notes, and snippets.

@gbelot2003
Created February 23, 2023 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbelot2003/212cc64d3d1439beabc2950bf0edac9a to your computer and use it in GitHub Desktop.
Save gbelot2003/212cc64d3d1439beabc2950bf0edac9a to your computer and use it in GitHub Desktop.
simple sh to init typescript and nodejs with jest
#!/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