Skip to content

Commit f9b960f

Browse files
feat: migrate to typescript (#63)
# Description This pr migrates the project to Typescript with correct typings, build process and keeping the tests running ## Issue Ticket Number Fixes ## Type of change <!-- Please select all options that are applicable. --> - [X] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # Checklist <!-- These must all be followed and checked. --> - [X] I have followed the contributing guidelines of this project as mentioned in [CONTRIBUTING.md](/CONTRIBUTING.md) - [X] I have created an [issue](https://github.com/colbyfayock/netlify-plugin-cloudinary/issues) ticket for this PR - [X] I have checked to ensure there aren't other open [Pull Requests](https://github.com/colbyfayock/netlify-plugin-cloudinary/pulls) for the same update/change? - [X] I have performed a self-review of my own code - [X] I have run tests locally to ensure they all pass - [X] I have commented my code, particularly in hard-to-understand areas - [X] I have made corresponding changes needed to the documentation --------- Co-authored-by: Colby Fayock <[email protected]>
1 parent 6fda2df commit f9b960f

40 files changed

+6403
-2685
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
demo
2+
node_modules

.eslintrc.cjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2022: true,
5+
},
6+
parser: '@typescript-eslint/parser',
7+
parserOptions: {
8+
ecmaVersion: 'latest',
9+
sourceType: 'module',
10+
},
11+
plugins: ['@typescript-eslint'],
12+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
13+
overrides: [
14+
{
15+
env: {
16+
node: true,
17+
},
18+
files: ['.eslintrc.{js,cjs}'],
19+
},
20+
],
21+
rules: {
22+
'@typescript-eslint/no-unused-vars': 'error',
23+
// to enforce using type for object type definitions, can be type or interface
24+
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
25+
},
26+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
.env
33
# Local Netlify folder
44
.netlify
5-
_next
5+
_next
6+
dist

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
demo
2+
node_modules

.prettierrc

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

.setTestEnvVars.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
process.env.CLOUDINARY_CLOUD_NAME="testcloud"
2+
process.env.CLOUDINARY_API_KEY="791111111111111"
3+
process.env.CLOUDINARY_API_SECRET="B1CoYVwbgSZ-Bpk_Firy8jB2480"
4+
process.env.CLOUDINARY_API_SECRET="ThisIsTheSe-Cre_tAPIKEY_800"
5+
process.env.NETLIFY_HOST="test.netlify.app"

demo/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"extends": ["next/core-web-vitals", "prettier"]
33
}

demo/.prettierrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
semi: true,
3+
singleQuote: true,
4+
trailingComma: 'all',
5+
};

demo/app/app/page.jsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

demo/app/app/page.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import '../../styles/globals.css';
2+
import Image from 'next/image';
3+
import styles from '../../styles/Home.module.css';
4+
5+
import images from '../../data/images.json';
6+
7+
export default function Home() {
8+
return (
9+
<div className={styles.container}>
10+
<main className={styles.main}>
11+
<h1 className={styles.title}>Cloudinary Netlify Plugin</h1>
12+
13+
<ul className={styles.grid}>
14+
{images.map((image) => {
15+
return (
16+
<li key={image.src}>
17+
<img
18+
src={image.src}
19+
width={image.width}
20+
height={image.height}
21+
alt={image.title}
22+
/>
23+
</li>
24+
);
25+
})}
26+
</ul>
27+
28+
<ul className={styles.grid}>
29+
{images.map((image) => {
30+
return (
31+
<li key={image.src}>
32+
<Image
33+
src={image.src}
34+
width={image.width}
35+
height={image.height}
36+
alt={image.title}
37+
/>
38+
</li>
39+
);
40+
})}
41+
</ul>
42+
</main>
43+
</div>
44+
);
45+
}

0 commit comments

Comments
 (0)