luigi-core-vue-setup

Created Diff never expires
49 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
84 lines
71 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
105 lines
#!/usr/bin/env bash
```bash
if ! command -v vue 2>/dev/null; then
echo "Vue CLI required, please install it globally and try again."
echo "npm i -g @vue/cli"
exit 1;
fi

echo ""
echo "Installing Luigi with static files and basic configuration"
echo ""
if [[ "$1" = "" ]]; then
read -p "Luigi project folder name: " folder
else
folder=$1
echo "Luigi project folder name: $folder"
fi

# create sample vue app
# create sample vue app
vue create -d $folder && cd $folder
vue create -d my-vue-app && cd my-vue-app


# install dependencies
# install dependencies
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/package.json > package.json
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/package.json > package.json
npm i
npm i
# as soon as new package.json under vue example released this line can be removed
npm i webpack-cli@4.2.0 node-sass@4.14.1


mkdir -p src/views src/router
mkdir -p src/luigi-config src/assets/scss src/views public/assets


# cleanup default installation
# cleanup default installation
rm public/index.html src/app.vue # remove default index, will be replaced with example assets
# remove default index, will be replaced with example assets
rm public/index.html src/app.vue
rm -rf src/components
rm -rf src/components


echo "@import '~fundamental-styles/dist/fundamental-styles.css';" > src/assets/scss/style.scss

# set scripts
# set scripts
echo "const CopyWebpackPlugin = require('copy-webpack-plugin');
echo "const webpack = require('webpack');

const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
module.exports = {

chainWebpack: config => {
config.resolve.symlinks(false)
},
pages: {
pages: {
sampleapp: {
sampleapp: {
entry: 'src/main.js',
entry: 'src/main.js',
template: 'public/sampleapp.html',
template: 'public/sampleapp.html',
filename: 'sampleapp.html'
filename: 'sampleapp.html'
}
}
},
},
lintOnSave:true,
runtimeCompiler: true,
runtimeCompiler: true,
outputDir: 'dist',
outputDir: 'dist',
configureWebpack: {
configureWebpack: {
module: {
rules: [
{
test: /\.css$/,
use: ['css-loader']
},
{
test: /\.scss$/,
use: ['sass-loader']
}
]
},
plugins: [
plugins: [
new CopyWebpackPlugin({
new CopyWebpackPlugin(
patterns: [
[
{context:'public',to:'index.html',from:'index.html'},
{context:'node_modules/@luigi-project/core',to:'./luigi-core',from:{glob:'**',dot:true}},
{context:'node_modules/@luigi-project/client',to:'./luigi-client',from:{glob:'**',dot:true}},
{
{
context: 'public',
from: 'node_modules/fundamental-styles/dist',
to: 'index.html',
to: './fundamental-styles'
from: 'index.html'
},
},
{
{
from: 'node_modules/@luigi-project/core',
from: 'node_modules/@sap-theming/theming-base-content',
to: './luigi-core',
to: './fonts'
}
}
]
],
}),
{ignore:['.gitkeep','**/.DS_Store','**/Thumbs.db'],debug:'warning'}
]
)]
}
}
};" > vue.config.js
};" > vue.config.js


echo "const path = require('path');
module.exports = {
entry: './src/luigi-config/luigi-config.es6.js',
output: {
filename: 'luigi-config.js',
path: path.resolve(__dirname, 'public'),
},
};" > webpack.config.js

sed 's/"scripts": {/"scripts": {\
\ "buildConfig":"webpack --config webpack.config.js",/1' package.json > p.tmp.json && mv p.tmp.json package.json

echo '{
"globals": {
"Luigi": "readonly"
}
}' > .eslintrc.json

mkdir -p src/luigi-config


# fetch assets from vue example
# fetch assets from vue example
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/public/index.html > public/index.html
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/public/index.html > public/index.html
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/public/sampleapp.html > public/sampleapp.html
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/public/sampleapp.html > public/sampleapp.html
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/App.vue > src/App.vue
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/app.vue > src/app.vue
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/main.js > src/main.js
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/main.js > src/main.js
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/public/luigi-config.js > public/luigi-config.js
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/public/luigi-config.js > src/luigi-config/luigi-config.es6.js


curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/router/index.js > src/router/index.js
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/router.js > src/router.js
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/store.js > src/store.js


curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/views/Home.vue > src/views/Home.vue
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/views/home.vue > src/views/home.vue
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/views/Sample1.vue > src/views/Sample1.vue
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/views/sample1.vue > src/views/sample1.vue
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/views/Sample2.vue > src/views/Sample2.vue
curl https://raw.githubusercontent.com/SAP/luigi/main/core/examples/luigi-example-vue/src/views/sample2.vue > src/views/sample2.vue


# generic assets
# generic assets


npm run build
npm run buildConfig
npm run serve
npm run serve
```