Skip to content

Commit

Permalink
feat(TypeScript): setup TypeScript CLI development
Browse files Browse the repository at this point in the history
BREAKING CHANGE: ship to TypeScript CLI techstack.
  • Loading branch information
sabertazimi committed Aug 8, 2021
1 parent 5dfe27f commit 39b2e49
Show file tree
Hide file tree
Showing 16 changed files with 12,118 additions and 2,658 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scripts

jest.*.js
19 changes: 19 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"env": {
"es2021": true,
"node": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {}
}
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,13 @@ jobs:
- name: Building work
run: |
npm run build --if-present
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: ${{ github.event.head_commit.message }}
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,16 @@ typings/

# next.js build output
.next

.cache/
build
dist

# Mac files
.DS_Store

# Yarn PnP
.pnp/
.pnp.js

.vscode/
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 80,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "always"
}
1 change: 1 addition & 0 deletions .test.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NODE=development
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

[![Code Lines](https://img.shields.io/tokei/lines/github/sabertazimi/bod?style=for-the-badge&logo=visualstudiocode)](https://github.com/sabertazimi/bod)
[![Continuous Integration](https://img.shields.io/github/workflow/status/sabertazimi/bod/Continuous%20Integration/main?style=for-the-badge&logo=github)](https://github.com/sabertazimi/bod/actions/workflows/ci.yml)
[![Jest Coverage](https://raw.githubusercontents.com/sabertazimi/blog/gh-pages/coverage-lines.svg)](https://github.com/sabertazimi/blog/actions/workflows/ci.yml)

Boilerplate CLI App - Create a new project powered by Create React App and @sabertazimi/react-scripts

Expand Down
26 changes: 26 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
const { compilerOptions } = require('./tsconfig.json');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const paths = pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
});

module.exports = {
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['json-summary', 'lcov', 'text', 'clover'],
preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
...paths,
},
testPathIgnorePatterns: [
'node_modules',
'\\.cache',
'<rootDir>.*/build',
'<rootDir>.*/dist',
'<rootDir>.*/coverage',
],
setupFiles: ['<rootDir>/jest.env.setup.js'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
};
8 changes: 8 additions & 0 deletions jest.env.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import path from 'path';
import dotenv from 'dotenv';
import consola from 'consola';

consola.info('DotEnv setup loaded.');
dotenv.config({
path: path.resolve(process.cwd(), '.test.env'),
});
Empty file added jest.setup.js
Empty file.
29 changes: 29 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"include": ["./lib/**/*"],
"exclude": [
"node_modules",
"build",
"dist",
"public",
"coverage",
"__mocks__"
],
"compilerOptions": {
"target": "es6",
"module": "commonJS",
"lib": ["dom", "esnext", "es2020"],
"outDir": "./dist",
"removeComments": true,
"isolatedModules": true,
"strict": true,
"moduleResolution": "node",
"baseUrl": "./",
"paths": {},
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}
File renamed without changes.
Loading

0 comments on commit 39b2e49

Please sign in to comment.