Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate build script to typescript #3423

Open
wants to merge 130 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
2935475
format scripts
JeelRajodiya Nov 16, 2024
2badba7
format using prettier
JeelRajodiya Nov 16, 2024
ad8c426
migrate build-pages
JeelRajodiya Nov 18, 2024
eedff42
add ts-node configuration
JeelRajodiya Nov 18, 2024
df75c79
setup eslint rule to ignore js-doc in script files
JeelRajodiya Nov 18, 2024
7bf568a
Revert "setup eslint rule to ignore js-doc in script files"
JeelRajodiya Nov 18, 2024
4c51a80
move to imports
JeelRajodiya Nov 20, 2024
fbb0e61
rename next config file
JeelRajodiya Nov 20, 2024
fd80ef2
add new path config
JeelRajodiya Nov 20, 2024
f5b38a7
update import names
JeelRajodiya Nov 20, 2024
7b6c3b9
rename utils file to ts
JeelRajodiya Nov 20, 2024
a8c12ea
add types
JeelRajodiya Nov 21, 2024
e2097cc
update import
JeelRajodiya Nov 21, 2024
c01fb85
rename
JeelRajodiya Nov 21, 2024
c7a7247
rename to ts
JeelRajodiya Nov 21, 2024
a49c8a2
rename compose to ts
JeelRajodiya Nov 21, 2024
342432a
rename build docs to ts
JeelRajodiya Nov 21, 2024
9e8efd8
rename build meeting to ts
JeelRajodiya Nov 21, 2024
2e94f4c
rename build newsroom
JeelRajodiya Nov 21, 2024
6b6c4ea
rename build postlist to ts
JeelRajodiya Nov 21, 2024
136bd49
rename build rss
JeelRajodiya Nov 21, 2024
3e1536a
rename build tools to ts
JeelRajodiya Nov 21, 2024
2528190
rename readWriteJSON to ts
JeelRajodiya Nov 21, 2024
34b1cef
add type assertion of json
JeelRajodiya Nov 21, 2024
cecc10e
rename all files to ts
JeelRajodiya Nov 21, 2024
adb15fe
update imports
JeelRajodiya Nov 21, 2024
a05df3f
update file extentions
JeelRajodiya Nov 21, 2024
8cb082b
add ts-node config
JeelRajodiya Nov 21, 2024
b656d31
fix eslint issues. use promise.all instead of await in a loop
JeelRajodiya Nov 22, 2024
40daa1c
Merge branch 'master' into script-migration-2
asyncapi-bot Nov 22, 2024
717135f
fix eslint error
JeelRajodiya Nov 22, 2024
e8e30eb
rename
JeelRajodiya Nov 22, 2024
212e548
rename
JeelRajodiya Nov 22, 2024
652dfc8
Merge branch 'master' into script-migration-2
JeelRajodiya Nov 23, 2024
d3acd81
fix eslint error
JeelRajodiya Nov 23, 2024
09a2fcc
add error type
JeelRajodiya Nov 23, 2024
f5fac70
add new types
JeelRajodiya Nov 23, 2024
2f782e7
add types
JeelRajodiya Nov 23, 2024
1a1f47d
refactor and fix eslint errors
JeelRajodiya Nov 23, 2024
75a53d4
use google apis and add types
JeelRajodiya Nov 23, 2024
74d199f
remove console log
JeelRajodiya Nov 23, 2024
0459723
add specific rules for the script folder
JeelRajodiya Nov 23, 2024
3df75cf
Merge branch 'script-migration-2' of https://github.com/JeelRajodiya/…
JeelRajodiya Nov 23, 2024
24ff781
refactor dir variables
JeelRajodiya Nov 23, 2024
39821b7
add types and refactor it
JeelRajodiya Nov 23, 2024
00ed279
refactor: update eslint rules
JeelRajodiya Nov 24, 2024
8bf03da
reformat document
JeelRajodiya Nov 24, 2024
15ffa2b
update include paths
JeelRajodiya Nov 24, 2024
02e679a
use dynamic import
JeelRajodiya Nov 24, 2024
227995d
reformat eslintrc
JeelRajodiya Nov 26, 2024
be73210
Merge branch 'master' into script-migration-2
JeelRajodiya Nov 27, 2024
599ab9e
update rules
JeelRajodiya Nov 27, 2024
e71fcba
change tabs to spaces
JeelRajodiya Nov 27, 2024
851d1af
update ts node config
JeelRajodiya Nov 27, 2024
81d6cfc
migrate tools scripts
JeelRajodiya Nov 27, 2024
c5b5c9f
refactor __dirname variable
JeelRajodiya Nov 27, 2024
a42104e
refactor function in build-rss
JeelRajodiya Nov 27, 2024
add1c28
add new package type
JeelRajodiya Nov 27, 2024
b776dc7
Added error handling for undefined types
JeelRajodiya Nov 27, 2024
5b82b5d
add types
JeelRajodiya Nov 27, 2024
0916549
refactor adopter/index.ts
JeelRajodiya Nov 27, 2024
b294a6a
Merge branch 'master' into script-migration-2
JeelRajodiya Nov 29, 2024
93ff413
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 12, 2024
ba0a99a
use tsx instead of ts-node
JeelRajodiya Dec 12, 2024
c76a556
add types for build RSS
JeelRajodiya Dec 12, 2024
31103fe
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 14, 2024
5f7c9bb
revert name
JeelRajodiya Dec 14, 2024
5097c35
fix name
JeelRajodiya Dec 14, 2024
65a1873
fix name
JeelRajodiya Dec 14, 2024
a699313
fix name
JeelRajodiya Dec 14, 2024
7942128
Original name
JeelRajodiya Dec 14, 2024
bdc0ad0
Rename next-i18next.config.js to next-i18next.config.cjs
JeelRajodiya Dec 14, 2024
b87f48a
migrate build-post-list.ts
JeelRajodiya Dec 14, 2024
63a4ddd
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 14, 2024
647fa16
use old package-lock file
JeelRajodiya Dec 14, 2024
6f8bb5d
No code changes made
JeelRajodiya Dec 14, 2024
cc3d228
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 15, 2024
71e9581
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 16, 2024
32bf9bd
migrate check-markdown.ts
JeelRajodiya Dec 17, 2024
b03f8df
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 17, 2024
aa8cdb3
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 18, 2024
2fdab4c
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 19, 2024
1c9828e
feat: add TypeScript types for tools and categories
JeelRajodiya Dec 19, 2024
6c129b6
update type
JeelRajodiya Dec 20, 2024
6d6c179
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 20, 2024
df5aaae
Merge branch 'script-migration-2' of https://github.com/JeelRajodiya/…
JeelRajodiya Dec 20, 2024
fca9e36
feat: enhance type safety in combine-tools script with TypeScript types
JeelRajodiya Dec 20, 2024
6a26d06
chore: disable eslint rule for no-await-in-loop in combine-tools script
JeelRajodiya Dec 20, 2024
1541bc7
feat: improve type safety and refactor dashboard script functions
JeelRajodiya Dec 21, 2024
1237899
feat: add TypeScript types for dashboard script and enhance type safety
JeelRajodiya Dec 21, 2024
5268fe2
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 21, 2024
324e278
No code changes detected.
JeelRajodiya Dec 21, 2024
ad7268c
update package json
JeelRajodiya Dec 21, 2024
1ec94b3
refactor: remove console log from buildPostList function
JeelRajodiya Dec 21, 2024
4bf9c1b
fix: update workflow to conditionally install dependencies based on p…
JeelRajodiya Dec 21, 2024
f377a66
chore: remove unused PowerShell script and TypeScript type definitions
JeelRajodiya Dec 21, 2024
b96f142
refactor: add type annotations to capitalizeJsxTags function parameters
JeelRajodiya Dec 21, 2024
5bb3fde
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 23, 2024
a08e8fb
refactor: migrate build-docs
JeelRajodiya Dec 24, 2024
9059384
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 24, 2024
7007d2f
refactor: remove unused URL validation function from check-markdown.ts
JeelRajodiya Dec 24, 2024
79fc28e
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 26, 2024
5bba79d
chore: update Jest configuration and dependencies for TypeScript support
JeelRajodiya Dec 26, 2024
84fa86c
chore: enable ES module support in Jest configuration
JeelRajodiya Dec 26, 2024
7e49ca8
chore: update Jest configuration for TypeScript file handling and cov…
JeelRajodiya Dec 26, 2024
4820f6a
chore: update Jest configuration to set test environment to Node
JeelRajodiya Dec 26, 2024
e1c67c5
chore: enable ES module support in ts-jest transformer
JeelRajodiya Dec 26, 2024
15f3aab
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 27, 2024
98bf565
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 27, 2024
c93d5a1
refactor: update case studies import to default export and improve ty…
JeelRajodiya Dec 28, 2024
fb22081
refactor: update Jest configuration for improved TypeScript support
JeelRajodiya Dec 28, 2024
7ecfba4
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 28, 2024
470cc18
refactor: change imports to default exports for consistency
JeelRajodiya Dec 28, 2024
6e0ef28
refactor: update test imports to remove file extensions for consistency
JeelRajodiya Dec 28, 2024
7a3730d
refactor: simplify Jest transform configuration for TypeScript files
JeelRajodiya Dec 28, 2024
7ef191a
refactor: update dynamic import for manual tools and mock axios in tests
JeelRajodiya Dec 28, 2024
b3476a5
refactor: update path resolution to use fileURLToPath for better comp…
JeelRajodiya Dec 29, 2024
9590dd1
refactor: update path resolution to use fileURLToPath for improved co…
JeelRajodiya Dec 29, 2024
d6b0e2a
refactor: improve optional chaining usage and enhance tool validation…
JeelRajodiya Dec 29, 2024
c0e918f
refactor: enable ESM support in ts-jest transform configuration
JeelRajodiya Dec 29, 2024
d142cd0
refactor: update ts-jest configuration to use ESNext module in tsconfig
JeelRajodiya Dec 29, 2024
d15c741
refactor: add support for ESM by updating Jest configuration and Type…
JeelRajodiya Dec 29, 2024
279237c
refactor: enhance Jest configuration for ESM support and improve modu…
JeelRajodiya Dec 29, 2024
0b68337
refactor: update Jest configuration to use ES2022 module and target
JeelRajodiya Dec 29, 2024
15c0759
Merge branch 'master' into script-migration-2
JeelRajodiya Dec 30, 2024
76dee32
refactor: simplify JSON import in build-rss and remove debug log in c…
JeelRajodiya Dec 30, 2024
a220216
Revert "refactor: improve optional chaining usage and enhance tool va…
JeelRajodiya Dec 30, 2024
e974218
refactor: update type definitions for discussions and improve null ha…
JeelRajodiya Dec 30, 2024
4215898
refactor: improve optional chaining for language filter in getFinalTo…
JeelRajodiya Dec 30, 2024
74a6afa
refactor: clean up code formatting and improve consistency across uti…
JeelRajodiya Dec 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .eslintrc
JeelRajodiya marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,14 @@
"rules": {
"max-len": "off"
}
},
{
"files": ["scripts/**/*"],
"rules": {
"import/no-extraneous-dependencies": "off",
"no-console": "off",
"require-jsdoc":"off"
}
Comment on lines +319 to +322
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you added these three rules for scripts folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import/no-extraneous-dependencies: The Scripts are using some of the dependencies which are listed in DevDependencies in package.json file. Since the scripts are ran in the server, it does not matter where the dependencies are listed in package.json file.

This error was occuring in the scripts/compose.ts file

image

no-console: We have several console.log statements in the scripts, which are necessary for build scripts. So I have removed the eslint warning since it is evident for the build scripts to have console statements in them (view your old comment)

require-jsdoc: We are migrating the files to typescript, I have removed the jsdoc rule because it would be irrelevant to keep jsdoc in typescript files.

}
]
}
}
5 changes: 3 additions & 2 deletions .github/workflows/if-nodejs-pr-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '${{ steps.nodeversion.outputs.version }}'
- name: Install dependencies
run: npm ci
- if: steps.packagejson.outputs.exists == 'true'
name: Install dependencies
run: npm install
Comment on lines +70 to +72
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Consider using npm ci instead of npm install

The change from npm ci to npm install might lead to inconsistent dependency installations across different environments. npm ci is preferred in CI environments as it:

  • Uses package-lock.json exclusively
  • Is more reliable for reproducible builds
  • Removes node_modules before installation
- run: npm install
+ run: npm ci
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- if: steps.packagejson.outputs.exists == 'true'
name: Install dependencies
run: npm install
- if: steps.packagejson.outputs.exists == 'true'
name: Install dependencies
run: npm ci

- if: steps.packagejson.outputs.exists == 'true'
name: Test
run: npm test --if-present
Expand Down
29 changes: 29 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
verbose: true,
collectCoverage: true,
coverageReporters: ['text', 'lcov', 'json-summary'],
coverageDirectory: 'coverage',
collectCoverageFrom: ['scripts/**/*.ts'],
coveragePathIgnorePatterns: ['scripts/compose.ts', 'scripts/tools/categorylist.ts', 'scripts/tools/tags-color.ts'],
JeelRajodiya marked this conversation as resolved.
Show resolved Hide resolved
testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
tsconfig: {
module: 'ES2022',
moduleResolution: 'node',
resolveJsonModule: true,
esModuleInterop: true,
target: 'ES2024'
}
}
],
'^.+\\.json$': ['ts-jest', { useESM: true }]
},
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1'
}
};
10 changes: 0 additions & 10 deletions jest.config.js

This file was deleted.

13 changes: 13 additions & 0 deletions next-i18next.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// The file is required to be named next-i18next.config.cjs so we can use it in next.config.js.
// https://github.com/i18next/next-i18next/issues/2185#issuecomment-1618307556
process.env.I18NEXT_DEFAULT_CONFIG_PATH = './next-i18next.config.cjs';

module.exports = {
i18n: {
locales: ['en', 'de'],
defaultLocale: 'en',
namespaces: ['landing-page', 'common', 'tools'],
defaultNamespace: 'landing-page',
react: { useSuspense: false } // this line
}
};
10 changes: 0 additions & 10 deletions next-i18next.config.js

This file was deleted.

Loading
Loading