THE BEGINNING What is Aurelia? What is TypeScript?
What is Visual Studio Code? If you do not know the answer to any of these questions, I suggest you google them, get the basic idea and then come back here. Because this post assumes that you know what these three things are. THE PREREQUISITES. Install. Install. Install Bonus point: Use a good console emulator on Windows.
ConEmu, Console2. If you are going to spend time on the console, it better be a nice looking window. Yeoman is a scaffolding tool. We will use Yeoman to do a bit of our bidding. When I said from scratch, I did not mean I will start from the hardware now, did I? THE FOREWORD (GET SET.) This is a step by step instruction guide.
I will explain things as much as possible. Some, I will just leave it to your curiosity to go search and find out. This whole thing is command line heavy. (refer to bonus point above). Why am I doing this from scratch? To show what the different files mean, what the different packages being installed do and how they actually come together.
It is very easy to just download the starter kit on aurelia.io or the skeleton project. There is absolutely nothing wrong with using the skeleton or downloading the starter kit, in fact, that is what most of us will be doing anyways.
You said Yeoman is a scaffolding tool! Why not just use that to create this? Good question.
There are generators. In fact there is one for typescript Aurelia too. But it is not updated, uses definitions that are 4 months old and some have fallen on the way side of maintenance. People have explored space and found new life since the time some of them got updated (Gross exaggeration.).
Anyways, the point is, they are not from the official Aurelia folks, so cannot be relied upon. Before you go any further, make sure the prerequisites are met.
Open a command prompt (I use conemu) and navigate to your favorite PoC or Demo or Dev folder. The bullet points give you an idea what that command is doing.
You can just skip the bullet points if you know what the command is for and just hit the command. Note: the '$' at the beginning of the command is just the prompt. The command follows the dollar. Install Yeoman globally. Visual Studio Code does not understand the objects and modules you will use in your JavaScript and TypeScript modules. If you write a TypeScript module, then Visual Studio Code knows what the interfaces and definitions are.
When you install a third party library such as jQuery or gulp, you need to tell TypeScript about them. So, if you use the '$' symbol for jQuery, TypeScript is going to assume you meant 'gorilla' and mistakenly typed '$'. Hence, you will have to tell TypeScript that Gorilla is a mammal, from the animal kingdom, is big scary.etc. But it will be a royal pain if we have to create the type information for every library we add.
It is a package manager that provides TypeScript definitions for many popular and not so popular third party libraries. The way things work is, you provide the definition in a '.d.ts' file.
The moment VSCode sees a.d.ts file, it will scan it to understand that '$' means jQuery and not gorilla. Let us initialize tsd. This will create a tsd.json and a typings folder where it will install all the typings we tell it to install.
Frankly, all you need is that 'package.json' file and the gulp build files. It won't change unless you add more to it. Which is what we are going to do now. Here on, it is actually about showing what Aurelia can do.
There are tons of articles and videos showing how to scaffold and get started with Aurelia. My goal with this post is to highlight the various files involved and why they are there and how to best use them. THE HELPING HAND Let us take our application a little further. But before we go any further, let us add a few things to make our development experience a little better. As you make edits and make more changes, it will be a boring thing to constantly do a 'gulp build-system' or 'gulp build-html'. Let us automate that. Now that you know where the gulp tasks go, let us begin there.
Right click your build/tasks folder and a JavaScript file 'watch.js' and add the following code to it. This will create a task called watch, which will monitor our three file types, 'ts', 'html' and 'css' and run their respective compilation tasks when they are changed. AURELIA Now that we have something of a structure and a skeleton, let us dig in a little deep and get to know Aurelia a little better. And, yes, the blog is still about setting up an Aurelia application (from scratch. Install more of Aurelia framework packages. Ideally, we would have required aurelia-framework and aurelia-bootstrapper. But it is considered a good practice to directly install a package if you will reference it.
Video DownloadHelper for Mac, free and safe download. Video DownloadHelper latest version: Download and convert videos directly in Firefox. Download Video DownloadHelper for Mac now from Softonic: 100% safe and virus free. More than 289 downloads this month. Download Video. Boerse downloadhelper for mac.
Also, a bug in babel transpiler currently requires some of the internal packages also to be installed. Let us not worry too much about that and install the needed packages. A NEW BEGINNING You are now all set to follow all the aurelia blogs, articles and of course the official aurelia docs to get more out of your Aurelia application.
This is only a beginning. A start to creating your own skeleton. So where to go from here?
Look up Custom Elements, Custom Attributes, testing with Karma and protractor. There is so much to learn and apply. This is just a beginning.
I will write more and be back with more. Hope this was an easy to follow guide and helped you understand all those different files that make up an aurelia project.