Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: script modification for different builds #327

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash


versions=($(jq -r '.[].version' version.json))


for version in "${versions[@]}"; do
echo "Building for version: $version"

npx vite build --config vite.config."$version".ts

#Build status
if [ $? -ne 0 ]; then
echo "Build failed for version: $version"
exit 1
fi
done

echo "All builds completed successfully"
9 changes: 7 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[build]
command = "npm run build && mkdir -p ./dist && cp -r ../public/* ./dist/ && mv ./dist/simulatorvue/index.html ./dist/"
command = "npm run build && mkdir -p ./dist && cp -r ../public/* ./dist/ && cp ./dist/simulatorvue/v0/index.html ./dist/index-v0.html && cp ./dist/simulatorvue/v1/index.html ./dist/index-v1.html"

[[redirects]]
from = "/simulatorvue/*"
from = "/simulatorvue/v0/*"
to = "/index.html"
status = 200

[[redirects]]
from = "/simulatorvue/v1/*"
to = "/index.html"
status = 200
9,949 changes: 2,674 additions & 7,275 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"serve": "vite preview",
"build": "vite build",
"build": "bash build.sh",
"dev": "vite",
"preview": "vite preview",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
Expand Down Expand Up @@ -53,6 +53,7 @@
"prettier": "2.6.2",
"typescript": "^4.5.4",
"vite": "^2.9.18",
"vite-plugin-html": "^3.2.2",
"vite-plugin-vuetify": "^1.0.0-alpha.0",
"vue-cli-plugin-vuetify": "~2.5.1",
"vue-tsc": "^0.34.7"
Expand Down
13 changes: 13 additions & 0 deletions version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"version": "v0",
"date": "2024-05-15",
"description": "Pre-Release"
},
{
"version": "v1",
"date": "2024-06-30",
"description": "First Release"
}

]
8 changes: 4 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ export default defineConfig({

// you need to set i18n resource including paths !
include: fileURLToPath(
new URL('./src/locales/**', import.meta.url)
new URL(`./src/locales/**`, import.meta.url)
),
}),
],
resolve: {
alias: {
'#': fileURLToPath(new URL('./src', import.meta.url)),
'@': fileURLToPath(new URL('./src/components', import.meta.url)),
'#': fileURLToPath(new URL(`./src`, import.meta.url)),
'@': fileURLToPath(new URL(`./src/components`, import.meta.url)),
},
},
base: '/simulatorvue/',
build: {
outDir: '../public/simulatorvue',
outDir: `../public/simulatorvue/`,
assetsDir: 'assets',
chunkSizeWarningLimit: 1600,
},
Expand Down
62 changes: 62 additions & 0 deletions vite.config.v0.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'url'
import vueI18n from '@intlify/vite-plugin-vue-i18n'

// https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vite-plugin
import vuetify from 'vite-plugin-vuetify'
import { createHtmlPlugin } from 'vite-plugin-html'

const proxyUrl: string = 'http://localhost:3000'


// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
vuetify({ autoImport: true }),
vueI18n({
// if you want to use Vue I18n Legacy API, you need to set `compositionOnly: false`
// compositionOnly: false,

// you need to set i18n resource including paths !
include: fileURLToPath(
new URL(`./v0/src/locales/**`, import.meta.url)
),
}),
createHtmlPlugin({
minify: true,
inject: {
data: {
injectScript: '<script type="module" src="/v0/src/main.ts"></script>',
},
},
}),
],
resolve: {
alias: {
'#': fileURLToPath(new URL(`./v0/src`, import.meta.url)),
'@': fileURLToPath(new URL(`./v0/src/components`, import.meta.url)),
},
},
base: '/simulatorvue/v0/',
build: {
outDir: `../public/simulatorvue/v0/`,
assetsDir: 'assets',
chunkSizeWarningLimit: 1600,
},
server: {
port: 4000,
proxy: {
// ...(process.env.NODE_ENV === 'development' && {
'^/(?!(simulatorvue)).*': {
target: proxyUrl,
changeOrigin: true,
headers: {
origin: proxyUrl,
},
},
// }),
},
},
})
62 changes: 62 additions & 0 deletions vite.config.v1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'url'
import vueI18n from '@intlify/vite-plugin-vue-i18n'

// https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vite-plugin
import vuetify from 'vite-plugin-vuetify'
import { createHtmlPlugin } from 'vite-plugin-html'

const proxyUrl: string = 'http://localhost:3000'


// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
vuetify({ autoImport: true }),
vueI18n({
// if you want to use Vue I18n Legacy API, you need to set `compositionOnly: false`
// compositionOnly: false,

// you need to set i18n resource including paths !
include: fileURLToPath(
new URL(`./v1/src/locales/**`, import.meta.url)
),
}),
createHtmlPlugin({
minify: true,
inject: {
data: {
injectScript: '<script type="module" src="/v1/src/main.ts"></script>',
},
},
}),
],
resolve: {
alias: {
'#': fileURLToPath(new URL(`./v1/src`, import.meta.url)),
'@': fileURLToPath(new URL(`./v1/src/components`, import.meta.url)),
},
},
base: '/simulatorvue/v1/',
build: {
outDir: `../public/simulatorvue/v1/`,
assetsDir: 'assets',
chunkSizeWarningLimit: 1600,
},
server: {
port: 4000,
proxy: {
// ...(process.env.NODE_ENV === 'development' && {
'^/(?!(simulatorvue)).*': {
target: proxyUrl,
changeOrigin: true,
headers: {
origin: proxyUrl,
},
},
// }),
},
},
})