1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[321],{380:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return i})),n.d(t,"metadata",(function(){return s})),n.d(t,"rightToc",(function(){return l})),n.d(t,"default",(function(){return c}));var o=n(2),r=n(6),a=(n(0),n(470)),i={sidebar_label:"Getting started",title:"Getting started"},s={unversionedId:"guides/getting-started",id:"guides/getting-started",isDocsHomePage:!1,title:"Getting started",description:"NodeGui enables you to create desktop applications with JavaScript. You could see it",source:"@site/docs/guides/getting-started.md",slug:"/guides/getting-started",permalink:"/docs/guides/getting-started",editUrl:"https://github.com/nodegui/nodegui/edit/master/website/docs/guides/getting-started.md",version:"current",sidebar_label:"Getting started",sidebar:"guides",next:{title:"Learn the Basics",permalink:"/docs/guides/tutorial"}},l=[{value:"Developer environment",id:"developer-environment",children:[{value:"Setting up on macOS",id:"setting-up-on-macos",children:[]},{value:"Setting up on Windows",id:"setting-up-on-windows",children:[]},{value:"Setting up on Linux",id:"setting-up-on-linux",children:[]},{value:"A Good Editor",id:"a-good-editor",children:[]},{value:"Hello World",id:"hello-world",children:[]},{value:"Now what?",id:"now-what",children:[]}]}],p={rightToc:l};function c(e){var t=e.components,n=Object(r.a)(e,["components"]);return Object(a.b)("wrapper",Object(o.a)({},p,n,{components:t,mdxType:"MDXLayout"}),Object(a.b)("p",null,"NodeGui enables you to create desktop applications with JavaScript. You could see it\nas a lightly modified variant of the Node.js runtime that is focused on desktop applications\ninstead of web servers."),Object(a.b)("p",null,"NodeGui is also an efficient JavaScript binding to the cross platform graphical user interface\n(GUI) library ",Object(a.b)("inlineCode",{parentName:"p"},"Qt"),". Qt is one of the most mature and efficient libraries for building desktop applications.\nThis enables NodeGui to be extremely memory and CPU efficient compared to other popular Javascript desktop GUI solutions. A hello world app built with NodeGui runs on less than 20MB of memory."),Object(a.b)("h2",{id:"developer-environment"},"Developer environment"),Object(a.b)("p",null,"To turn your operating system into an environment capable of building desktop apps with NodeGui, you would need Node.js, npm, a code editor of your choice, and a rudimentary understanding of your operating system's command line."),Object(a.b)("p",null,"Along with these, there are a few operating system dependent instructions that are listed below."),Object(a.b)("h3",{id:"setting-up-on-macos"},"Setting up on macOS"),Object(a.b)("p",null,Object(a.b)("strong",{parentName:"p"},"Requirements:")),Object(a.b)("ul",null,Object(a.b)("li",{parentName:"ul"},"NodeGui supports macOS 10.10 (Yosemite) and up. NodeGui currently only supports 64bit OS."),Object(a.b)("li",{parentName:"ul"},"Currently supported Node.Js versions are 16.x.")),Object(a.b)("p",null,"We strongly suggest you use some kind of version manager for Node.js. This would allow you to switch to any version of Node.js quite easily. We recommend ",Object(a.b)("inlineCode",{parentName:"p"},"nvm"),": ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"https://github.com/nvm-sh/nvm"}),"https://github.com/nvm-sh/nvm")),Object(a.b)("p",null,"Confirm that both ",Object(a.b)("inlineCode",{parentName:"p"},"node")," and ",Object(a.b)("inlineCode",{parentName:"p"},"npm")," are available by running:"),Object(a.b)("pre",null,Object(a.b)("code",Object(o.a)({parentName:"pre"},{className:"language-sh"}),"# This command should print the version of Node.js\nnode -v\n\n# This command should print the version of npm\nnpm -v\n")),Object(a.b)("p",null,"If both commands printed a version number, you are all set! Before you get\nstarted, you might want to install a ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"#a-good-editor"}),"code editor")," suited\nfor JavaScript development."),Object(a.b)("h3",{id:"setting-up-on-windows"},"Setting up on Windows"),Object(a.b)("p",null,Object(a.b)("strong",{parentName:"p"},"Requirements:")),Object(a.b)("ul",null,Object(a.b)("li",{parentName:"ul"},"NodeGui supports Windows 7 and later on 64bit operating systems."),Object(a.b)("li",{parentName:"ul"},"Currently supported Node.js versions are 16.x and up.")),Object(a.b)("p",null,"We strongly suggest you use some kind of version manager for Node.js. This would allow you to switch to any version of Node.js quite easily."),Object(a.b)("p",null,"We strongly recommend Powershell as preferred terminal in Windows."),Object(a.b)("p",null,"Confirm that both ",Object(a.b)("inlineCode",{parentName:"p"},"node")," and ",Object(a.b)("inlineCode",{parentName:"p"},"npm")," are available by running:"),Object(a.b)("pre",null,Object(a.b)("code",Object(o.a)({parentName:"pre"},{className:"language-powershell"}),"# This command should print the version of Node.js\nnode -v\n\n# This command should print the version of npm\nnpm -v\n")),Object(a.b)("p",null,"If both commands printed a version number, you are all set! Before you get\nstarted, you might want to install a ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"#a-good-editor"}),"code editor")," suited\nfor JavaScript development."),Object(a.b)("h3",{id:"setting-up-on-linux"},"Setting up on Linux"),Object(a.b)("blockquote",null,Object(a.b)("p",{parentName:"blockquote"},"NodeGui currently supports Ubuntu 16.04 and Debian 10 and up. Although other Linux distributions can also be easily supported. NodeGui currently only supports 64bit OS.")),Object(a.b)("p",null,Object(a.b)("strong",{parentName:"p"},"Requirements:")),Object(a.b)("ul",null,Object(a.b)("li",{parentName:"ul"},"Currently supported Node.js versions are 16.x and up.")),Object(a.b)("p",null,"We strongly suggest you use some kind of version manager for Node.js. This would allow you to switch to any version of Node.js quite easily. We recommend ",Object(a.b)("inlineCode",{parentName:"p"},"nvm"),": ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"https://github.com/nvm-sh/nvm"}),"https://github.com/nvm-sh/nvm")),Object(a.b)("p",null,"Confirm that both ",Object(a.b)("inlineCode",{parentName:"p"},"node")," and ",Object(a.b)("inlineCode",{parentName:"p"},"npm")," are available by running:"),Object(a.b)("pre",null,Object(a.b)("code",Object(o.a)({parentName:"pre"},{className:"language-sh"}),"# This command should print the version of Node.js\nnode -v\n\n# This command should print the version of npm\nnpm -v\n")),Object(a.b)("p",null,"If both commands printed a version number, you are all set! Before you get\nstarted, you might want to install a ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"#a-good-editor"}),"code editor")," suited\nfor JavaScript development."),Object(a.b)("h3",{id:"a-good-editor"},"A Good Editor"),Object(a.b)("p",null,"We might suggest two free popular editors: GitHub's ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"https://atom.io/"}),"Atom")," and Microsoft's ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"https://code.visualstudio.com/"}),"Visual Studio Code"),". Both of them have excellent JavaScript support."),Object(a.b)("p",null,"If you are one of the many developers with a strong preference, know that virtually all code editors and IDEs these days support JavaScript."),Object(a.b)("h4",{id:"using-your-own-custom-qt-installation-optional"},"Using your own custom Qt installation (Optional)"),Object(a.b)("p",null,Object(a.b)("strong",{parentName:"p"},"Compiling Qt from source")),Object(a.b)("p",null,"You will need to download and install Qt from source since there are no binaries from Qt for M1 yet."),Object(a.b)("p",null,"(",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"https://www.reddit.com/r/QtFramework/comments/ll58wg/how_to_build_qt_creator_for_macos_arm64_a_guide/"}),"https://www.reddit.com/r/QtFramework/comments/ll58wg/how_to_build_qt_creator_for_macos_arm64_a_guide/"),")"),Object(a.b)("pre",null,Object(a.b)("code",Object(o.a)({parentName:"pre"},{}),"git clone git://code.qt.io/qt/qt5.git\ncd qt5\ngit checkout 5.15\n\n./init-repository --module-subset=essential -f\ngit submodule init qtsvg\ngit submodule update qtsvg\n\ncd ..\nmkdir qt5-5.15-macOS-release\ncd qt5-5.15-macOS-release\n\n../qt5/configure -release QMAKE_APPLE_DEVICE_ARCHS=arm64 -opensource -confirm-license -nomake examples -nomake tests -skip qt3d -skip webengine -skip qtactiveqt -skip qtcanvas3d -skip qtdeclarative -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtcharts -skip qtgraphicaleffects -skip qtlocation -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtvirtualkeyboard -skip qtscript\n\nmake -j15\n\nmake install\n")),Object(a.b)("p",null,"This should install Qt into something like this ",Object(a.b)("inlineCode",{parentName:"p"},"/usr/local/Qt-5.15.3")," (your directory can change. This will be displayed when running make)"),Object(a.b)("p",null,Object(a.b)("strong",{parentName:"p"},"Pointing nodegui to use your custom Qt installation")),Object(a.b)("p",null,"Now just set ",Object(a.b)("inlineCode",{parentName:"p"},"export QT_INSTALL_DIR=<your qt path>")," . In the above example it would look something like this ",Object(a.b)("inlineCode",{parentName:"p"},"export QT_INSTALL_DIR=/usr/local/Qt-5.15.3"),". Add this in your .zshrc or .bashrc so that you dont need to repeat this process again."),Object(a.b)("p",null,"Now just ",Object(a.b)("inlineCode",{parentName:"p"},"rm -rf node_modules")," and do ",Object(a.b)("inlineCode",{parentName:"p"},"npm install")," again."),Object(a.b)("p",null,"The logs should say something like ",Object(a.b)("inlineCode",{parentName:"p"},"CustomQt detected at <your qt path>. Hence, skipping Mini Qt installation"),"."),Object(a.b)("h3",{id:"hello-world"},"Hello World"),Object(a.b)("p",null,"Clone and run the code in this tutorial by using the\n",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"https://github.com/nodegui/nodegui-starter"}),Object(a.b)("inlineCode",{parentName:"a"},"nodegui/nodegui-starter"))," repository."),Object(a.b)("p",null,Object(a.b)("strong",{parentName:"p"},"Note"),": Running this requires ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"https://git-scm.com"}),"Git")," and ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"https://www.npmjs.com/"}),"npm"),"."),Object(a.b)("pre",null,Object(a.b)("code",Object(o.a)({parentName:"pre"},{className:"language-sh"}),"\ngit clone https://github.com/nodegui/nodegui-starter\n\ncd nodegui-starter\n\nnpm install\n\nnpm start\n\n")),Object(a.b)("p",null,Object(a.b)("strong",{parentName:"p"},"Note"),": If you encounter errors installing ",Object(a.b)("inlineCode",{parentName:"p"},"nodegui"),", please check the ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"/docs/faq#why-does-installation-fail-at-minimal-qt-setup"}),"FAQs")," for additional help."),Object(a.b)("p",null,"That's it!"),Object(a.b)("p",null,"Congratulations! You've successfully run and modified your first NodeGui app."),Object(a.b)("h3",{id:"now-what"},"Now what?"),Object(a.b)("p",null,"If you're curious to learn more about NodeGui, continue on to the ",Object(a.b)("a",Object(o.a)({parentName:"p"},{href:"/docs/guides/tutorial"}),"tutorial"),"."))}c.isMDXComponent=!0},470:function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return m}));var o=n(0),r=n.n(o);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=r.a.createContext({}),c=function(e){var t=r.a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},u=function(e){var t=c(e.components);return r.a.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},b=r.a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(n),b=o,m=u["".concat(i,".").concat(b)]||u[b]||d[b]||a;return n?r.a.createElement(m,s(s({ref:t},p),{},{components:n})):r.a.createElement(m,s({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=b;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p<a;p++)i[p]=n[p];return r.a.createElement.apply(null,i)}return r.a.createElement.apply(null,n)}b.displayName="MDXCreateElement"}}]); |