Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit 2e1b814

Browse files
committed
chore: 🔧 maintenance
Updated package versions and fixed errors that occured
1 parent 2bb4bc7 commit 2e1b814

File tree

23 files changed

+3503
-3542
lines changed

23 files changed

+3503
-3542
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
"contributions": [
4242
"doc"
4343
]
44+
},
45+
{
46+
"login": "lourensdev",
47+
"name": "Lourens de Villiers",
48+
"avatar_url": "https://avatars.githubusercontent.com/u/5746141?v=4",
49+
"profile": "https://github.com/lourensdev",
50+
"contributions": [
51+
"doc"
52+
]
4453
}
4554
],
4655
"contributorsPerLine": 8,

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const prettierOptions = JSON.parse(
66
);
77

88
module.exports = {
9-
extends: ['react-app', 'prettier', 'prettier/react'],
9+
extends: ['react-app', 'prettier'],
1010
plugins: ['prettier'],
1111
rules: {
1212
'prettier/prettier': ['error', prettierOptions],

.husky/commit-msg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
if yarn git-branch-is dev;
5+
then yarn commitlint --edit $1;
6+
fi

.husky/pre-commit

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn checkTs
5+
yarn lint-staged
6+
yarn verify-startingTemplate-changes

.husky/prepare-commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn devmoji -e

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ with a focus on
3737
---
3838

3939
The official [Create React App](https://github.com/facebook/create-react-app) template of the `discontinued` [React Boilerplate](https://github.com/react-boilerplate/react-boilerplate)
40-
![](https://img.shields.io/github/stars/react-boilerplate/react-boilerplate?style=flat)
4140

4241
Start your `create-react-app` projects in seconds with the best, industry-standard tools and practices made ready for you.
4342

4443
**📚 Documentation:** [Gitbook](https://cansahin.gitbook.io/react-boilerplate-cra-template/)
4544

4645
**🎨 Check the example app:** [Demonstrating the features](https://react-boilerplate.github.io/react-boilerplate-cra-template/)
4746

47+
**📂 Browse in VS Code:** [![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/react-boilerplate/react-boilerplate-cra-template)
48+
4849
**📦 Package:** [npm](https://www.npmjs.com/package/cra-template-rb)
4950

5051
![version](https://img.shields.io/npm/v/cra-template-rb)
@@ -133,6 +134,7 @@ But wait... there's more!
133134
<td align="center"><a href="https://github.com/Can-Sahin"><img src="https://avatars2.githubusercontent.com/u/33245689?s=80" width="80px;" alt=""/><br /><sub><b>Can Sahin</b></sub></a><br /><a href="https://github.com/react-boilerplate/react-boilerplate-cra-template/commits?author=Can-Sahin" title="Code">💻</a> <a href="https://github.com/react-boilerplate/react-boilerplate-cra-template/commits?author=Can-Sahin" title="Documentation">📖</a> <a href="#ideas-Can-Sahin" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/react-boilerplate/react-boilerplate-cra-template/pulls?q=is%3Apr+reviewed-by%3ACan-Sahin" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/react-boilerplate/react-boilerplate-cra-template/commits?author=Can-Sahin" title="Tests">⚠️</a></td>
134135
<td align="center"><a href="https://github.com/receptiryaki"><img src="https://avatars0.githubusercontent.com/u/3495307?s=80" width="80px;" alt=""/><br /><sub><b>Recep Tiryaki</b></sub></a><br /><a href="https://github.com/react-boilerplate/react-boilerplate-cra-template/commits?author=receptiryaki" title="Code">💻</a> <a href="#ideas-receptiryaki" title="Ideas, Planning, & Feedback">🤔</a> <a href="#design-receptiryaki" title="Design">🎨</a></td>
135136
<td align="center"><a href="https://github.com/mogsdad"><img src="https://avatars3.githubusercontent.com/u/1707731?s=80" width="80px;" alt=""/><br /><sub><b>David Bingham</b></sub></a><br /><a href="https://github.com/react-boilerplate/react-boilerplate-cra-template/commits?author=mogsdad" title="Documentation">📖</a></td>
137+
<td align="center"><a href="https://github.com/lourensdev"><img src="https://avatars.githubusercontent.com/u/5746141?v=4?s=80" width="80px;" alt=""/><br /><sub><b>Lourens de Villiers</b></sub></a><br /><a href="https://github.com/react-boilerplate/react-boilerplate-cra-template/commits?author=lourensdev" title="Documentation">📖</a></td>
136138
</tr>
137139
</table>
138140

internals/scripts/clean.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import shell from 'shelljs';
22
import path from 'path';
33
import chalk from 'chalk';
4-
import replace from 'replace-in-file';
54
import fs from 'fs';
65
const packageJson = require('../../package.json');
76

@@ -28,31 +27,24 @@ export function cleanAndSetup(opts: Options = {}) {
2827

2928
shell.exec('yarn run prettify -- src/*', { silent: true });
3029

31-
cleanPackageJsonFile();
30+
modifyPackageJsonFile();
3231

3332
shell.echo(
3433
chalk.green('Example app removed and setup completed. Happy Coding!!!'),
3534
);
3635
}
3736

38-
function cleanPackageJsonFile() {
37+
function modifyPackageJsonFile() {
3938
delete packageJson['eslintConfig'];
4039
delete packageJson['dependencies']['replace-in-file'];
4140
delete packageJson['scripts']['cleanAndSetup'];
4241

42+
packageJson['scripts']['prepare'] = 'husky install';
43+
4344
fs.writeFileSync('./package.json', JSON.stringify(packageJson));
4445
shell.exec('yarn run prettify -- package.json', { silent: true });
4546

46-
try {
47-
// Remove explanation from husky to enable it
48-
replace.sync({
49-
files: 'package.json',
50-
from: /"husky\((.*?)\)"/g,
51-
to: '"husky"',
52-
});
53-
} catch (error) {
54-
console.error('Couldnt clean husky:', error);
55-
}
47+
shell.exec('yarn install', { silent: false });
5648
}
5749

5850
(function () {
Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import shell from 'shelljs';
22
import { createNpmPackage, removeNpmPackage } from './create-npm-package';
3-
import replace from 'replace-in-file';
4-
import fs from 'fs';
53

64
interface Options {}
75

@@ -16,28 +14,6 @@ export function createCRA(opts: Options = {}) {
1614
});
1715

1816
removeNpmPackage();
19-
20-
fixHuskyBug();
21-
}
22-
23-
function fixHuskyBug() {
24-
// husky changes directory to the example folder which we don't want
25-
// https://github.com/typicode/husky#monorepos
26-
// https://github.com/typicode/husky/issues/677
27-
const huskyLocalPath = '.git/hooks/husky.local.sh';
28-
if (!fs.existsSync(huskyLocalPath)) {
29-
return;
30-
}
31-
const options = {
32-
files: '.git/hooks/husky.local.sh',
33-
from: /cd.*/g,
34-
to: `cd "."`,
35-
};
36-
try {
37-
replace.sync(options);
38-
} catch (error) {
39-
console.error('Error occurred:', error);
40-
}
4117
}
4218

4319
createCRA();

internals/scripts/create-template-folder.ts

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
11
import shell from 'shelljs';
2+
import replace from 'replace-in-file';
3+
24
import { shellEnableAbortOnFail, shellDisableAbortOnFail } from './utils';
35

46
interface Options {}
57

68
export function crateTemplateFolder(opts: Options = {}) {
79
const abortOnFailEnabled = shellEnableAbortOnFail();
810

9-
const copyToTemplate = (path: string, isRecursive?: boolean) => {
11+
const copyToTemplate = (
12+
path: string,
13+
isRecursive?: boolean,
14+
modifyContent?: {
15+
from: RegExp;
16+
to: string;
17+
},
18+
) => {
19+
const p = `template/${path}`;
1020
if (isRecursive) {
11-
shell.cp('-r', path, `template/${path}`);
21+
shell.cp('-r', path, p);
1222
} else {
13-
shell.cp(path, `template/${path}`);
23+
shell.cp(path, p);
24+
}
25+
if (modifyContent) {
26+
try {
27+
replace.sync({
28+
files: p,
29+
from: modifyContent.from,
30+
to: modifyContent.to,
31+
});
32+
} catch (error) {
33+
console.error('Couldnt modify content:', error);
34+
}
1435
}
1536
};
1637

@@ -19,6 +40,13 @@ export function crateTemplateFolder(opts: Options = {}) {
1940

2041
shell.mkdir('template');
2142

43+
// We want only pre-commit hook with custom script excluded
44+
shell.mkdir('template/.husky');
45+
copyToTemplate('.husky/pre-commit', false, {
46+
from: /yarn verify-startingTemplate-changes/g,
47+
to: '',
48+
});
49+
2250
shell.mkdir('template/internals');
2351
copyToTemplate('internals/generators', true);
2452

internals/startingTemplate/src/locales/translations.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { ConvertedToObjectType, TranslationJsonType } from './types';
44
* This file is seperate from the './i18n.ts' simply to make the Hot Module Replacement work seamlessly.
55
* Your components can import this file in 'messages.ts' files which would ruin the HMR if this isn't a separate module
66
*/
7-
export const translations: ConvertedToObjectType<TranslationJsonType> = {} as any;
7+
export const translations: ConvertedToObjectType<TranslationJsonType> =
8+
{} as any;
89

910
/*
1011
* Converts the static JSON file into an object where keys are identical

0 commit comments

Comments
 (0)