From 66d9cb0ab1507d9adbf1cdded8a534eeda27f9e5 Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Sun, 18 Sep 2022 19:18:10 +0400 Subject: [PATCH] .mjs for all scripts --- packages/squiggle-lang/scripts/README.md | 6 +++--- .../scripts/{bench-map-reduce.js => bench-map-reduce.mjs} | 4 ++-- .../squiggle-lang/scripts/{bench-map.js => bench-map.mjs} | 4 ++-- packages/squiggle-lang/scripts/{run.js => run.mjs} | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) rename packages/squiggle-lang/scripts/{bench-map-reduce.js => bench-map-reduce.mjs} (85%) rename packages/squiggle-lang/scripts/{bench-map.js => bench-map.mjs} (86%) rename packages/squiggle-lang/scripts/{run.js => run.mjs} (80%) diff --git a/packages/squiggle-lang/scripts/README.md b/packages/squiggle-lang/scripts/README.md index df7956ae..bb3c3028 100644 --- a/packages/squiggle-lang/scripts/README.md +++ b/packages/squiggle-lang/scripts/README.md @@ -2,12 +2,12 @@ Various scripts used for development, benchmarking and testing. None of these are bundled in the NPM package yet. -# run.js +# run.mjs -`scripts/run.js` allows quick testing of Squiggle programs: +`scripts/run.mjs` allows quick testing of Squiggle programs: ``` -$ ./scripts/run.js '2+2' +$ ./scripts/run.mjs '2+2' Running 2+2 Ok 4 @{__result__: 4} diff --git a/packages/squiggle-lang/scripts/bench-map-reduce.js b/packages/squiggle-lang/scripts/bench-map-reduce.mjs similarity index 85% rename from packages/squiggle-lang/scripts/bench-map-reduce.js rename to packages/squiggle-lang/scripts/bench-map-reduce.mjs index ffada066..e6bf8ca7 100755 --- a/packages/squiggle-lang/scripts/bench-map-reduce.js +++ b/packages/squiggle-lang/scripts/bench-map-reduce.mjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -const s = require("@quri/squiggle-lang"); +import { SqProject } from "@quri/squiggle-lang"; const measure = (cb, times = 1) => { const t1 = new Date(); @@ -15,7 +15,7 @@ const maxP = 5; for (let p = 0; p <= maxP; p++) { const size = Math.pow(10, p); - const prj = s.SqProject.create(); + const prj = SqProject.create(); prj.setSource( "main", `List.upTo(1, ${size}) |> map({|x| List.upTo(1, 100) |> reduce(0, {|a,b|a+b})})` diff --git a/packages/squiggle-lang/scripts/bench-map.js b/packages/squiggle-lang/scripts/bench-map.mjs similarity index 86% rename from packages/squiggle-lang/scripts/bench-map.js rename to packages/squiggle-lang/scripts/bench-map.mjs index befa1a7b..c7a00477 100755 --- a/packages/squiggle-lang/scripts/bench-map.js +++ b/packages/squiggle-lang/scripts/bench-map.mjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -const s = require("@quri/squiggle-lang"); +import { SqProject } from "@quri/squiggle-lang"; const measure = (cb, times = 1) => { const t1 = new Date(); @@ -15,7 +15,7 @@ const maxP = 7; for (let p = 0; p <= maxP; p++) { const size = Math.pow(10, p); - const project = s.SqProject.create(); + const project = SqProject.create(); project.setSource("list", `l = List.upTo(1,${size})`); project.run("list"); project.setSource("map", "l |> map({|x| x})"); diff --git a/packages/squiggle-lang/scripts/run.js b/packages/squiggle-lang/scripts/run.mjs similarity index 80% rename from packages/squiggle-lang/scripts/run.js rename to packages/squiggle-lang/scripts/run.mjs index e77b953b..0425c46e 100755 --- a/packages/squiggle-lang/scripts/run.js +++ b/packages/squiggle-lang/scripts/run.mjs @@ -1,7 +1,7 @@ #!/usr/bin/env node -const s = require("@quri/squiggle-lang"); +import { SqProject } from "@quri/squiggle-lang"; -const p = s.SqProject.create(); +const p = SqProject.create(); const src = process.argv[2]; if (!src) {