chore: Init package

This commit is contained in:
Fándly Gergő 2021-01-05 17:03:18 +02:00
commit 6362a7fde9
8 changed files with 6349 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/*
build/*

7
.prettierrc.json Normal file
View File

@ -0,0 +1,7 @@
{
"useTabs": true,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}

3
babel.config.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-env']
};

6248
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

28
package.json Normal file
View File

@ -0,0 +1,28 @@
{
"name": "proiect",
"version": "1.0.0",
"description": "Proiect PIU",
"main": "src/index.js",
"scripts": {
"start": "webpack serve",
"build": "cross-env NODE_ENV=production webpack",
"format": "prettier --write src",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Fandly Gergo",
"license": "GPL-3.0",
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"babel-loader": "^8.2.2",
"copy-webpack-plugin": "^7.0.0",
"cross-env": "^7.0.3",
"css-loader": "^5.0.1",
"prettier": "^2.2.1",
"sass-loader": "^10.1.0",
"style-loader": "^2.0.0",
"webpack": "^5.11.1",
"webpack-cli": "^4.3.1",
"webpack-dev-server": "^3.11.1"
}
}

15
src/index.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<meta charset="utf-8" />
<script src="./index.js"></script>
</head>
<body>
<p>Test</p>
<p id="test"></p>
<script>
ui.doTest();
</script>
</body>
</html>

3
src/script/index.js Normal file
View File

@ -0,0 +1,3 @@
export const doTest = () => {
document.getElementById('test').innerHTML = 'test';
};

43
webpack.config.js Normal file
View File

@ -0,0 +1,43 @@
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
mode: process.env.NODE_ENV || 'development',
entry: './src/script/index.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'index.js',
libraryTarget: 'var',
library: 'ui'
},
module: {
rules: [
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader']
}
]
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: 'src',
to: '.',
globOptions: {
ignore: ['**/script/**/*', '**/style/**/*']
}
}
]
})
],
devServer: {
contentBase: path.join(__dirname, 'src'),
open: true
}
};