pull/1/head
Michał Górny 2019-08-29 19:07:09 +02:00
commit e3616e961b
14 zmienionych plików z 11633 dodań i 0 usunięć

6
.babelrc 100644
Wyświetl plik

@ -0,0 +1,6 @@
{
"presets": [
"@babel/env",
"@babel/typescript"
]
}

14
.editorconfig 100644
Wyświetl plik

@ -0,0 +1,14 @@
# editorconfig.org
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[package*.json]
indent_style = space
indent_size = 2

17
.eslintrc.json 100644
Wyświetl plik

@ -0,0 +1,17 @@
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
]
}

2
.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1,2 @@
dist
node_modules

17
.stylelintrc.json 100644
Wyświetl plik

@ -0,0 +1,17 @@
{
"extends": "stylelint-config-standard",
"rules": {
"indentation": "tab",
"font-family-name-quotes": "always-where-recommended",
"function-url-quotes": ["always", {
"except": "empty"
}],
"selector-attribute-quotes": "always",
"string-quotes": "single",
"at-rule-no-vendor-prefix": true,
"media-feature-name-no-vendor-prefix": true,
"property-no-vendor-prefix": true,
"selector-no-vendor-prefix": true,
"value-no-vendor-prefix": true
}
}

11408
package-lock.json wygenerowano 100644

Plik diff jest za duży Load Diff

41
package.json 100644
Wyświetl plik

@ -0,0 +1,41 @@
{
"name": "sejm-mandates-simulator",
"version": "1.0.0",
"description": "Simulator for the Polish Sejm 2019 election",
"scripts": {
"build": "webpack",
"start": "webpack-dev-server --inline --watch --hot"
},
"keywords": [],
"author": "Michał Górny",
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-typescript": "^7.3.3",
"@babel/register": "^7.5.5",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"babel-loader": "^8.0.6",
"css-loader": "^3.2.0",
"cssnano": "^4.1.10",
"eslint": "^6.1.0",
"eslint-loader": "^3.0.0",
"file-loader": "^4.2.0",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.8.0",
"postcss": "^7.0.17",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.7.0",
"pug": "^2.0.4",
"pug-loader": "^2.4.0",
"stylelint": "^10.1.0",
"stylelint-config-standard": "^18.3.0",
"stylelint-webpack-plugin": "^0.10.5",
"typescript": "^3.5.3",
"webpack": "^4.39.1",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.8.0",
"webpack-livereload-plugin": "^2.2.0"
}
}

Wyświetl plik

@ -0,0 +1,9 @@
module.exports = {
plugins: {
'postcss-import': {},
'postcss-preset-env': {
browsers: 'last 2 versions',
},
'cssnano': {},
},
};

6
src/const.ts 100644
Wyświetl plik

@ -0,0 +1,6 @@
export const helloworld = 'Hello, world!';
export const isGoodAttitude = (attitude: string) => attitude === 'good';
export const isJediColor = (color: string) => color === 'blue' || color === 'green';
export const getSection = (name: string) => document.querySelector(`[data-section="${name}"]`);
export const domNodesToArray = (nodes: NodeListOf<HTMLInputElement>) => Array.prototype.slice.call(nodes);

8
src/index.pug 100644
Wyświetl plik

@ -0,0 +1,8 @@
doctype html
html(lang='pl')
head
title Kalkulator mandatów
meta(charset="UTF-8")
body
div.container
h1.main-heading Kalkulator mandatów w wyborach do Sejmu

6
src/index.ts 100644
Wyświetl plik

@ -0,0 +1,6 @@
import {helloworld} from './const';
import './styles.css';
const sayHelloworld = (helloworld: string) => console.log(helloworld);
sayHelloworld(helloworld);

5
src/styles.css 100644
Wyświetl plik

@ -0,0 +1,5 @@
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
color: #333;
background-color: cadetblue;
}

10
tsconfig.json 100644
Wyświetl plik

@ -0,0 +1,10 @@
{
"compilerOptions": {
"outDir": "./dist/",
"strict": true,
"module": "es6",
"target": "es5",
"allowJs": true,
"sourceMap": true
}
}

Wyświetl plik

@ -0,0 +1,84 @@
import path from 'path';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import LiveReloadPlugin from 'webpack-livereload-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import StyleLintPlugin from 'stylelint-webpack-plugin';
export default {
entry: './src/index.ts',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.ts', '.js', '.json'],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.ts$/,
exclude: /node_modules/,
enforce: 'pre',
use: {
loader: 'eslint-loader',
options: {
configFile: __dirname + '/.eslintrc.json',
},
}
},
{
test: /\.pug$/,
exclude: /node_modules/,
use: 'pug-loader',
},
{
test: /\.css$/,
exclude: /node_modules/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: __dirname + '/../../public/',
},
},
{
loader: 'css-loader',
options: {importLoaders: 1},
},
{
loader: 'postcss-loader',
options: {
config: {
path: __dirname + '/postcss.config.js',
},
},
},
],
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.pug',
}),
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css"
}),
new StyleLintPlugin({
configFile: path.resolve(__dirname, '.stylelintrc.json'),
context: path.resolve(__dirname, './src'),
files: '**/*.css',
failOnError: false,
quiet: false,
}),
new LiveReloadPlugin({
appendScriptTag: true
}),
],
};