fsprojects-archive / zzarchive-generator-fsharp Goto Github PK
View Code? Open in Web Editor NEW[ARCHIVED] Yeoman F# generator
License: Apache License 2.0
[ARCHIVED] Yeoman F# generator
License: Apache License 2.0
I am trying to take this generator for a test run. I'm using Ubuntu 15.04. When I try and run it, I get the following error:
In case that's hard to read, it says "'Github' download failed. Try fallback download from 'Nuget'.
Error getting response stream (Write: The authentication or decryption has failed.) SendFailure (Nuget)
Error getting response stream (Write: The authentication or decryption has failed.) SendFailure (Github)"
This only seems to occur when I choose the "use Paket" option.
What do you think the issue is? And if you're unsure, where should I look to start investigating?
Thanks!
I was thinking about adding file templates as new features.
The new first question will be if you want to create a new project or a new file.
When selecting new project everything stays the way it is.
When you select new file you get following questions:
After all question, the fsproj- File is changed according the input.
Comments? Suggestions?
Playing with the generator and am doing:
akropp at LMDV-AKROP in ~/src/personal/fs/SlnTest
$ yo fsharp
____ ____ __
/\ _`\ /\ _`\ /\ \
\ \ \L\_\ \,\L\_\ \ \___ __ _ __ _____
\ \ _\/\/_\__ \\ \ _ `\ /'__`\ /\`'__\/\ '__`\
\ \ \/ /\ \L\ \ \ \ \ \/\ \L\.\_\ \ \/ \ \ \L\ \
\ \_\ \ `\____\ \_\ \_\ \__/.\_\\ \_\ \ \ ,__/
\/_/ \/_____/\/_/\/_/\/__/\/_/ \/_/ \ \ \/
\ \_\
\/_/
Welcome to the perfect FSharp generator!
? What do You want to do? Create empty solution
? What's the name of your application? SLnTest
? Do You want to use Paket? Yes
ApplicationName.sln
create SLnTest/SLnTest.sln
create SLnTest/.paket/paket.bootstrapper.exe
No version specified. Downloading latest stable.
Starting download from https://github.com/fsprojects/Paket/releases/download/2.2.1/paket.exe
Done.
/Users/akropp/src/personal/fs/SlnTest/SLnTest
Paket version 2.2.1.0
Dependencies files saved to /Users/akropp/src/personal/fs/SlnTest/SLnTest/paket.dependencies
Solution /Users/akropp/src/personal/fs/SlnTest/SLnTest/SLnTest.sln changed
Resolving packages for group Main:
Locked version resolution written to /Users/akropp/src/personal/fs/SlnTest/SLnTest/paket.lock
1 second - ready.
Your project is now created
akropp at LMDV-AKROP in ~/src/personal/fs/SlnTest
$ ls
total 0
drwxr-xr-x 7 akropp 386085923 238 Sep 19 12:52 SLnTest
akropp at LMDV-AKROP in ~/src/personal/fs/SlnTest
$ cd SLnTest
akropp at LMDV-AKROP in ~/src/personal/fs/SlnTest/SLnTest
$ ls
total 24
-rw-r--r-- 1 akropp 386085923 499 Sep 19 12:52 SLnTest.sln
drwxr-xr-x 2 akropp 386085923 68 Sep 19 12:52 packages
-rw-r--r-- 1 akropp 386085923 32 Sep 19 12:52 paket.dependencies
-rw-r--r-- 1 akropp 386085923 1 Sep 19 12:52 paket.lock
akropp at LMDV-AKROP in ~/src/personal/fs/SlnTest/SLnTest
$ cat SLnTest.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{4D602BF5-F872-4AD0-B147-956973522466}"
ProjectSection(SolutionItems) = preProject
paket.dependencies = paket.dependencies
EndProjectSection
EndProject
Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
And now to add to the solution
$ yo fsharp
____ ____ __
/\ _`\ /\ _`\ /\ \
\ \ \L\_\ \,\L\_\ \ \___ __ _ __ _____
\ \ _\/\/_\__ \\ \ _ `\ /'__`\ /\`'__\/\ '__`\
\ \ \/ /\ \L\ \ \ \ \ \/\ \L\.\_\ \ \/ \ \ \L\ \
\ \_\ \ `\____\ \_\ \_\ \__/.\_\\ \_\ \ \ ,__/
\/_/ \/_____/\/_/\/_/\/__/\/_/ \/_/ \ \ \/
\ \_\
\/_/
Welcome to the perfect FSharp generator!
? What do You want to do? Add new project to solution
? What type of application do you want to create? Console Application
? What's the name of your application? ConsoleTest
? Do You want to use Paket? Yes
App.config
ApplicationName.fs
ApplicationName.fsproj
create ConsoleTest/App.config
create ConsoleTest/ConsoleTest.fs
create ConsoleTest/ConsoleTest.fsproj
identical .paket/paket.bootstrapper.exe
No version specified. Downloading latest stable.
Paket.exe 2.2.1.0 is up to date.
/Users/akropp/src/personal/fs/SlnTest/SLnTest
Paket version 2.2.1.0
Dependencies files saved to /Users/akropp/src/personal/fs/SlnTest/SLnTest/paket.dependencies
Resolving packages for group Main:
/Users/akropp/src/personal/fs/SlnTest/SLnTest/paket.lock is already up-to-date
0 seconds - ready.
Your project is now created
akropp at LMDV-AKROP in ~/src/personal/fs/SlnTest/SLnTest
$ cat SLnTest.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{4D602BF5-F872-4AD0-B147-956973522466}"
ProjectSection(SolutionItems) = preProject
paket.dependencies = paket.dependencies
EndProjectSection
EndProject
Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
But the SLN file doesn't change. Am I doing something wrong?
I tried running the command npm install -g generator-fsharp
on OS X, which gave me the following output
[email protected] /usr/local/lib/node_modules/generator-fsharp
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
Next I ran the command yo fsharp
which gave me the output
Error fsharp
You don't seem to have a generator with the name fsharp installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 1 registered generators run yo with the `--help` option.
I installed the C# generator, which works just fine.
Is there any way to add a custom template?
add to .vscode/extensions/Ionide.Ionide-fsharp-2.5.4/templates ??
Currently theres no way (afaik) to runa script when a template is created, so I cant install npm / other dependencies for example.
if "%1" == "quickrun" (
../packages\FAKE\tools\FAKE.exe run --fsiargs -d:NO_FSI_ADDPRINTER build.fsx
) else (
../.paket\paket.bootstrapper.exe
if errorlevel 1 (
exit /b %errorlevel%
)
if not exist paket.lock (
../.paket\paket.exe install
) else (
../.paket\paket.exe restore
)
if errorlevel 1 (
exit /b %errorlevel%
)
../packages\FAKE\tools\FAKE.exe %* --fsiargs -d:NO_FSI_ADDPRINTER build.fsx
)
these ../
should be changed to ..\
I have been playing around with the cross-platform GUI library Eto recently, seeing if it's suitable for building cross-platform apps in F#. Eto has a nice Visual Studio addon that includes some well-designed templates for new projects: they create a "main" project where all the cross-platform code lives, and one "subproject" per platform (one for Gtk, one for WinForms, one for Xamarin.Mac, and so on). Each of these subprojects has its own GUID.
I wanted to copy Eto's templates into generator-fsharp, so that I could easily create new Eto projects with Ionide and Atom. But I discovered that generator-fsharp only provides a single GUID to file templates:
this.templatedata.guid = uuid.v4();
What I'd like to do to make my use-case possible is something like:
this.templatedata.guid = uuid.v4(); // Most templates will still use this
this.templatedata.guids = [];
for (i=0; i<10; i++) { // If ten isn't enough, then i<100 instead
this.templatedata.guids.push(uuid.v4());
}
Any existing templates could continue to use guid
, but any templates that need more than one GUID (and need to reference those GUIDs consistently in multiple places) could use guids[0]
through guids[9]
. (Or even through guids[99]
if it turns out that ten is too limiting).
Generating eleven (or a hundred and one) random GUIDs instead of just one shouldn't take up too much extra time, I would think. (Though I haven't benchmarked it yet). The question is, does this seem worth it? Are there any other templates that would benefit from having multiple GUIDs available, or is my use-case such a rare scenario that it's not worth adding extra complexity for it?
I'll probably go ahead and write a PR for this change in a few days, but before I do, I wanted to hear other people's opinions on whether this would be useful to them.
Commands to repro:
> yo fsharp
> create empty solution
> What's the name of your solution? Portal.ApplicationSite.com
> Do you want to use Paket? Yes
events.js:85
throw er; // Unhandled 'error' event
^
Error: ENOENT, no such file or directory 'C:\Users\JeroldHaas\.cache\yeoman\fspr
ojects\generator-fsharp\templates\sln'
at Error (native)
at Object.fs.readdirSync (fs.js:761:18)
at yeoman.generators.Base.extend._copy (C:\Users\JeroldHaas\AppData\Roaming\
npm\node_modules\generator-fsharp\app\index.js:239:24)
at yeoman.generators.Base.extend.writing (C:\Users\JeroldHaas\AppData\Roamin
g\npm\node_modules\generator-fsharp\app\index.js:265:14)
at C:\Users\JeroldHaas\AppData\Roaming\npm\node_modules\generator-fsharp\nod
e_modules\yeoman-generator\lib\base.js:421:16
at processImmediate [as _immediateCallback] (timers.js:367:17)
Mispelling of "packagesPath" causes error when using Azure Service Fabric Suave Stateless Service:
events.js:154
throw er; // Unhandled 'error' event
^
Error: spawn C:\Users\jdexter\OneDrive\src\Personal\experiments\Nerdery.RogueOne\Nerdery.RogueOne.Api\.paket\paket.exe ENOENT
at exports._errnoException (util.js:856:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:474:9)
at process._tickCallback (node.js:388:17)
The mispelling appears to be in the *.fsproj file.
At the moment generator is not providing sln
files for generated projects. sln
files are required only for editors such us VS and XS - they are not required from point of view of F#, MSBuild, or other text editors.
Implementing support for sln
files is not trivial and I don't feel it should be high on priority list. Probably easier workaround at the moment would be to provide possibility of creating empty sln
file so VS/XS users can just manually add projects to solution
It would be great to have a template for F# Windows services to be used with Forge.
I'm going to start with the sln
template for now and then try implementing what I found on that page but if I am successful in that perhaps I will poke around a bit here and submit a PR.
I am looking for a way to add an app.config file to an existing project in Atom. Is this the sort of feature which would be appropriate for this project, or is the purpose of this project purely to template new projects from scratch?
Some templates also requires Nuget packages to be used. Example of it is WebAPI template provided by @rodrigovidal (https://github.com/fsprojects/generator-fsharp/pull/4/files).
Personally I feel that we should provide in templates paket.references
files instead of packages.config
. However it can limit usage for people who are not using Paket. Another problem is how to add packages to "solution" level paket.dependencies
file having only paket.references
files from templates. /cc: @forki
Maybe we should make users able to choose between Nuget and Paket? We could provide 2 types of templates - Nuget and Paket - and allow user to choose which one to choose. Or provide only Nuget type of template and run paket conert-from-nuget
when user choose Paket version?
In addition to #42, I would like to be able to ask the user several questions after they select a template. For example, I'd like to copy Eto's project templates for Visual Studio to make them available in Ionide. Those templates ask the user several questions, like "Do you want to use one project per platform (recommended), or combine all platforms into a single project?" and "Do you want to use XAML, JSON, or F# code for your UI elements?" Then based on the user's choices, the template is customized appropriately.
With the current generator-fsharp
setup, I could simulate this by creating several templates with names like EtoMultiProject
and EtoSingleProject
. But that would bloat the list of available templates to no good purpose, and probably confuse newbies. (I'm confused enough already by having bare names with no description, which is why I opened #45 to suggest adding descriptions that the user can see when selecting templates). I would prefer to be able to take a single template and tweak it according to the user's choices. Perhaps #42 could be adapted to that purpose; if the user's choices could be passed as command-line parameters to the script, or as function parameters to some template-specified piece of Javascript code, that would allow adequate template customization.
I've created an empty solution, then, I used the "Add new project to solution" option, but doesn't edit the sln file. I mean, this option doesn't add the project and projectconfiguration sections. I found this question but can't find a way to re-template the .sln file once it have been created.
Here is probably not the best place to ask this question, but I feel that I don't have so many options for it...
I created a project using VS Code and Ionide (which happens to use generator-fsharp, right?) on Linux using the template websharperserverclient, but I couldn't find a way to run the project. I'm surprised about how hard it is to find documentation about anything related to F#, .NET (mono) and command line (the former two are a new world for me).
So, does someone know how to run the project after building it? (I used build.sh
)
The Yeoman generator currently asks questions like "What do You want to do?" and "Do You want to use Paket/FAKE?" While this capitalization would be correct in German, where Du and Sie are capitalized for politeness, this feels wrong to a native English speaker:
http://english.stackexchange.com/questions/30185/you-versus-you-as-polite-form-of-writing
I suggest changing the questions to use lowercase "you" instead of uppercase "You". (Except when the word "You" is the first word of a sentence, of course). Native English speakers won't perceive this as impolite, and they will perceive uppercase "You" as incorrect English.
Note that legalese, such as found in the Apache 2.0 license, is an exception. There, the word "You" is capitalized to indicate that it refers specifically to the person agreeing to the license, and this is defined in the license's "Definitions" section. In such text, "You" should remain capitalized; but in normal text that is presented to the user, the normal rules of English should be followed, and the word "You" should normally become "you" except at the start of a sentence.
When creating a new F# project in Visual Studio Code (which uses the generator-fsharp templates), all I see is a bare list of template names: classlib
, console
, fsunit
... This feels very uninformative. What is the purpose of each template? Is it intended to be a complete project skeleton that I can flesh out, like ProjectScaffold? Is it intended to be a minimal set of useful files for a specific task? The name alone often leaves me guessing.
I would like to see something added to templates.json
where template authors can specify a one-line description, and optionally a longer description that could be shown in appropriate situations. (E.g., a "more" link under the one-line description when it is displayed in an editor like VS Code, or some text prompt to read more about a description when we run via yo fsharp
at the command line).
When creating a basic fs lab project, the School enrollment, tertiary (% gross)
no longer exist in the latest World Bank DataContext
// Use Deedle to get time-series with school enrollment data
let czschool = series cz.``School enrollment, tertiary (% gross)``
let euschool = series eu.``School enrollment, tertiary (% gross)``
A working example was provided by Tomas by changing it to
let czschool = series cz.``Gross enrolment ratio, tertiary, both sexes (%)``
let euschool = series eu.``Gross enrolment ratio, tertiary, both sexes (%)``
// Get 5 years with the largest difference between EU and CZ
abs (czschool - euschool)
|> Series.sort
|> Series.rev
|> Series.take 5
Hello,
Got the last node&npm. I followed the instruction
sudo npm install -g yo
sudo npm install -g generator-sharp
But the drive .cache/yeoman/fsprojects/generator-fsharp is empty.
I'm getting this error when trying top use the generator either from Atom or the console. Any help?
Cheers!
This looks very cool - I don't have everything setup to check this out (sadly!) but I was looking at the FsLab templates and I was a bit surprised to see packages.config
there. Does that mean that the project will use NuGet?
The FsLab templates require Paket - that is, they do not work if you have version number in the folder name, because they always reference FsLab etc. through something like:
#load "../packages/FsLab/FsLab.fsx"
Am I missing something, or are some of the templates still work-in-progress?
Is this intended or is this functionality set to be exclusively for the https://github.com/OmniSharp/generator-aspnet generator?
Here is a question regarding the use of Owin in the WebSharper templates.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.