Skip to content

Commit

Permalink
feat: init [#1]
Browse files Browse the repository at this point in the history
  • Loading branch information
d3p1 committed Oct 18, 2023
0 parents commit 1f4e42d
Show file tree
Hide file tree
Showing 20 changed files with 11,512 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@d3p1/commitlint-config"]
}
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* @description Dev container configuration
* @author C. M. de Picciotto <d3p1@d3p1.dev> (https://d3p1.dev/)
*/
{
"name": "Node.js",
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-20-bullseye",
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode",
"rohit-gohri.format-code-action",
"dbaeumer.vscode-eslint",
"formulahendry.auto-rename-tag",
"mikestead.dotenv",
"usernamehw.errorlens",
"xabikos.JavaScriptSnippets",
"formulahendry.auto-close-tag",
"streetsidesoftware.code-spell-checker",
"github.vscode-github-actions",
"eamodio.gitlens",
"bierner.markdown-preview-github-styles",
"DavidAnson.vscode-markdownlint",
"christian-kohler.npm-intellisense",
"yoavbls.pretty-ts-errors"
],
"settings": {
"editor.rulers": [80],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false,
"editor.codeActionsOnSave": [
"source.formatDocument",
"source.fixAll.eslint"
]
}
}
}
}
23 changes: 23 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-var-requires": "off"
}
}
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##
# @description Build automatization
# @author C. M. de Picciotto <d3p1@d3p1.dev> (https://d3p1.dev/)
##
name: build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Execute build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install
id: npm-ci
run: npm ci

- name: Lint
run: npm run refactor

- name: Test
run: npm run test

- name: Build
run: npm run build
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##
# @description Release automatization
# @author C. M. de Picciotto <d3p1@d3p1.dev> (https://d3p1.dev/)
##
name: release

on:
workflow_run:
workflows: [build]
types: [completed]
workflow_dispatch:

permissions:
contents: read

jobs:
release:
name: Dispatch release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

permissions:
contents: write
issues: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate release
uses: d3p1/semantic-releasify@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
##
# @description Git ignore
# @author C. M. de Picciotto <d3p1@d3p1.dev> (https://d3p1.dev/)
##
node_modules/
dist/
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 80,
"semi": false,
"singleQuote": true,
"quoteProps": "consistent",
"bracketSpacing": false,
"arrowParens": "always"
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Cristian Marcelo de Picciotto

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<div align=center>

# [CLIENT TS TEMPLATE]

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)
[![build](https://github.com/d3p1/app-ts-template/actions/workflows/build.yml/badge.svg)](https://github.com/d3p1/app-ts-template/actions/workflows/build.yml)
[![release](https://github.com/d3p1/app-ts-template/actions/workflows/release.yml/badge.svg)](https://github.com/d3p1/app-ts-template/actions/workflows/release.yml)

</div>

## Introduction

A [repository aimed at serving as a template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) to implement projects using [TypeScript](https://www.typescriptlang.org/) on the client side, providing basic configurations for using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), [Prettier](https://prettier.io/), [ESLint](https://eslint.org/), and [Jest](https://jestjs.io/). It also includes a setup for use within a [Dev Container](https://code.visualstudio.com/docs/devcontainers/containers), featuring optimized [VSCode](https://code.visualstudio.com/) configurations for working with these technologies. Lastly, it incorporates [GitHub Actions](https://github.com/features/actions) that automate the project [build](./.github/workflows/build.yml) and [release](./.github/workflows/release.yml).

> **Note**
> This [template repository]((https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template)) extends from [this one](https://github.com/d3p1/client-ts-template). It adds [webpack](https://webpack.js.org/) with [Sass](https://sass-lang.com/) to be able to create a more robust application
## Usage

In order to proceed with using this template, you need to:

1. [Create a repository from this template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template)
2. Adjust the following values in the default [`package.json`](./package.json):
- `name`
- `version` (it's recommended to use `0.0.0` so that the [release workflow](./.github/workflows/release.yml) can adjust it)
- `description`
- `private`
- `repository.url`
- `keywords`
- `bugs.url`
- `homepage`
- `license` (if necessary)
3. Remove the [`CHANGELOG.md`](./CHANGELOG.md)
4. Modify the [`LICENSE`](./LICENSE) file (if necessary)
5. Edit the [`README.md`](./README.md). Update texts and create new badges for [build workflow](./.github/workflows/build.yml) and [release workflow](./.github/workflows/release.yml) since they currently point to the template repository
6. Run `npm install` to install the dependencies
7. You can now start working in `./src` using the files there as templates and/or creating new ones

> **Note**
> Enable [code scanning with CodeQL](https://docs.github.com/en/code-security/code-scanning/enabling-code-scanning/configuring-default-setup-for-code-scanning) and add a badge to [README.md](./README.md)
> **Warning**
> The [release workflow](./.github/workflows/release.yml) uses a bot that needs to have write access to the repository to create new releases, tags, and the `CHANGELOG.md`. If you are using a personal repository, to allow the bot to work smoothly, you shouldn't protect the branch. If you are using an organization's repository, [you can protect the branch and add the bot as an owner to enable it to perform its tasks](https://github.com/semantic-release/github/issues/175#issuecomment-484964034))
## Changelog

Detailed changes for each release are documented in [`CHANGELOG.md`](./CHANGELOG.md).

## License

This work is published under [MIT License](./LICENSE).

## Author

Always happy to receive a greeting on:

- [LinkedIn](https://www.linkedin.com/in/cristian-marcelo-de-picciotto/)
- [Web](https://d3p1.dev/)
6 changes: 6 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"clearMocks": true,
"testEnvironment": "jsdom",
"roots": ["<rootDir>/src"],
"preset": "ts-jest/presets/default-esm"
}
Loading

0 comments on commit 1f4e42d

Please sign in to comment.