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

Set up TypeScript #19559

Merged
merged 30 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
05e7e81
Init tsconfig.json
emilpaw Aug 26, 2022
a3cd118
Initial config of build npm script
emilpaw Aug 26, 2022
597161e
Configure TS support in eslint
emilpaw Sep 11, 2022
dced0f0
Add include field to tsconfig.json
emilpaw Aug 27, 2022
22ba324
Set allowSyntheticDefaultImports to true
emilpaw Aug 28, 2022
2c44fb8
Fix quotation in .eslintrc.json
emilpaw Aug 29, 2022
47a244c
Add dist folder to .prettierignore
emilpaw Aug 29, 2022
ba674bb
Add dist folder to .eslintignore
emilpaw Aug 29, 2022
ad3a502
Ignore some eslint rules
emilpaw Aug 29, 2022
ba7e067
Add npm script to copy files
emilpaw Sep 11, 2022
4d53612
Add copy-files to build script
emilpaw Sep 11, 2022
7f37c2a
Configure package.json "main" to use build output
emilpaw Sep 11, 2022
354ee0f
Configure package.json "bin" to use build output
emilpaw Sep 11, 2022
19cea6b
Configure package.json "files" to use build output
emilpaw Sep 11, 2022
885f3c0
Copy package.json to dist in build script
emilpaw Sep 11, 2022
6f8a148
Also copy .ejs files to build output
emilpaw Sep 12, 2022
d3adceb
Adapt JHipster generator lookup paths
emilpaw Sep 12, 2022
51792fa
Build before installing in install script
emilpaw Sep 12, 2022
3b8127c
Set module system in tsconfig.json to node16
emilpaw Sep 12, 2022
cd5df79
Pin dependencies
emilpaw Sep 12, 2022
2901e4a
Set build target to ES2022
emilpaw Sep 12, 2022
022cf4d
Ignore more files in copy-files script
emilpaw Sep 13, 2022
93e604a
Add test files to exclude in tsconfig.json
emilpaw Sep 14, 2022
931bc39
Update cli/environment-builder.js
mshima Sep 14, 2022
018aad2
Adapt paths in exports to build output
emilpaw Sep 15, 2022
9da2a7c
Don't build when installing from package
emilpaw Sep 15, 2022
1d8bc65
Don't use build output for `/esm/*` exports
emilpaw Sep 16, 2022
590f9fb
Build project in prepare npm script
emilpaw Sep 16, 2022
76f5592
Don't build before installing
emilpaw Sep 16, 2022
0af077b
Remove commented out tsconfig options
emilpaw Sep 16, 2022
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ docs
test/templates
jdl/bundling
test/fixtures/**
dist
14 changes: 12 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"node": true,
"es2022": true
},
"extends": ["airbnb-base", "plugin:prettier/recommended"],
"plugins": ["mocha", "prettier", "chai-friendly"],
"extends": ["airbnb-base", "plugin:prettier/recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["mocha", "prettier", "chai-friendly", "@typescript-eslint"],
"settings": {
"import/core-modules": ["generator-jhipster", "generator-jhipster/support"]
},
Expand All @@ -23,6 +24,15 @@
"env": {
"mocha": true
}
},
{
"files": ["**/*.{c,m,}js", "**/*.{c,m,}js"],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-this-alias": "off"
}
}
],
"rules": {
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ test/temp/
.project
.settings
test/**/*.png
dist
mshima marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ test/jdl/**/.jhipster/**
**/jdl-core.min.js
**/generated-serialized-grammar.js
test/fixtures/**
dist
12 changes: 11 additions & 1 deletion cli/environment-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,17 @@ module.exports = class EnvironmentBuilder {
*/
_lookupJHipster() {
// Register jhipster generators.
this.env.lookup({ packagePaths: [path.join(__dirname, '..')], lookups: ['generators'] }).forEach(generator => {
const sourceRoot = path.basename(path.join(__dirname, '..'));
let packagePath;
let lookup;
if (sourceRoot === 'generator-jhipster') {
packagePath = path.join(__dirname, '..');
lookup = 'generators';
} else {
packagePath = path.join(__dirname, '../..');
lookup = `${sourceRoot}/generators`;
}
this.env.lookup({ packagePaths: [packagePath], lookups: [lookup] }).forEach(generator => {
// Verify jhipster generators namespace.
assert(
generator.namespace.startsWith(`${CLI_NAME}:`),
Expand Down
Loading