Bump version to 0.4.4

This commit is contained in:
Robin Heggelund Hansen 2024-06-25 21:42:08 +02:00
parent ffa9ef7f6a
commit 0c9352a645
No known key found for this signature in database
5 changed files with 116 additions and 86 deletions

View File

@ -1,7 +1,7 @@
Cabal-version: 3.8 Cabal-version: 3.8
Name: gren Name: gren
Version: 0.4.3 Version: 0.4.4
Synopsis: Synopsis:
The `gren` command line interface. The `gren` command line interface.

142
index.js
View File

@ -3501,7 +3501,7 @@ var $gren_lang$node$FileSystem$Path$prepend = F2(function(left, right) {
var $gren_lang$node$FileSystem$Path$append = F2(function(left, right) { var $gren_lang$node$FileSystem$Path$append = F2(function(left, right) {
return A2($gren_lang$node$FileSystem$Path$prepend, right, left); return A2($gren_lang$node$FileSystem$Path$prepend, right, left);
}); });
var $author$project$Main$compilerVersion = '0.4.3'; var $author$project$Main$compilerVersion = '0.4.4';
var $gren_lang$core$Maybe$map = F2(function(f, maybe) { var $gren_lang$core$Maybe$map = F2(function(f, maybe) {
if (maybe.$ === 'Just') { if (maybe.$ === 'Just') {
var value = maybe.a; var value = maybe.a;
@ -3929,9 +3929,6 @@ var $gren_lang$core$Json$Decode$succeed = _Json_succeed;
var $author$project$Main$CompilerDownloaded = function (a) { var $author$project$Main$CompilerDownloaded = function (a) {
return { $: 'CompilerDownloaded', a: a }; return { $: 'CompilerDownloaded', a: a };
}; };
var $author$project$Main$CompilerExecuted = function (a) {
return { $: 'CompilerExecuted', a: a };
};
var $author$project$Main$CompilerInstalled = function (a) { var $author$project$Main$CompilerInstalled = function (a) {
return { $: 'CompilerInstalled', a: a }; return { $: 'CompilerInstalled', a: a };
}; };
@ -4459,9 +4456,6 @@ var $gren_lang$node$HttpClient$errorToString = function(err) {
return _Utils_ap('Unknown error: ', debugStr); return _Utils_ap('Unknown error: ', debugStr);
} }
}; };
var $gren_lang$node$Node$exitWithCode = function(code) {
return _Node_exitWithCode(code);
};
var $gren_lang$node$FileSystem$makeDirectory = F3(function(_v0, options, path) { var $gren_lang$node$FileSystem$makeDirectory = F3(function(_v0, options, path) {
return A2(_FileSystem_makeDirectory, options, path); return A2(_FileSystem_makeDirectory, options, path);
}); });
@ -4514,8 +4508,12 @@ var $gren_lang$node$ChildProcess$MergeWithEnvironmentVariables = function (a) {
var $gren_lang$node$ChildProcess$DefaultShell = { $: 'DefaultShell' }; var $gren_lang$node$ChildProcess$DefaultShell = { $: 'DefaultShell' };
var $gren_lang$node$ChildProcess$InheritEnvironmentVariables = { $: 'InheritEnvironmentVariables' }; var $gren_lang$node$ChildProcess$InheritEnvironmentVariables = { $: 'InheritEnvironmentVariables' };
var $gren_lang$node$ChildProcess$InheritWorkingDirectory = { $: 'InheritWorkingDirectory' }; var $gren_lang$node$ChildProcess$InheritWorkingDirectory = { $: 'InheritWorkingDirectory' };
var $gren_lang$node$ChildProcess$Integrated = { $: 'Integrated' };
var $gren_lang$node$ChildProcess$NoLimit = { $: 'NoLimit' }; var $gren_lang$node$ChildProcess$NoLimit = { $: 'NoLimit' };
var $gren_lang$node$ChildProcess$defaultRunOptions = { environmentVariables: $gren_lang$node$ChildProcess$InheritEnvironmentVariables, maximumBytesWrittenToStreams: 1024 * 1024, runDuration: $gren_lang$node$ChildProcess$NoLimit, shell: $gren_lang$node$ChildProcess$DefaultShell, workingDirectory: $gren_lang$node$ChildProcess$InheritWorkingDirectory }; var $gren_lang$node$ChildProcess$defaultSpawnOptions = { connection: $gren_lang$node$ChildProcess$Integrated, environmentVariables: $gren_lang$node$ChildProcess$InheritEnvironmentVariables, runDuration: $gren_lang$node$ChildProcess$NoLimit, shell: $gren_lang$node$ChildProcess$DefaultShell, workingDirectory: $gren_lang$node$ChildProcess$InheritWorkingDirectory };
var $gren_lang$core$Dict$singleton = F2(function(key, value) {
return A5($gren_lang$core$Dict$RBNode_gren_builtin, $gren_lang$core$Dict$Black, key, value, $gren_lang$core$Dict$RBEmpty_gren_builtin, $gren_lang$core$Dict$RBEmpty_gren_builtin);
});
var bufferNs = require("node:buffer"); var bufferNs = require("node:buffer");
@ -4533,21 +4531,12 @@ var _ChildProcess_run = function (options) {
options._arguments, options._arguments,
{ {
encoding: "buffer", encoding: "buffer",
cwd: workingDir.inherit ? process.cwd() : workingDir.override, timeout: options.runDuration,
env: cwd: _ChildProcess_handleCwd(workingDir),
env.option === 0 env: _ChildProcess_handleEnv(env),
? process.env
: env.option === 1
? _Utils_update(process.env, _ChildProcess_dictToObj(env.value))
: _ChildProcess_dictToObj(env.value),
timeout: options.runDuration, timeout: options.runDuration,
maxBuffer: options.maximumBytesWrittenToStreams, maxBuffer: options.maximumBytesWrittenToStreams,
shell: shell: _ChildProcess_handleShell(shell),
shell.choice === 0
? false
: shell.choice === 1
? true
: shell.value,
}, },
function (err, stdout, stderr) { function (err, stdout, stderr) {
if (err == null) { if (err == null) {
@ -4588,6 +4577,51 @@ var _ChildProcess_run = function (options) {
}); });
}; };
var _ChildProcess_spawn = function (options) {
return _Scheduler_binding(function (callback) {
var workingDir = options.workingDirectory;
var env = options.environmentVariables;
var shell = options.shell;
var subproc = childProcess.spawn(options.program, options._arguments, {
cwd: _ChildProcess_handleCwd(workingDir),
env: _ChildProcess_handleEnv(env),
timeout: options.runDuration,
shell: _ChildProcess_handleShell(shell),
stdio: options.connection === 0 ? "inherit" : "ignore",
detached: options.connection === 2 && process.platform === "win32",
});
if (options.connection === 2) {
subproc.unref();
}
return function () {
subproc.kill();
};
});
};
function _ChildProcess_handleCwd(cwd) {
return cwd.inherit ? process.cwd() : cwd.override;
}
function _ChildProcess_handleEnv(env) {
return env.option === 0
? process.env
: env.option === 1
? _Utils_update(process.env, _ChildProcess_dictToObj(env.value))
: _ChildProcess_dictToObj(env.value);
}
function _ChildProcess_handleShell(shell) {
return shell.choice === 0
? false
: shell.choice === 1
? true
: shell.value;
}
function _ChildProcess_dictToObj(dict) { function _ChildProcess_dictToObj(dict) {
return A3( return A3(
$gren_lang$core$Dict$foldl, $gren_lang$core$Dict$foldl,
@ -4603,54 +4637,62 @@ var $gren_lang$core$Basics$gt = _Utils_gt;
var $gren_lang$core$Basics$max = F2(function(x, y) { var $gren_lang$core$Basics$max = F2(function(x, y) {
return (_Utils_cmp(x, y) > 0) ? x : y; return (_Utils_cmp(x, y) > 0) ? x : y;
}); });
var $gren_lang$node$ChildProcess$run = F4(function(_v0, program, _arguments, opts) { var $gren_lang$core$Process$spawn = _Scheduler_spawn;
return _ChildProcess_run({ _arguments: _arguments, environmentVariables: function () { var $gren_lang$node$ChildProcess$spawn = F4(function(_v0, program, _arguments, opts) {
var _v1 = opts.environmentVariables; return $gren_lang$core$Process$spawn(_ChildProcess_spawn({ _arguments: _arguments, connection: function () {
var _v1 = opts.connection;
switch (_v1.$) { switch (_v1.$) {
case 'Integrated':
return 0;
case 'Ignored':
return 1;
default:
return 2;
}
}(), environmentVariables: function () {
var _v2 = opts.environmentVariables;
switch (_v2.$) {
case 'InheritEnvironmentVariables': case 'InheritEnvironmentVariables':
return { option: 0, value: $gren_lang$core$Dict$empty }; return { option: 0, value: $gren_lang$core$Dict$empty };
case 'MergeWithEnvironmentVariables': case 'MergeWithEnvironmentVariables':
var value = _v1.a; var value = _v2.a;
return { option: 1, value: value }; return { option: 1, value: value };
default: default:
var value = _v1.a; var value = _v2.a;
return { option: 2, value: value }; return { option: 2, value: value };
} }
}(), maximumBytesWrittenToStreams: opts.maximumBytesWrittenToStreams, program: program, runDuration: function () { }(), program: program, runDuration: function () {
var _v2 = opts.runDuration; var _v3 = opts.runDuration;
if (_v2.$ === 'NoLimit') { if (_v3.$ === 'NoLimit') {
return 0; return 0;
} else { } else {
var ms = _v2.a; var ms = _v3.a;
return A2($gren_lang$core$Basics$max, 0, ms); return A2($gren_lang$core$Basics$max, 0, ms);
} }
}(), shell: function () { }(), shell: function () {
var _v3 = opts.shell; var _v4 = opts.shell;
switch (_v3.$) { switch (_v4.$) {
case 'NoShell': case 'NoShell':
return { choice: 0, value: '' }; return { choice: 0, value: '' };
case 'DefaultShell': case 'DefaultShell':
return { choice: 1, value: '' }; return { choice: 1, value: '' };
default: default:
var value = _v3.a; var value = _v4.a;
return { choice: 2, value: value }; return { choice: 2, value: value };
} }
}(), workingDirectory: function () { }(), workingDirectory: function () {
var _v4 = opts.workingDirectory; var _v5 = opts.workingDirectory;
if (_v4.$ === 'InheritWorkingDirectory') { if (_v5.$ === 'InheritWorkingDirectory') {
return { inherit: true, override: '' }; return { inherit: true, override: '' };
} else { } else {
var value = _v4.a; var value = _v5.a;
return { inherit: false, override: value }; return { inherit: false, override: value };
} }
}() }); }() }));
});
var $gren_lang$core$Dict$singleton = F2(function(key, value) {
return A5($gren_lang$core$Dict$RBNode_gren_builtin, $gren_lang$core$Dict$Black, key, value, $gren_lang$core$Dict$RBEmpty_gren_builtin, $gren_lang$core$Dict$RBEmpty_gren_builtin);
}); });
var $author$project$Main$runCompiler = function(model) { var $author$project$Main$runCompiler = function(model) {
var colorEnvVar = model.useColor ? A2($gren_lang$core$Dict$singleton, 'FORCE_COLOR', '1') : A2($gren_lang$core$Dict$singleton, 'NO_COLOR', '1'); var colorEnvVar = model.useColor ? A2($gren_lang$core$Dict$singleton, 'FORCE_COLOR', '1') : A2($gren_lang$core$Dict$singleton, 'NO_COLOR', '1');
return A4($gren_lang$node$ChildProcess$run, model.cpPermission, model.pathToString(model.localPath), model.args, _Utils_update($gren_lang$node$ChildProcess$defaultRunOptions, { environmentVariables: $gren_lang$node$ChildProcess$MergeWithEnvironmentVariables(colorEnvVar), maximumBytesWrittenToStreams: 1024 * 1024 })); return A4($gren_lang$node$ChildProcess$spawn, model.cpPermission, model.pathToString(model.localPath), model.args, _Utils_update($gren_lang$node$ChildProcess$defaultSpawnOptions, { environmentVariables: $gren_lang$node$ChildProcess$MergeWithEnvironmentVariables(colorEnvVar) }));
}; };
var $gren_lang$node$FileSystem$writeFile = F3(function(_v0, bytes, path) { var $gren_lang$node$FileSystem$writeFile = F3(function(_v0, bytes, path) {
return A2(_FileSystem_writeFile, bytes, path); return A2(_FileSystem_writeFile, bytes, path);
@ -4671,7 +4713,7 @@ var $author$project$Main$update = F2(function(msg, model) {
} }
}(), model: model }; }(), model: model };
} else { } else {
return { command: A2($gren_lang$core$Task$attempt, $author$project$Main$CompilerExecuted, $author$project$Main$runCompiler(model)), model: model }; return { command: $gren_lang$core$Task$execute($author$project$Main$runCompiler(model)), model: model };
} }
case 'CompilerDownloaded': case 'CompilerDownloaded':
if (msg.a.$ === 'Err') { if (msg.a.$ === 'Err') {
@ -4702,24 +4744,12 @@ var $author$project$Main$update = F2(function(msg, model) {
return A3($gren_lang$node$FileSystem$writeFile, model.fsPermission, res.data, model.localPath); return A3($gren_lang$node$FileSystem$writeFile, model.fsPermission, res.data, model.localPath);
}, A3($gren_lang$node$FileSystem$makeDirectory, model.fsPermission, { recursive: true }, cacheFolder))))), model: model }; }, A3($gren_lang$node$FileSystem$makeDirectory, model.fsPermission, { recursive: true }, cacheFolder))))), model: model };
} }
case 'CompilerInstalled': default:
if (msg.a.$ === 'Err') { if (msg.a.$ === 'Err') {
var fsErr = msg.a.a; var fsErr = msg.a.a;
return { command: $gren_lang$core$Task$execute(A2($gren_lang$node$Stream$sendLine, model.stderr, _Utils_ap('Failed to install binary after download, due to error: ', $gren_lang$node$FileSystem$errorToString(fsErr)))), model: model }; return { command: $gren_lang$core$Task$execute(A2($gren_lang$node$Stream$sendLine, model.stderr, _Utils_ap('Failed to install binary after download, due to error: ', $gren_lang$node$FileSystem$errorToString(fsErr)))), model: model };
} else { } else {
return { command: A2($gren_lang$core$Task$attempt, $author$project$Main$CompilerExecuted, $author$project$Main$runCompiler(model)), model: model }; return { command: $gren_lang$core$Task$execute($author$project$Main$runCompiler(model)), model: model };
}
default:
if (msg.a.$ === 'Err') {
var output = msg.a.a;
return { command: $gren_lang$core$Task$execute(A2($gren_lang$core$Task$andThen, function(_v6) {
return $gren_lang$node$Node$exitWithCode(output.exitCode);
}, A2($gren_lang$node$Stream$send, model.stderr, output.stderr))), model: model };
} else {
var output = msg.a.a;
return { command: $gren_lang$core$Task$execute(A2($gren_lang$core$Task$andThen, function(_v7) {
return A2($gren_lang$node$Stream$send, model.stderr, output.stderr);
}, A2($gren_lang$node$Stream$send, model.stdout, output.stdout))), model: model };
} }
} }
}); });

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "gren-lang", "name": "gren-lang",
"version": "0.4.3", "version": "0.4.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "gren-lang", "name": "gren-lang",
"version": "0.4.3", "version": "0.4.4",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"bin": { "bin": {
"gren": "index.js" "gren": "index.js"

View File

@ -1,6 +1,6 @@
{ {
"name": "gren-lang", "name": "gren-lang",
"version": "0.4.3", "version": "0.4.4",
"description": "Compiler for the Gren programming language", "description": "Compiler for the Gren programming language",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"

View File

@ -39,7 +39,7 @@ type alias Model =
compilerVersion : String compilerVersion : String
compilerVersion = compilerVersion =
"0.4.3" "0.4.4"
init : Node.Environment -> Init.Task { model : Model, command : Cmd Msg } init : Node.Environment -> Init.Task { model : Model, command : Cmd Msg }