forked from entrepreneur-interet-general/opensignauxfaibles
-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(ts): Mise en place du typage dans fonctions JavaScript #3
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
72b5b13
quelques commentaires
adrienjoly 03ebecd
✅ add Makefile with test command
adrienjoly cb2270d
🔴 comment implem of raison_socale => test fails
adrienjoly 38dfb2a
🔴 add raison_sociale.ts + command to transpile it to JS
adrienjoly 2980976
✅ successful transpilation => test passes
adrienjoly a85e47e
fix: respect 2-space indentation in output js file
adrienjoly 0ef0d1e
fix: use prettier instead of sed, to also fix splitting of long lines
adrienjoly 29d63f8
Revert "fix: use prettier instead of sed, to also fix splitting of lo…
adrienjoly 5bc5f5b
fix: prevent `go generate -x` from running loadJS() twice
adrienjoly 32eaae8
feat: transpile on `go generate`
adrienjoly d15fdfd
documentation
adrienjoly 00a90f0
retrait du debug()
adrienjoly b3604bb
reduce footprint of the PR: from makefile to shell script
adrienjoly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
function raison_sociale ( | ||
denomination_unite_legale, | ||
nom_unite_legale, | ||
nom_usage_unite_legale, | ||
prenom1_unite_legale, | ||
prenom2_unite_legale, | ||
prenom3_unite_legale, | ||
prenom4_unite_legale | ||
){ | ||
|
||
if (!nom_usage_unite_legale){ | ||
var nom_usage_unite_legale = '' | ||
} else { | ||
var nom_usage_unite_legale = nom_usage_unite_legale + '/' | ||
} | ||
var raison_sociale = denomination_unite_legale || | ||
(nom_unite_legale + '*' + nom_usage_unite_legale + | ||
prenom1_unite_legale + ' ' + | ||
(prenom2_unite_legale || '') + ' ' + | ||
(prenom3_unite_legale || '') + ' ' + | ||
(prenom4_unite_legale || '') + ' ').trim() + '/' | ||
|
||
return(raison_sociale) | ||
function raison_sociale(denomination_unite_legale, nom_unite_legale, nom_usage_unite_legale, prenom1_unite_legale, prenom2_unite_legale, prenom3_unite_legale, prenom4_unite_legale) { | ||
if (!nom_usage_unite_legale) { | ||
var nom_usage_unite_legale = ""; | ||
} | ||
else { | ||
var nom_usage_unite_legale = nom_usage_unite_legale + "/"; | ||
} | ||
var raison_sociale = denomination_unite_legale || | ||
(nom_unite_legale + | ||
"*" + | ||
nom_usage_unite_legale + | ||
prenom1_unite_legale + | ||
" " + | ||
(prenom2_unite_legale || "") + | ||
" " + | ||
(prenom3_unite_legale || "") + | ||
" " + | ||
(prenom4_unite_legale || "") + | ||
" ").trim() + "/"; | ||
return raison_sociale; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
declare function debug(string); // supported by jsc, to print in stdout | ||
|
||
function raison_sociale( | ||
denomination_unite_legale: string, | ||
nom_unite_legale: string, | ||
nom_usage_unite_legale: string, | ||
prenom1_unite_legale: string, | ||
prenom2_unite_legale: string, | ||
prenom3_unite_legale: string, | ||
prenom4_unite_legale: string | ||
): string { | ||
if (!nom_usage_unite_legale) { | ||
var nom_usage_unite_legale = ""; | ||
} else { | ||
var nom_usage_unite_legale = nom_usage_unite_legale + "/"; | ||
} | ||
var raison_sociale = | ||
denomination_unite_legale || | ||
( | ||
nom_unite_legale + | ||
"*" + | ||
nom_usage_unite_legale + | ||
prenom1_unite_legale + | ||
" " + | ||
(prenom2_unite_legale || "") + | ||
" " + | ||
(prenom3_unite_legale || "") + | ||
" " + | ||
(prenom4_unite_legale || "") + | ||
" " | ||
).trim() + "/"; | ||
|
||
return raison_sociale; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
echo "Transpiling TypeScript files, and generating the jsFunctions.go bundle..." | ||
cd dbmongo/lib/engine | ||
go generate -x | ||
cd - | ||
echo "Running tests against the JS files (including the ones transpiled from TS)..." | ||
cd dbmongo/js/test/ && ./test_common.sh | ||
echo "✅ Tests passed." |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ce fichier étant désormais généré par transpilation TypeScript depuis
raison_sociale.ts
, son formattage est un peu différent.Il serait idéal de ne plus stocker dans git les fichiers JS résultats de transpilation, mais à noter que les tests existants s'appuient sur
jsc
pour tester ces fonctions, et donc sur leur format JS et non TS.