chore: Init package
This commit is contained in:
commit
6362a7fde9
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules/*
|
||||
build/*
|
7
.prettierrc.json
Normal file
7
.prettierrc.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"useTabs": true,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"arrowParens": "avoid"
|
||||
}
|
3
babel.config.js
Normal file
3
babel.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: ['@babel/preset-env']
|
||||
};
|
6248
package-lock.json
generated
Normal file
6248
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
28
package.json
Normal file
28
package.json
Normal 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
15
src/index.html
Normal 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
3
src/script/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export const doTest = () => {
|
||||
document.getElementById('test').innerHTML = 'test';
|
||||
};
|
43
webpack.config.js
Normal file
43
webpack.config.js
Normal 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
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user