1 line
8.2 KiB
JavaScript
1 line
8.2 KiB
JavaScript
"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([["1758"],{2812:function(e,s,i){i.r(s),i.d(s,{default:()=>h,frontMatter:()=>o,metadata:()=>t,assets:()=>c,toc:()=>a,contentTitle:()=>n});var t=JSON.parse('{"id":"contribution/adding-languages","title":"Adding Languages","description":"Criteria for a new language","source":"@site/docs/contribution/adding-languages.mdx","sourceDirName":"contribution","slug":"/contribution/adding-languages","permalink":"/docs/contribution/adding-languages","draft":false,"unlisted":false,"editUrl":"https://github.com/live-codes/livecodes/tree/develop/docs/docs/contribution/adding-languages.mdx","tags":[],"version":"current","frontMatter":{}}'),l=i("5893"),d=i("65");let o={},n="Adding Languages",c={},a=[{value:"Criteria for a new language",id:"criteria-for-a-new-language",level:2},{value:"Checklist when adding",id:"checklist-when-adding",level:2}];function r(e){let s={a:"a",h1:"h1",h2:"h2",header:"header",input:"input",li:"li",p:"p",ul:"ul",...(0,d.a)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s.header,{children:(0,l.jsx)(s.h1,{id:"adding-languages",children:"Adding Languages"})}),"\n",(0,l.jsx)(s.h2,{id:"criteria-for-a-new-language",children:"Criteria for a new language"}),"\n",(0,l.jsxs)(s.ul,{children:["\n",(0,l.jsx)(s.li,{children:"Has a syntax that needs to be compiled/transpiled to work in browsers (e.g. not a JS library)."}),"\n",(0,l.jsxs)(s.li,{children:["A compiler/runtime that runs ",(0,l.jsx)(s.a,{href:"/docs/why#client-side",children:"client-side"})," in the browser (not on a remote server)."]}),"\n",(0,l.jsx)(s.li,{children:"Its output can be represented in a web page."}),"\n",(0,l.jsx)(s.li,{children:"Relatively popular (e.g. at least hundreds of GitHub stars/thousands of weekly downloads)."}),"\n",(0,l.jsxs)(s.li,{children:["Not ",(0,l.jsx)(s.a,{href:"https://en.wikipedia.org/wiki/Esoteric_programming_language",children:"esoteric"})," (otherwise, ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/discussions",children:"convince me"})," if you have a good use case)."]}),"\n",(0,l.jsx)(s.li,{children:"The compiler/runtime is still reasonably maintained."}),"\n",(0,l.jsx)(s.li,{children:"The compiler/runtime has a permissive license compatible with MIT license."}),"\n"]}),"\n",(0,l.jsxs)(s.p,{children:["If you still have doubts if the language qualifies, ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/discussions",children:"let's discuss it"}),"."]}),"\n",(0,l.jsx)(s.h2,{id:"checklist-when-adding",children:"Checklist when adding"}),"\n",(0,l.jsxs)(s.ul,{className:"contains-task-list",children:["\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Add ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/tree/develop/src/livecodes/languages",children:"language specs"})," and include that in the list of ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/src/livecodes/languages/languages.ts",children:"languages"})," or ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/src/livecodes/languages/processors.ts",children:"processors"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","The compiler +/- formatter should be lazy-loaded."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","If the compiler needs a separate build, add it to the ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/3a2617850f09487b9af92de862093f082942b8a9/scripts/build.js#L207",children:"build script"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","If the compiler/formatter require installing new packages or adding static files (e.g. wasm) add them to the ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/browser-compilers/",children:"browser compilers repo"})," and load them from ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/3a2617850f09487b9af92de862093f082942b8a9/src/livecodes/vendors.ts#L1",children:"CDN"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Any links to CDN hosted assets should be referenced from ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/src/livecodes/vendors.ts",children:"list of vendors"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Add language name and aliases to ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/3a2617850f09487b9af92de862093f082942b8a9/src/sdk/models.ts#L129",children:"models"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Add editor support (e.g. syntax highlighting) for ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/tree/develop/src/livecodes/editor/monaco",children:"Monaco"}),", ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/tree/develop/src/livecodes/editor/codemirror",children:"CodeMirror"})," and ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/src/livecodes/editor/codejar/codejar.ts",children:"Prismjs"})," (if not auto-loaded)."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Add ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/src/livecodes/html/language-info.html",children:"language info"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Consider adding a ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/tree/develop/src/livecodes/templates/starter",children:"starter template"}),". If you do, add it to the ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/docs/src/components/TemplateList.tsx",children:"list of starter templates"})," in docs, ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/src/livecodes/UI/command-menu-actions.ts#L235",children:"command menu"})," and ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/src/livecodes/html/language-info.html",children:"language info"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Add ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/tree/develop/e2e/specs",children:"end-to-ends tests"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Add language ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/tree/develop/docs/docs/languages",children:"documentation"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Add language to documentation website ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/docs/src/components/LanguageSliders.tsx",children:"slider"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Add compiler/formatter ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/vendor-licenses.mdx",children:"license(s)"}),"."]}),"\n",(0,l.jsxs)(s.li,{className:"task-list-item",children:[(0,l.jsx)(s.input,{type:"checkbox",disabled:!0})," ","Update language count badge in ",(0,l.jsx)(s.a,{href:"https://github.com/live-codes/livecodes/blob/develop/README.mdx",children:"README"}),"."]}),"\n"]})]})}function h(e={}){let{wrapper:s}={...(0,d.a)(),...e.components};return s?(0,l.jsx)(s,{...e,children:(0,l.jsx)(r,{...e})}):r(e)}},65:function(e,s,i){i.d(s,{Z:function(){return n},a:function(){return o}});var t=i(7294);let l={},d=t.createContext(l);function o(e){let s=t.useContext(d);return t.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function n(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:o(e.components),t.createElement(d.Provider,{value:s},e.children)}}}]); |