Skip to content

Commit 0cfac45

Browse files
authored
Initial commit
0 parents  commit 0cfac45

File tree

13 files changed

+12028
-0
lines changed

13 files changed

+12028
-0
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [kaiosilveira]

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: 'npm' # See documentation for possible values
9+
directory: '/' # Location of package manifests
10+
schedule:
11+
interval: 'weekly'

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
Integration:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check out the repository
13+
uses: actions/checkout@v4
14+
15+
- name: Use Node.js 18.17.1
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 18.17.1
19+
cache: 'npm'
20+
21+
- name: Generate .npmrc
22+
run: |
23+
echo "registry=https://registry.npmjs.org/" >> .npmrc
24+
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
25+
26+
- name: Install dependencies
27+
run: npm install
28+
29+
- name: Run unit tests
30+
run: npm run test

.gitignore

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@kaiosilveira:registry=https://npm.pkg.github.com

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"semi": true,
4+
"printWidth": 100,
5+
"arrowParens": "avoid"
6+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Kaio Silveira
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
[![Continuous Integration](https://github.com/kaiosilveira/refactoring-catalog-template/actions/workflows/ci.yml/badge.svg)](https://github.com/kaiosilveira/refactoring-catalog-template/actions/workflows/ci.yml)
2+
3+
# Refactoring catalog repository template
4+
5+
This is a quick template to help me get a new refactoring repo going.
6+
7+
## Things to do after creating a repo off of this template
8+
9+
1. Run `GITHUB_TOKEN=$(gh auth token) yarn tools:cli prepare-repository -r <repo_name>`. It will:
10+
11+
- Update the `README.md` file with the actual repository name, CI badge, and commit history link
12+
- Update `package.json` with the repository's name and remote URL
13+
- Update the repo's homepage on GitHub with:
14+
- A description
15+
- A website link to https://github.com/kaiosilveira/refactoring
16+
- The following labels: javascript, refactoring, [REPOSITORY_NAME]
17+
18+
2. Replace the lorem ipsum text sections below with actual text
19+
20+
## Useful commands
21+
22+
- Generate markdown containing a diff with patch information based on a range of commits:
23+
24+
```bash
25+
yarn tools:cli generate-diff -f <first_commit_sha> -l <last_commit_sha>
26+
```
27+
28+
- To generate the commit history table for the last section, including the correct links:
29+
30+
```bash
31+
yarn tools:cli generate-cmt-table -r [REPOSITORY_NAME]
32+
```
33+
34+
---
35+
36+
ℹ️ _This repository is part of my Refactoring catalog based on Fowler's book with the same title. Please see [kaiosilveira/refactoring](https://github.com/kaiosilveira/refactoring) for more details._
37+
38+
---
39+
40+
# Refactoring name
41+
42+
**Formerly: Old name**
43+
44+
<table>
45+
<thead>
46+
<th>Before</th>
47+
<th>After</th>
48+
</thead>
49+
<tbody>
50+
<tr>
51+
<td>
52+
53+
```javascript
54+
result = initial.code;
55+
```
56+
57+
</td>
58+
59+
<td>
60+
61+
```javascript
62+
result = newCode();
63+
64+
function newCode() {
65+
return 'new code';
66+
}
67+
```
68+
69+
</td>
70+
</tr>
71+
</tbody>
72+
</table>
73+
74+
**Inverse of: [Another refactoring](https://github.com/kaiosilveira/refactoring)**
75+
76+
**Refactoring introduction and motivation** dolore sunt deserunt proident enim excepteur et cillum duis velit dolor. Aute proident laborum officia velit culpa enim occaecat officia sunt aute labore id anim minim. Eu minim esse eiusmod enim nulla Lorem. Enim velit in minim anim anim ad duis aute ipsum voluptate do nulla. Ad tempor sint dolore et ullamco aute nulla irure sunt commodo nulla aliquip.
77+
78+
## Working example
79+
80+
**Working example general explanation** proident reprehenderit mollit non voluptate ea aliquip ad ipsum anim veniam non nostrud. Cupidatat labore occaecat labore veniam incididunt pariatur elit officia. Aute nisi in nulla non dolor ullamco ut dolore do irure sit nulla incididunt enim. Cupidatat aliquip minim culpa enim. Fugiat occaecat qui nostrud nostrud eu exercitation Lorem pariatur fugiat ea consectetur pariatur irure. Officia dolore veniam duis duis eu eiusmod cupidatat laboris duis ad proident adipisicing. Minim veniam consectetur ut deserunt fugiat id incididunt reprehenderit.
81+
82+
### Test suite
83+
84+
Occaecat et incididunt aliquip ex id dolore. Et excepteur et ea aute culpa fugiat consectetur veniam aliqua. Adipisicing amet reprehenderit elit qui.
85+
86+
```javascript
87+
describe('functionBeingRefactored', () => {
88+
it('should work', () => {
89+
expect(0).toEqual(1);
90+
});
91+
});
92+
```
93+
94+
Magna ut tempor et ut elit culpa id minim Lorem aliqua laboris aliqua dolor. Irure mollit ad in et enim consequat cillum voluptate et amet esse. Fugiat incididunt ea nulla cupidatat magna enim adipisicing consequat aliquip commodo elit et. Mollit aute irure consequat sunt. Dolor consequat elit voluptate aute duis qui eu do veniam laborum elit quis.
95+
96+
### Steps
97+
98+
**Step 1 description** mollit eu nulla mollit irure sint proident sint ipsum deserunt ad consectetur laborum incididunt aliqua. Officia occaecat deserunt in aute veniam sunt ad fugiat culpa sunt velit nulla. Pariatur anim sit minim sit duis mollit.
99+
100+
```diff
101+
diff --git a/src/price-order/index.js b/src/price-order/index.js
102+
@@ -3,6 +3,11 @@
103+
-module.exports = old;
104+
+module.exports = new;
105+
```
106+
107+
**Step n description** mollit eu nulla mollit irure sint proident sint ipsum deserunt ad consectetur laborum incididunt aliqua. Officia occaecat deserunt in aute veniam sunt ad fugiat culpa sunt velit nulla. Pariatur anim sit minim sit duis mollit.
108+
109+
```diff
110+
diff --git a/src/price-order/index.js b/src/price-order/index.js
111+
@@ -3,6 +3,11 @@
112+
-module.exports = old;
113+
+module.exports = new;
114+
```
115+
116+
And that's it!
117+
118+
### Commit history
119+
120+
Below there's the commit history for the steps detailed above.
121+
122+
| Commit SHA | Message |
123+
| --------------------------------------------------------------------------- | ------------------------ |
124+
| [cmt-sha-1](https://github.com/kaiosilveira/[REPOSITORY_NAME]/commit-SHA-1) | description of commit #1 |
125+
| [cmt-sha-2](https://github.com/kaiosilveira/[REPOSITORY_NAME]/commit-SHA-2) | description of commit #2 |
126+
| [cmt-sha-n](https://github.com/kaiosilveira/[REPOSITORY_NAME]/commit-SHA-n) | description of commit #n |
127+
128+
For the full commit history for this project, check the [Commit History tab](https://github.com/kaiosilveira/[REPOSITORY_NAME]/commits/main).

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
/* config here */
3+
}

0 commit comments

Comments
 (0)