This repository contains the source code for the CosmicDS website. The website is created using Vue.js and uses Vuetify for styling.
For contributors, a brief breakdown of the project structure is as follows:
- The top-level directory primarily contains various configuration files, along with the license.
- The
publicdirectory is the home for static content that we want exposed to users - for example,public/cosmicds.jpgwill be accessible in the built webpage as<root-url>/cosmicds.jpg. - The
srcdirectory contains the Vue source code. Currently all of the code is written in TypeScript. Continuing this would be a good practice, but one of the benefits of Vue is that using TypeScript or not can be controlled at a component level.App.vueandmain.tsare the primary entry points for the page, although they contain almost no content themselves.assetsis for static content that won't get exposed to the user (that is, it won't get its own URL).components, and its sub-folders, are for Vue components, ideally ones that will get re-used across multiple pages. The components that define a specific route should be placed inviews(see below). For a more thorough explanation, see this StackOverflow answer.layoutscontains the layouts that we want to define across the site. This project is set up to use a layout-based system reminiscent of something like Nuxt. This setup allows us to create views and components without worrying about the overall page layout (e.g. the nav bar, footer, etc).layouts/AppLayout.vueis the layout-managing component, and will automatically update the layout (if necessary) on a route change. In the current project configuration, layouts are set by the current route, withlayouts/DefaultLayout.vueserving as the layout is no layout is specified. See theroutersection below for how to specify a layout.mixinscontain any mixins that we want to use. To use a mixin in a component, the component should inherit from the output of theMixinsfunction from vue-property-decorator, rather than that package'sVueclass.pluginscontains any plugins that we want to use. These get imported inmain.ts.routercontains the necessary code for the Vue router. To define a new route, add a new entry toroutesinrouter/index.ts. Each route should have the structure:
Here{ path: string = "/the-route-to-use", name: "Route name", component: ComponentToUse, meta: { layout: "LayoutName" } }ComponentToUseis the component class fromviewsthat should serve as the main component of the route, andmeta.layoutis the name of the layout component that you want (not a reference to the component itself). Ifmeta.layoutis not specified, the default layout will be used. Lazy-loading of components is possible through theimportComponentfunction inrouter/index.ts. An instance of the component class will automatically be placed inside the specified layout.storecontains the Vuex store, which is split into various modules. Currently,websitecontains website-level settings, whileapicontains functionality for interacting with the CosmicDS API. The Vuex store in this repository uses the decorators from vuex-property-decorators.utilscontains any utility code that doesn't fit elsewhere.viewsis intended to contain the components for the actual routes, or "pages", that a user will visit. Basically, anything that gets its own URL should be a component inviews.
The site can be built using npm run build. Linting (using ESLint) can be performed using npm run lint Assuming there are no errors, you can run the development server for local testing using npm run serve.
On any update to the main branch, the website is rebuilt and deployed to GitHub Pages via a GitHub Actions workflow.