From 72b5b1329d89dd96b496bc34b899fc4842dd67bf Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Fri, 17 Apr 2020 14:37:17 +0200 Subject: [PATCH 01/13] quelques commentaires --- dbmongo/js/reduce.algo2/map.js | 4 ++-- dbmongo/lib/engine/reduce.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dbmongo/js/reduce.algo2/map.js b/dbmongo/js/reduce.algo2/map.js index 534c64fc6..66a47b0d1 100644 --- a/dbmongo/js/reduce.algo2/map.js +++ b/dbmongo/js/reduce.algo2/map.js @@ -3,8 +3,8 @@ function map () { if (v.scope == "etablissement") { let o = f.outputs(v, serie_periode) - let output_array = o[0] - let output_indexed = o[1] + let output_array = o[0] // [ OutputValue ] // in chronological order + let output_indexed = o[1] // { Periode -> OutputValue } // OutputValue: cf outputs() // Les periodes qui nous interessent, triées var periodes = Object.keys(output_indexed).sort((a,b) => (a >= b)) diff --git a/dbmongo/lib/engine/reduce.go b/dbmongo/lib/engine/reduce.go index 6c8d30ca1..8ee347047 100644 --- a/dbmongo/lib/engine/reduce.go +++ b/dbmongo/lib/engine/reduce.go @@ -96,6 +96,7 @@ func Reduce(batch AdminBatch, algo string, types []string) error { dbTemp := "reduce" + strconv.Itoa(i) functions := scope["f"].(map[string]bson.JavaScript) + // Injection des fonctions JavaScript pour exécution par MongoDB job := &mgo.MapReduce{ Map: functions["map"].Code, Reduce: functions["reduce"].Code, @@ -178,7 +179,7 @@ func reduceFinalAggregation(tempDatabase *mgo.Database, tempCollection, outDatab pipeline = append(pipeline, []bson.M{ bson.M{ "$unwind": bson.M{ - "path": "$value", + "path": "$value", "preserveNullAndEmptyArrays": false, }, }, From 03ebecd6b45f14b3131f04e94ab18a8986ca9feb Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Fri, 17 Apr 2020 14:55:48 +0200 Subject: [PATCH 02/13] =?UTF-8?q?=E2=9C=85=20add=20Makefile=20with=20test?= =?UTF-8?q?=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..1ffe351be --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +.DEFAULT_GOAL := help + +test: ## Run some tests + @cd dbmongo/js/test/ && ./test_common.sh + @echo "✅ Tests passed." + +help: ## This help. + @echo 'Available targets:' + @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) + +.PHONY: test help From cb2270d366701ad014802139360b2af981e8c004 Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Fri, 17 Apr 2020 14:56:05 +0200 Subject: [PATCH 03/13] =?UTF-8?q?=F0=9F=94=B4=20comment=20implem=20of=20ra?= =?UTF-8?q?ison=5Fsocale=20=3D>=20test=20fails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbmongo/js/common/raison_sociale.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbmongo/js/common/raison_sociale.js b/dbmongo/js/common/raison_sociale.js index 503429a82..cfb3057bc 100644 --- a/dbmongo/js/common/raison_sociale.js +++ b/dbmongo/js/common/raison_sociale.js @@ -7,7 +7,7 @@ function raison_sociale ( prenom3_unite_legale, prenom4_unite_legale ){ - +/* if (!nom_usage_unite_legale){ var nom_usage_unite_legale = '' } else { @@ -21,4 +21,5 @@ function raison_sociale ( (prenom4_unite_legale || '') + ' ').trim() + '/' return(raison_sociale) +*/ } From 38dfb2a827d6522af56ed5dc4c6065d8d485c7e9 Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Fri, 17 Apr 2020 15:08:37 +0200 Subject: [PATCH 04/13] =?UTF-8?q?=F0=9F=94=B4=20add=20raison=5Fsociale.ts?= =?UTF-8?q?=20+=20command=20to=20transpile=20it=20to=20JS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 1 + dbmongo/js/common/raison_sociale.ts | 35 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 dbmongo/js/common/raison_sociale.ts diff --git a/Makefile b/Makefile index 1ffe351be..1aa8859c7 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .DEFAULT_GOAL := help test: ## Run some tests + @npx typescript dbmongo/js/common/raison_sociale.ts @cd dbmongo/js/test/ && ./test_common.sh @echo "✅ Tests passed." diff --git a/dbmongo/js/common/raison_sociale.ts b/dbmongo/js/common/raison_sociale.ts new file mode 100644 index 000000000..35a09588f --- /dev/null +++ b/dbmongo/js/common/raison_sociale.ts @@ -0,0 +1,35 @@ +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 { + debug('running raison_sociale()'); + 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; +} From 2980976270d1d0ba18cf132fbfa1e1da207c1ef4 Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Fri, 17 Apr 2020 15:09:04 +0200 Subject: [PATCH 05/13] =?UTF-8?q?=E2=9C=85=20successful=20transpilation=20?= =?UTF-8?q?=3D>=20test=20passes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbmongo/js/common/raison_sociale.js | 45 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/dbmongo/js/common/raison_sociale.js b/dbmongo/js/common/raison_sociale.js index cfb3057bc..e65874364 100644 --- a/dbmongo/js/common/raison_sociale.js +++ b/dbmongo/js/common/raison_sociale.js @@ -1,25 +1,22 @@ -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) { + debug('running raison_sociale()'); + 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; } From a85e47ebf3a3778b05391422b56c9f8c122e5d07 Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Fri, 17 Apr 2020 15:20:58 +0200 Subject: [PATCH 06/13] fix: respect 2-space indentation in output js file --- Makefile | 3 ++- dbmongo/js/common/raison_sociale.js | 40 ++++++++++++++--------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 1aa8859c7..1e79999d1 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ .DEFAULT_GOAL := help test: ## Run some tests - @npx typescript dbmongo/js/common/raison_sociale.ts + @npx typescript dbmongo/js/common/raison_sociale.ts # output: dbmongo/js/common/raison_sociale.js + @sed -i '' 's/ / /g' dbmongo/js/common/raison_sociale.js @cd dbmongo/js/test/ && ./test_common.sh @echo "✅ Tests passed." diff --git a/dbmongo/js/common/raison_sociale.js b/dbmongo/js/common/raison_sociale.js index e65874364..aec907bfb 100644 --- a/dbmongo/js/common/raison_sociale.js +++ b/dbmongo/js/common/raison_sociale.js @@ -1,22 +1,22 @@ 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) { - debug('running raison_sociale()'); - 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; + debug('running raison_sociale()'); + 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; } From 0ef0d1e336273955e7f808ae25553e15bb2dc048 Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Fri, 17 Apr 2020 15:23:41 +0200 Subject: [PATCH 07/13] fix: use prettier instead of sed, to also fix splitting of long lines --- Makefile | 2 +- dbmongo/js/common/raison_sociale.js | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 1e79999d1..a2ab0fc15 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ test: ## Run some tests @npx typescript dbmongo/js/common/raison_sociale.ts # output: dbmongo/js/common/raison_sociale.js - @sed -i '' 's/ / /g' dbmongo/js/common/raison_sociale.js + @npx prettier --write dbmongo/js/common/raison_sociale.js @cd dbmongo/js/test/ && ./test_common.sh @echo "✅ Tests passed." diff --git a/dbmongo/js/common/raison_sociale.js b/dbmongo/js/common/raison_sociale.js index aec907bfb..fc414d084 100644 --- a/dbmongo/js/common/raison_sociale.js +++ b/dbmongo/js/common/raison_sociale.js @@ -1,13 +1,22 @@ -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) { - debug('running 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 +) { + debug("running raison_sociale()"); if (!nom_usage_unite_legale) { var nom_usage_unite_legale = ""; - } - else { + } else { var nom_usage_unite_legale = nom_usage_unite_legale + "/"; } - var raison_sociale = denomination_unite_legale || - (nom_unite_legale + + var raison_sociale = + denomination_unite_legale || + ( + nom_unite_legale + "*" + nom_usage_unite_legale + prenom1_unite_legale + @@ -17,6 +26,7 @@ function raison_sociale(denomination_unite_legale, nom_unite_legale, nom_usage_u (prenom3_unite_legale || "") + " " + (prenom4_unite_legale || "") + - " ").trim() + "/"; + " " + ).trim() + "/"; return raison_sociale; } From 29d63f850f6af0e683c3f270b99a65ee5161125e Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Fri, 17 Apr 2020 15:24:55 +0200 Subject: [PATCH 08/13] Revert "fix: use prettier instead of sed, to also fix splitting of long lines" This reverts commit 0ef0d1e336273955e7f808ae25553e15bb2dc048. --- Makefile | 2 +- dbmongo/js/common/raison_sociale.js | 24 +++++++----------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index a2ab0fc15..1e79999d1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ test: ## Run some tests @npx typescript dbmongo/js/common/raison_sociale.ts # output: dbmongo/js/common/raison_sociale.js - @npx prettier --write dbmongo/js/common/raison_sociale.js + @sed -i '' 's/ / /g' dbmongo/js/common/raison_sociale.js @cd dbmongo/js/test/ && ./test_common.sh @echo "✅ Tests passed." diff --git a/dbmongo/js/common/raison_sociale.js b/dbmongo/js/common/raison_sociale.js index fc414d084..aec907bfb 100644 --- a/dbmongo/js/common/raison_sociale.js +++ b/dbmongo/js/common/raison_sociale.js @@ -1,22 +1,13 @@ -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 -) { - debug("running 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) { + debug('running raison_sociale()'); if (!nom_usage_unite_legale) { var nom_usage_unite_legale = ""; - } else { + } + else { var nom_usage_unite_legale = nom_usage_unite_legale + "/"; } - var raison_sociale = - denomination_unite_legale || - ( - nom_unite_legale + + var raison_sociale = denomination_unite_legale || + (nom_unite_legale + "*" + nom_usage_unite_legale + prenom1_unite_legale + @@ -26,7 +17,6 @@ function raison_sociale( (prenom3_unite_legale || "") + " " + (prenom4_unite_legale || "") + - " " - ).trim() + "/"; + " ").trim() + "/"; return raison_sociale; } From 5bc5f5b224a010a46ef5f06c0e34fc72840fc25f Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Tue, 21 Apr 2020 15:34:02 +0200 Subject: [PATCH 09/13] fix: prevent `go generate -x` from running loadJS() twice --- dbmongo/lib/engine/main.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/dbmongo/lib/engine/main.go b/dbmongo/lib/engine/main.go index bd96f0b6c..7e9274150 100644 --- a/dbmongo/lib/engine/main.go +++ b/dbmongo/lib/engine/main.go @@ -9,8 +9,6 @@ import ( "github.com/signaux-faibles/gournal" ) -//go:generate go run js/loadJS.go - // Db connecteur exportable var Db DB From 32eaae8a722bd95042409c9ed50e26b76db0d81f Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Tue, 21 Apr 2020 15:36:56 +0200 Subject: [PATCH 10/13] feat: transpile on `go generate` for consistency with current way of bundling --- Makefile | 3 +-- dbmongo/js/common/raison_sociale.js | 40 ++++++++++++++--------------- dbmongo/lib/engine/js/loadJS.go | 19 +++++++++++++- 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 1e79999d1..c350f4c13 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ .DEFAULT_GOAL := help test: ## Run some tests - @npx typescript dbmongo/js/common/raison_sociale.ts # output: dbmongo/js/common/raison_sociale.js - @sed -i '' 's/ / /g' dbmongo/js/common/raison_sociale.js + @cd dbmongo/lib/engine && go generate -x # output: dbmongo/js/common/raison_sociale.js @cd dbmongo/js/test/ && ./test_common.sh @echo "✅ Tests passed." diff --git a/dbmongo/js/common/raison_sociale.js b/dbmongo/js/common/raison_sociale.js index aec907bfb..e65874364 100644 --- a/dbmongo/js/common/raison_sociale.js +++ b/dbmongo/js/common/raison_sociale.js @@ -1,22 +1,22 @@ 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) { - debug('running raison_sociale()'); - 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; + debug('running raison_sociale()'); + 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; } diff --git a/dbmongo/lib/engine/js/loadJS.go b/dbmongo/lib/engine/js/loadJS.go index 19ac9994c..275ff57b3 100644 --- a/dbmongo/lib/engine/js/loadJS.go +++ b/dbmongo/lib/engine/js/loadJS.go @@ -5,13 +5,14 @@ import ( "io/ioutil" "log" "os" + "os/exec" "path/filepath" "strings" ) // Reads all .js files in the current folder // and encodes them as strings maps in jsFunctions.go -func main() { +func bundleJsFunctions() { jsRootDir := filepath.Join("..", "..", "js") folders, err := ioutil.ReadDir(jsRootDir) if err != nil { @@ -54,3 +55,19 @@ func main() { } out.Write([]byte("}\n")) } + +func transpileTsFunctions() { + // TODO: convert all TS files + cmd := exec.Command("npx", "typescript", "../../js/common/raison_sociale.ts") // output: dbmongo/js/common/raison_sociale.js + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err := cmd.Run() + if err != nil { + log.Fatal(err) + } +} + +func main() { + transpileTsFunctions() // convert *.ts files to .js + bundleJsFunctions() // bundle *.js files to jsFunctions.go +} From d15fdfdac318e5bff188281662fc8703845eca48 Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Tue, 21 Apr 2020 15:45:25 +0200 Subject: [PATCH 11/13] documentation --- Makefile | 4 +++- README.md | 4 ++++ dbmongo/lib/engine/js/loadJS.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c350f4c13..a2ad496be 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ .DEFAULT_GOAL := help test: ## Run some tests - @cd dbmongo/lib/engine && go generate -x # output: dbmongo/js/common/raison_sociale.js + @echo "Transpiling TypeScript files, and generating the jsFunctions.go bundle..." + @cd dbmongo/lib/engine && go generate -x + @echo "Running tests against the JS files (including the ones transpiled from TS)..." @cd dbmongo/js/test/ && ./test_common.sh @echo "✅ Tests passed." diff --git a/README.md b/README.md index 008bdb305..844151db8 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ Solution logicielle pour la détection anticipée d'entreprises en difficulté - frontend vuetify - mongodb +## Dépendances / pré-requis + +- `npx` (installé avec [Node.js](https://nodejs.org/)), pour lancer la transpilation des fichiers TypeScript vers JavaScript + ## Installation ```bash diff --git a/dbmongo/lib/engine/js/loadJS.go b/dbmongo/lib/engine/js/loadJS.go index 275ff57b3..e5362c8e8 100644 --- a/dbmongo/lib/engine/js/loadJS.go +++ b/dbmongo/lib/engine/js/loadJS.go @@ -57,7 +57,7 @@ func bundleJsFunctions() { } func transpileTsFunctions() { - // TODO: convert all TS files + // TODO: also transpile any other TS files cmd := exec.Command("npx", "typescript", "../../js/common/raison_sociale.ts") // output: dbmongo/js/common/raison_sociale.js cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr From 00a90f006a4e3a49ac3c34374db828569369a283 Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Tue, 21 Apr 2020 15:45:38 +0200 Subject: [PATCH 12/13] retrait du debug() --- dbmongo/js/common/raison_sociale.js | 1 - dbmongo/js/common/raison_sociale.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/dbmongo/js/common/raison_sociale.js b/dbmongo/js/common/raison_sociale.js index e65874364..f2bc92da3 100644 --- a/dbmongo/js/common/raison_sociale.js +++ b/dbmongo/js/common/raison_sociale.js @@ -1,5 +1,4 @@ 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) { - debug('running raison_sociale()'); if (!nom_usage_unite_legale) { var nom_usage_unite_legale = ""; } diff --git a/dbmongo/js/common/raison_sociale.ts b/dbmongo/js/common/raison_sociale.ts index 35a09588f..3bef290fa 100644 --- a/dbmongo/js/common/raison_sociale.ts +++ b/dbmongo/js/common/raison_sociale.ts @@ -9,7 +9,6 @@ function raison_sociale( prenom3_unite_legale: string, prenom4_unite_legale: string ): string { - debug('running raison_sociale()'); if (!nom_usage_unite_legale) { var nom_usage_unite_legale = ""; } else { From b3604bbcbd3a8a503c59878d43eb6abd5e39f24d Mon Sep 17 00:00:00 2001 From: Adrien Joly <531781+adrienjoly@users.noreply.github.com> Date: Tue, 21 Apr 2020 15:51:12 +0200 Subject: [PATCH 13/13] reduce footprint of the PR: from makefile to shell script --- Makefile | 14 -------------- test_js_functions.sh | 7 +++++++ 2 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 Makefile create mode 100755 test_js_functions.sh diff --git a/Makefile b/Makefile deleted file mode 100644 index a2ad496be..000000000 --- a/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -.DEFAULT_GOAL := help - -test: ## Run some tests - @echo "Transpiling TypeScript files, and generating the jsFunctions.go bundle..." - @cd dbmongo/lib/engine && go generate -x - @echo "Running tests against the JS files (including the ones transpiled from TS)..." - @cd dbmongo/js/test/ && ./test_common.sh - @echo "✅ Tests passed." - -help: ## This help. - @echo 'Available targets:' - @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) - -.PHONY: test help diff --git a/test_js_functions.sh b/test_js_functions.sh new file mode 100755 index 000000000..c9242427b --- /dev/null +++ b/test_js_functions.sh @@ -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."