Skip to content

Commit

Permalink
add javascript vite boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Jun 20, 2024
1 parent eaf8386 commit c98e0a6
Show file tree
Hide file tree
Showing 15 changed files with 2,008 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/javascript.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: JavaScript

on:
push:
paths:
- javascript/**
- .github/workflows/javascript.yaml

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy Prepare
run: |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
echo "DEPLOY_URL=javascript" >> $GITHUB_ENV
- name: Deploy Commit
run: |
echo "SHORT_SHA=${SHORT_SHA}"
echo "DEPLOY_URL=commits/${SHORT_SHA}/javascript" >> $GITHUB_ENV
if: github.ref != 'refs/heads/main'
- name: Deploy URL
run: echo "DEPLOY_URL=${DEPLOY_URL}"
- uses: actions/setup-node@v2
with:
node-version: '15.x'
registry-url: 'https://registry.npmjs.org'
scope: '@hal9ai'
- run: yarn install
working-directory: ./javascript
5 changes: 5 additions & 0 deletions javascript/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
dist/
node_modules/
thumbs.db
.idea/
13 changes: 13 additions & 0 deletions javascript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Development

Local setup

```
yarn clean && yarn install
```

Live development

```
yarn dev
```
10 changes: 10 additions & 0 deletions javascript/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<html lang="en">
<head>
<title>Hal9: Effortlessly create AI coworkers</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
29 changes: 29 additions & 0 deletions javascript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "hal9landing",
"version": "0.0.16",
"scripts": {
"clean": "rm -rf node_modules",
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^2.7.14"
},
"devDependencies": {
"@vitejs/plugin-vue2": "^2.2.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.50.0",
"postcss": "^8.4.30",
"postcss-extend-rule": "^4.0.0",
"prettier": "^3.0.3",
"prettier-plugin-css-order": "^2.0.0",
"prettier-plugin-tailwindcss": "^0.5.4",
"rollup-plugin-copy": "^3.5.0",
"sass": "^1.70.0",
"tailwindcss": "^3.3.3",
"terser": "^5.20.0",
"vite": "^4.4.9",
"vite-plugin-environment": "^1.1.3"
}
}
8 changes: 8 additions & 0 deletions javascript/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
plugins: {
'postcss-extend-rule': {},
'tailwindcss/nesting': {},
tailwindcss: {},
autoprefixer: {},
},
};
9 changes: 9 additions & 0 deletions javascript/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const hal9PrettierConfig = require('../.prettierrc.json');

module.exports = {
...hal9PrettierConfig,
plugins: [
require.resolve('prettier-plugin-css-order'),
require.resolve('prettier-plugin-tailwindcss'),
],
};
Binary file not shown.
Binary file added javascript/public/fonts/Supreme-Variable.woff2
Binary file not shown.
32 changes: 32 additions & 0 deletions javascript/src/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<div :class="{ dark: dark }">
Hello World
</div>
</template>

<script>
export default {
name: 'App',
components: {
},
data() {
return {
};
},
computed: {
},
created() {
},
async mounted() {
},
beforeDestroy() {
},
methods: {
},
watch: {
},
};
</script>

<style lang="postcss" scoped>
</style>
10 changes: 10 additions & 0 deletions javascript/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Vue from 'vue';
import app from './app.vue';
import './styles/main.css';

(async function () {
const vue = new Vue({
el: '#app',
render: (h) => h(app),
});
})();
55 changes: 55 additions & 0 deletions javascript/src/styles/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
@font-face {
font-style: normal;
font-weight: 100 900;
src: url(/fonts/Supreme-Variable.woff2) format('woff2-variations');
font-family: 'Supreme';
}
@font-face {
font-style: normal;
font-weight: 100 900;
src: url(/fonts/SpaceGrotesk-Variable.woff2) format('woff2-variations');
font-family: 'SpaceGrotesk';
}
h1 {
font-weight: 700;
font-size: 32px;
line-height: 1.5;
font-family: 'SpaceGrotesk';

@media screen(lg) {
font-size: 64px;
line-height: 1.25;
}
}
h2 {
font-weight: 700;
font-size: 24px;
line-height: 1.276;
font-family: 'SpaceGrotesk';

@media screen(lg) {
font-size: 36px;
}
}
h3 {
font-weight: 700;
font-size: 20px;
line-height: 1.276;
font-family: 'SpaceGrotesk';
letter-spacing: 0.1em;

@media screen(lg) {
font-size: 24px;
}
}
}

@layer components {
/* Note: anything you might want to @apply elsewhere should be defined as a plugin in tailwind.config.js,
as explained here: https://tailwindcss.com/docs/functions-and-directives#using-apply-with-per-component-css */
}
24 changes: 24 additions & 0 deletions javascript/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/** @type {import('tailwindcss').Config} */

const defaultTheme = require('tailwindcss/defaultTheme');
const plugin = require('tailwindcss/plugin');

module.exports = {
darkMode: 'class',
content: [
'./index.html',
'./src/**/*.{vue,js,ts,jsx,tsx}',
],
theme: {
extend: {
fontFamily: {
sans: ['Supreme', ...defaultTheme.fontFamily.sans],
sg: ['SpaceGrotesk', ...defaultTheme.fontFamily.sans],
},
},
},
plugins: [
plugin(function ({ addComponents }) {
}),
],
};
54 changes: 54 additions & 0 deletions javascript/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { fileURLToPath, URL } from 'node:url';

import { defineConfig } from 'vite';
import EnvironmentPlugin from 'vite-plugin-environment';
import vue2 from '@vitejs/plugin-vue2';
import packageFile from './package.json';
import copy from 'rollup-plugin-copy';

console.log('vite.config.js environment: ' + process.env.HAL9_ENV);

// https://vitejs.dev/config/
export default defineConfig({
clearScreen: false,
plugins: [
EnvironmentPlugin({ HAL9_ENV: null }),
vue2({
template: {
transformAssetUrls: {
// these are in addition to the defaults listed here: https://github.com/vitejs/vite-plugin-vue2#asset-url-handling
object: ['data'],
},
},
}),
copy({
targets: [{ src: 'dist/index.html', dest: 'dist', rename: 'for.html' }],
hook: 'writeBundle',
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
port: 8090,
host: true,
// open: '/index.html'
},
preview: {
port: 8090,
// 'host' and 'open' pulled from 'server' config by default
},
build: {
rollupOptions: {
input: {
app: './index.html',
},
},
},
define: {
VERSION: JSON.stringify(packageFile.version),
HAL9ENV: JSON.stringify(process.env.HAL9_ENV ? process.env.HAL9_ENV : 'local'),
},
});
Loading

0 comments on commit c98e0a6

Please sign in to comment.