Project M Install Guide

0 views
Skip to first unread message

Shu Manwill

unread,
Aug 5, 2024, 1:29:47 PM8/5/24
to crafcourtoedams
Inthis section we will introduce how to scaffold a Vue Single Page Application on your local machine. The created project will be using a build setup based on Vite and allow us to use Vue Single-File Components (SFCs).

Make sure you have an up-to-date version of Node.js installed and your current working directory is the one where you intend to create a project. Run the following command in your command line (without the $ sign):


You should now have your first Vue project running! Note that the example components in the generated project are written using the Composition API and , rather than the Options API. Here are some additional tips:


When using Vue from a CDN, there is no "build step" involved. This makes the setup a lot simpler, and is suitable for enhancing static HTML or integrating with a backend framework. However, you won't be able to use the Single-File Component (SFC) syntax.


Many of the examples for Composition API throughout the guide will be using the syntax, which requires build tools. If you intend to use Composition API without a build step, consult the usage of the setup() option.


Throughout the rest of the documentation, we will be primarily using ES modules syntax. Most modern browsers now support ES modules natively, so we can use Vue from a CDN via native ES modules like this:


While it is possible to use Vue without a build system, an alternative approach to consider is using vuejs/petite-vue that could better suit the context where jquery/jquery (in the past) or alpinejs/alpine (in the present) might be used instead.


If you directly open the above index.html in your browser, you will find that it throws an error because ES modules cannot work over the file:// protocol, which is the protocol the browser uses when you open a local file.


Due to security reasons, ES modules can only work over the protocol, which is what the browsers use when opening pages on the web. In order for ES modules to work on our local machine, we need to serve the index.html over the protocol, with a local HTTP server.


To start a local HTTP server, first make sure you have Node.js installed, then run npx serve from the command line in the same directory where your HTML file is. You can also use any other HTTP server that can serve static files with the correct MIME types.


You may have noticed that the imported component's template is inlined as a JavaScript string. If you are using VS Code, you can install the es6-string-html extension and prefix the strings with a /*html*/ comment to get syntax highlighting for them.


If using an Ubuntu version older than 22.04, it is necessary to add extrarepositories to meet the minimum required versions for the maindependencies listed above. In that case, download, inspect and executethe Kitware archive script to add the Kitware APT repository to yoursources list.A detailed explanation of kitware-archive.sh can be found herekitware third-party apt repository:


These instructions must be run in a cmd.exe command prompt terminal window.In modern version of Windows (10 and later) it is recommended to install the Windows Terminalapplication from the Microsoft Store. The required commands differ on PowerShell.


It is easy to run into Python package incompatibilities when installingdependencies at a system or user level. This situation can happen,for example, if working on multiple Zephyr versions or other projectsusing Python on the same machine.


The -p always option forces a pristine build, and is recommended for newusers. Users may also use the -p auto option, which will useheuristics to determine if a pristine build is required, such as when buildinganother sample.


A board may contain one or multiple SoCs, Also, each SoC may contain one ormore CPU clusters.When building for such boards it is necessary to specify the SoC or CPUcluster for which the sample must be built.For example to build Blinky for the cpuapp core onthe nRF5340DK the board must be provided as:nrf5340dk/nrf5340/cpuapp. See also Board terminology for moredetails.


Doing this makes it easier for people to help you, and also helps other userssearch the archives. Unnecessary screenshots exclude vision impaireddevelopers; some are major Zephyr contributors. Accessibility has beenrecognized as a basic human right by the United Nations.


Vite is opinionated and comes with sensible defaults out of the box. Read about what's possible in the Features Guide. Support for frameworks or integration with other tools is possible through Plugins. The Config Section explains how to adapt Vite to your project if needed.


During development, Vite sets esnext as the transform target, because we assume a modern browser is used and it supports all of the latest JavaScript and CSS features. This prevents syntax lowering, letting Vite serve modules as close as possible to the original source code.


For the production build, by default Vite targets browsers that support native ES Modules, native ESM dynamic import, and import.meta. Legacy browsers can be supported via the official @vitejs/plugin-legacy. See the Building for Production section for more details.


You can try Vite online on StackBlitz. It runs the Vite-based build setup directly in the browser, so it is almost identical to the local setup but doesn't require installing anything on your machine. You can navigate to vite.new/template to select which framework to use.


create-vite is a tool to quickly start a project from a basic template for popular frameworks. Check out Awesome Vite for community maintained templates that include other tools or target different frameworks.


One thing you may have noticed is that in a Vite project, index.html is front-and-central instead of being tucked away inside public. This is intentional: during development Vite is a server, and index.html is the entry point to your application.


Vite treats index.html as source code and part of the module graph. It resolves that references your JavaScript source code. Even inline and CSS referenced via also enjoy Vite-specific features. In addition, URLs inside index.html are automatically rebased so there's no need for special %PUBLIC_URL% placeholders.


Similar to static http servers, Vite has the concept of a "root directory" which your files are served from. You will see it referenced as throughout the rest of the docs. Absolute URLs in your source code will be resolved using the project root as base, so you can write code as if you are working with a normal static file server (except way more powerful!). Vite is also capable of handling dependencies that resolve to out-of-root file system locations, which makes it usable even in a monorepo-based setup.


Running vite starts the dev server using the current working directory as root. You can specify an alternative root with vite serve some/sub/dir. Note that Vite will also resolve its config file (i.e. vite.config.js) inside the project root, so you'll need to move it if the root is changed.


Composer is not a package manager in the same sense as Yum or Apt are. Yes,it deals with "packages" or libraries, but it manages them on a per-projectbasis, installing them in a directory (e.g. vendor) inside your project. Bydefault, it does not install anything globally. Thus, it is a dependencymanager. It does however support a "global" project for convenience via theglobal command.


Composer in its latest version requires PHP 7.2.5 to run. A long-term-supportversion (2.2.x) still offers support for PHP 5.3.2+ in case you are stuck witha legacy PHP version. A few sensitive php settings and compile flags are alsorequired, but when using the installer you will be warned about anyincompatibilities.


Composer needs several supporting applications to work effectively, making theprocess of handling package dependencies more efficient. For decompressingfiles, Composer relies on tools like 7z (or 7zz), gzip, tar, unrar,unzip and xz. As for version control systems, Composer integrates seamlesslywith Fossil, Git, Mercurial, Perforce and Subversion, thereby ensuring theapplication's smooth operation and management of library repositories. Beforeusing Composer, ensure that these dependencies are correctly installed on yoursystem.


Composer offers a convenient installer that you can execute directly from thecommand line. Feel free to download this fileor review it on GitHubif you wish to know more about the inner workings of the installer. The sourceis plain PHP.


The installer will check a few PHP settings and then download composer.pharto your working directory. This file is the Composer binary. It is a PHAR(PHP archive), which is an archive format for PHP which can be run onthe command line, amongst other things.


You can install Composer to a specific directory by using the --install-diroption and additionally (re)name it as well using the --filename option. Whenrunning the installer when followingthe Download page instructions add thefollowing parameters:


You can place the Composer PHAR anywhere you wish. If you put it in a directorythat is part of your PATH, you can access it globally. On Unix systems youcan even make it executable and invoke it without directly using the phpinterpreter.


Note: On some versions of macOS the /usr directory does not exist bydefault. If you receive the error "/usr/local/bin/composer: No such file ordirectory" then you must create the directory manually before proceeding:mkdir -p /usr/local/bin.


Note: You may also use composer instead of composer/composer as image name above. It is shorter and is a Docker official image but is not published directly by us and thus usually receives new releases with a delay of a few days. Important: short-aliased images don't have binary-only equivalents, so for COPY --from approach it's better to use composer/composer ones.


The create astro CLI command is the fastest way to start a new Astro project from scratch. It will walk you through every step of setting up your new Astro project and allow you to choose from a few different official starter templates.

3a8082e126
Reply all
Reply to author
Forward
0 new messages