New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

elm-codegen

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elm-codegen - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

dist/bin.d.ts

4

dist/bin.js

@@ -31,3 +31,3 @@ "use strict";

var helpText = "\nWelcome to " + chalk_1.default.cyan("elm-codegen") + "!\n\nMake sure to check out the " + chalk_1.default.yellow("guides") + ":\n https://github.com/mdgriffith/elm-codegen#check-out-the-guide\n";
program.version("0.3.0").name("elm-codegen").addHelpText("before", helpText);
program.version("0.4.0").name("elm-codegen").addHelpText("before", helpText);
program

@@ -43,2 +43,3 @@ .command("init")

.argument("[version]")
.option("--cwd <dir>", "The directory where your elm.codegen.json lives should go.", ".")
.action(Run.run_install);

@@ -52,2 +53,3 @@ program

.option("--output <dir>", "The directory where your generated files should go.", "generated")
.option("--cwd <dir>", "The base directory where the elm.json lives for your generator.", ".")
.option("--flags-from <file>", "The file to feed to your elm app as flags. If it has a json extension, it will be handed in as json.")

@@ -54,0 +56,0 @@ .option("--flags <json>", "Json to pass to your elm app. if --flags-from is given, that will take precedence.")

@@ -63,4 +63,6 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var cwd;
return __generator(this, function (_a) {
return [2 /*return*/, Run.run(targetFile, options)];
cwd = options.cwd === null ? "." : options.cwd;
return [2 /*return*/, Run.run(targetFile, { debug: options.debug, output: options.output, flags: options.flags, cwd: cwd })];
});

@@ -67,0 +69,0 @@ });

@@ -340,8 +340,5 @@ "use strict";

_a.label = 2;
case 2: return [4 /*yield*/, get_docs(pkg, version)
// let codeGenJson = getCodeGenJson(install_dir)
];
case 2: return [4 /*yield*/, get_docs(pkg, version)];
case 3:
docs = _a.sent();
// let codeGenJson = getCodeGenJson(install_dir)
if (codeGenJson.version != currentVersion) {

@@ -382,8 +379,8 @@ console.log(chalk_1.default.cyan("elm.codegen.json") +

}
function getCodeGenJsonDir() {
if (fs.existsSync("elm.codegen.json")) {
return ".";
function getCodeGenJsonDir(cwd) {
if (fs.existsSync(path.join(cwd, "elm.codegen.json"))) {
return cwd;
}
else if (fs.existsSync("codegen/elm.codegen.json")) {
return "codegen";
else if (fs.existsSync(path.join(cwd, "codegen", "elm.codegen.json"))) {
return path.join(cwd, "codegen");
}

@@ -509,2 +506,6 @@ console.log(format_block([

case 4:
// Make sure ./Gen exists
fs.mkdirSync(path.join(install_dir, "Gen"), { recursive: true });
// Remove everything from it if there is anything
clear(path.join(install_dir, "Gen"));
genFolderPath = path.join(install_dir, "Gen", "CodeGen");

@@ -547,9 +548,10 @@ fs.mkdirSync(genFolderPath, { recursive: true });

fs.readdir(dir, function (err, files) {
if (err)
throw err;
if (err) {
// skip if there's an error
return;
}
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
var file = files_3[_i];
fs.unlink(path.join(dir, file), function (err) {
if (err)
throw err;
// Just skip if there is an error
});

@@ -562,3 +564,3 @@ }

}
function run_install(pkg, version) {
function run_install(pkg, version, options) {
return __awaiter(this, void 0, void 0, function () {

@@ -569,3 +571,3 @@ var install_dir, codeGenJson, codeGenJsonPath, docs, elmSources_1, updatedCodeGenJson;

case 0:
install_dir = getCodeGenJsonDir();
install_dir = getCodeGenJsonDir(options.cwd);
codeGenJson = getCodeGenJson(install_dir);

@@ -637,7 +639,5 @@ codeGenJsonPath = path.join(install_dir, "elm.codegen.json");

return __awaiter(this, void 0, void 0, function () {
var moduleName, install_dir, codeGenJson;
var moduleName;
return __generator(this, function (_a) {
moduleName = path.parse(elmFile).name;
install_dir = getCodeGenJsonDir();
codeGenJson = getCodeGenJson(install_dir);
generate(options.debug, elmFile, moduleName, options.output, options.cwd || ".", options.flags);

@@ -644,0 +644,0 @@ return [2 /*return*/];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function () { return "\nmodule Generate exposing (main)\n\n{-| -}\n\nimport Elm\nimport Elm.Annotation as Type\nimport Gen.CodeGen.Generate as Generate\nimport Gen.Helper\n\n\nmain : Program {} () ()\nmain =\n Generate.run\n [ file\n ]\n\n\n\nfile : Elm.File\nfile =\n Elm.file [ \"HelloWorld\" ]\n [ Elm.declaration \"hello\"\n (Elm.string \"World!\")\n\n -- Here's an example of using a helper file!\n -- Add functions to codegen/helpers/{Whatever}.elm\n -- run elm-codegen install\n -- Then you can call those functions using import Gen.{Whatever}\n , Elm.declaration \"usingAHelper\"\n (Gen.Helper.add5 20)\n ]\n"; });
exports.default = (function () { return "\nmodule Generate exposing (main)\n\n{-| -}\n\nimport Elm\nimport Elm.Annotation as Type\nimport Gen.CodeGen.Generate as Generate\n\n\nmain : Program {} () ()\nmain =\n Generate.run\n [ file\n ]\n\n\nfile : Elm.File\nfile =\n Elm.file [ \"HelloWorld\" ]\n [ Elm.declaration \"hello\"\n (Elm.string \"World!\")\n ]\n\n"; });
{
"name": "elm-codegen",
"version": "0.3.0",
"version": "0.4.0",
"description": "Codegen for Elm",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": {

@@ -7,0 +8,0 @@ "elm-codegen": "./bin/elm-codegen"

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc