elm-test-rs 3.0.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # elm-test-rs
2
+
3
+ Fast and portable executable to run your Elm tests.
4
+
5
+ 👉 [Usage](https://github.com/mpizenberg/elm-test-rs#usage)
package/binary.js ADDED
@@ -0,0 +1,87 @@
1
+ var fs = require("fs");
2
+ var path = require("path");
3
+ var package = require("./package.json");
4
+
5
+ module.exports = function () {
6
+ var platform = `${process.platform}-${process.arch}`;
7
+ var subPackageName = `@mpizenberg/elm-test-rs-${platform}`;
8
+
9
+ if (!(subPackageName in package.optionalDependencies)) {
10
+ exitFailure(
11
+ `The elm-test-rs npm package does not support your platform (${platform}).`
12
+ );
13
+ }
14
+
15
+ var fileName =
16
+ process.platform === "win32" ? "elm-test-rs.exe" : "elm-test-rs";
17
+
18
+ try {
19
+ var subBinaryPath = require.resolve(`${subPackageName}/${fileName}`);
20
+ } catch (error) {
21
+ if (error && error.code === "MODULE_NOT_FOUND") {
22
+ exitFailure(missingSubPackageHelp(subPackageName));
23
+ } else {
24
+ exitFailure(
25
+ `I had trouble requiring the binary package for your platform (${subPackageName}):\n\n${error}`
26
+ );
27
+ }
28
+ }
29
+
30
+ // Yarn 2 and later ("Berry") always invokes `node` (regardless of configuration)
31
+ // so we cannot do any optimizations there.
32
+ var isYarnBerry = /\byarn\/(?!1\.)/.test(
33
+ process.env.npm_config_user_agent || ""
34
+ );
35
+
36
+ // On Windows, npm always invokes `node` so we cannot do any optimizations there either.
37
+ if (process.platform === "win32" || isYarnBerry) {
38
+ return subBinaryPath;
39
+ }
40
+
41
+ var binaryPath = path.resolve(__dirname, package.bin.elm);
42
+ var tmpPath = binaryPath + ".tmp";
43
+
44
+ try {
45
+ // Atomically replace the file with a hard link to the binary as an optimization.
46
+ fs.linkSync(subBinaryPath, tmpPath);
47
+ fs.renameSync(tmpPath, binaryPath);
48
+ } catch (error) {
49
+ exitFailure(
50
+ `I had some trouble writing file to disk. It is saying:\n\n${error}`
51
+ );
52
+ }
53
+
54
+ return binaryPath;
55
+ };
56
+
57
+ function exitFailure(message) {
58
+ var tag = `v${package.version.replace(/^(\d+\.\d+)\.0$/, "$1")})}`;
59
+ console.error(
60
+ `
61
+ -- ERROR -----------------------------------------------------------------------
62
+
63
+ ${message}
64
+
65
+ NOTE: You can avoid npm entirely by downloading directly from:
66
+ https://github.com/mpizenberg/elm-test-rs/releases/tag/${tag}
67
+ All this package does is distributing a file from there.
68
+
69
+ --------------------------------------------------------------------------------
70
+ `.trim()
71
+ );
72
+ process.exit(1);
73
+ }
74
+
75
+ function missingSubPackageHelp(subPackageName) {
76
+ return `
77
+ I support your platform, but I could not find the binary package (${subPackageName}) for it!
78
+
79
+ This can happen if you use the "--omit=optional" (or "--no-optional") npm flag.
80
+ The "optionalDependencies" package.json feature is used by elm-test-rs to install the correct
81
+ binary executable for your current platform. Remove that flag to use elm-test-rs.
82
+
83
+ This can also happen if the "node_modules" folder was copied between two operating systems
84
+ that need different binaries - including "virtual" operating systems like Docker and WSL.
85
+ If so, try installing with npm rather than copying "node_modules".
86
+ `.trim();
87
+ }
package/elm-test-rs.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+
3
+ var child_process = require("child_process");
4
+
5
+ var binaryPath = require("../binary.js")();
6
+
7
+ child_process
8
+ .spawn(binaryPath, process.argv.slice(2), { stdio: "inherit" })
9
+ .on("exit", process.exit);
package/install.js ADDED
@@ -0,0 +1 @@
1
+ require("./binary.js")();
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "elm-test-rs",
3
+ "version": "3.0.0-0",
4
+ "author": "Matthieu Pizenberg",
5
+ "license": "BSD-3-Clause",
6
+ "description": "Fast and portable executable to run your Elm tests.",
7
+ "repository": "mpizenberg/elm-test-rs",
8
+ "type": "commonjs",
9
+ "exports": {},
10
+ "bin": "./elm-test-rs.js",
11
+ "keywords": [
12
+ "elm",
13
+ "elm-test",
14
+ "cli",
15
+ "rust"
16
+ ],
17
+ "scripts": {
18
+ "install": "node install.js"
19
+ },
20
+ "optionalDependencies": {
21
+ "@mpizenberg/elm-test-rs-darwin-arm64": "3.0.0-0",
22
+ "@mpizenberg/elm-test-rs-darwin-x64": "3.0.0-0",
23
+ "@mpizenberg/elm-test-rs-linux-arm": "3.0.0-0",
24
+ "@mpizenberg/elm-test-rs-linux-arm64": "3.0.0-0",
25
+ "@mpizenberg/elm-test-rs-linux-x64": "3.0.0-0",
26
+ "@mpizenberg/elm-test-rs-win32-x64": "3.0.0-0"
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ This is the macOS ARM 64-bit binary for [elm-test-rs](https://github.com/mpizenberg/elm-test-rs).
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@mpizenberg/elm-test-rs-darwin-arm64",
3
+ "version": "3.0.0-0",
4
+ "description": "The macOS ARM 64-bit binary for elm-test-rs.",
5
+ "repository": "https://github.com/mpizenberg/elm-test-rs",
6
+ "license": "BSD-3-Clause",
7
+ "os": [ "darwin" ],
8
+ "cpu": [ "arm64" ]
9
+ }
@@ -0,0 +1 @@
1
+ This is the macOS 64-bit binary for [elm-test-rs](https://github.com/mpizenberg/elm-test-rs).
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@mpizenberg/elm-test-rs-darwin-x64",
3
+ "version": "3.0.0-0",
4
+ "description": "The macOS 64-bit binary for elm-test-rs.",
5
+ "repository": "https://github.com/mpizenberg/elm-test-rs",
6
+ "license": "BSD-3-Clause",
7
+ "os": [ "darwin" ],
8
+ "cpu": [ "x64" ]
9
+ }
@@ -0,0 +1 @@
1
+ This is the Linux ARM 32-bit binary for [elm-test-rs](https://github.com/mpizenberg/elm-test-rs).
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@mpizenberg/elm-test-rs-linux-arm",
3
+ "version": "3.0.0-0",
4
+ "description": "The Linux ARM 32-bit binary for elm-test-rs.",
5
+ "repository": "https://github.com/mpizenberg/elm-test-rs",
6
+ "license": "BSD-3-Clause",
7
+ "os": [ "linux" ],
8
+ "cpu": [ "arm" ]
9
+ }
@@ -0,0 +1 @@
1
+ This is the Linux ARM 64-bit binary for [elm-test-rs](https://github.com/mpizenberg/elm-test-rs).
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@mpizenberg/elm-test-rs-linux-arm64",
3
+ "version": "3.0.0-0",
4
+ "description": "The Linux ARM 64-bit binary for elm-test-rs.",
5
+ "repository": "https://github.com/mpizenberg/elm-test-rs",
6
+ "license": "BSD-3-Clause",
7
+ "os": [ "linux" ],
8
+ "cpu": [ "arm64" ]
9
+ }
@@ -0,0 +1 @@
1
+ This is the Linux 64-bit binary for [elm-test-rs](https://github.com/mpizenberg/elm-test-rs).
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@mpizenberg/elm-test-rs-linux-x64",
3
+ "version": "3.0.0-0",
4
+ "description": "The Linux 64-bit binary for elm-test-rs.",
5
+ "repository": "https://github.com/mpizenberg/elm-test-rs",
6
+ "license": "BSD-3-Clause",
7
+ "os": [ "linux" ],
8
+ "cpu": [ "x64" ]
9
+ }
@@ -0,0 +1 @@
1
+ This is the Windows 64-bit binary for [elm-test-rs](https://github.com/mpizenberg/elm-test-rs).
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@mpizenberg/elm-test-rs-win32-x64",
3
+ "version": "3.0.0-0",
4
+ "description": "The Windows 64-bit binary for elm-test-rs.",
5
+ "repository": "https://github.com/mpizenberg/elm-test-rs",
6
+ "license": "BSD-3-Clause",
7
+ "os": [ "win32" ],
8
+ "cpu": [ "x64" ]
9
+ }