From a45d6ab01a938793018181c5d05dea43ed2c4470 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Thu, 12 Dec 2019 05:58:39 +0100 Subject: [PATCH] added matomo and moved to yarn & parcel --- .drone.yml | 8 +-- .gitignore | 3 + docker-compose.yml | 2 +- package.json | 41 +++++------- src/Assets/site.webmanifest | 6 +- src/index.html | 13 ++-- src/index.styl | 2 +- src/index.tsx | 22 ++++--- src/vendor/fonts/{import.css => import.styl} | 6 +- webpack.config.js | 65 -------------------- 10 files changed, 48 insertions(+), 120 deletions(-) rename src/vendor/fonts/{import.css => import.styl} (62%) delete mode 100755 webpack.config.js diff --git a/.drone.yml b/.drone.yml index fdef536..e0ff725 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,12 +3,12 @@ name: default steps: - name: build - image: cupcakearmy/pnpm + image: node:12-alpine pull: always commands: - node -v - - pnpm --shamefully-flatten i - - pnpm run build:prod + - yarn + - yarn run build - name: deploy image: cupcakearmy/drone-deploy @@ -22,7 +22,7 @@ steps: port: 1312 target: /srv/web/home sources: - - ./public + - ./dist - ./docker-compose.prod.yml - ./nginx.conf commands: diff --git a/.gitignore b/.gitignore index 43c88e0..d211d6b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ node_modules package-lock.json +yarn.lock public +.cache +dist .idea .vscode \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index e81a62e..85c54f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,4 +8,4 @@ services: - 3000:80 volumes: - ./nginx.conf:/usr/local/nginx/conf/sites/default.conf:ro - - ./public:/srv:ro \ No newline at end of file + - ./dist:/srv:ro \ No newline at end of file diff --git a/package.json b/package.json index 5170239..42f43bb 100755 --- a/package.json +++ b/package.json @@ -1,35 +1,22 @@ { "private": true, "scripts": { - "build:dev": "webpack -d", - "build:dev:watch": "webpack -d -w", - "build:prod": "webpack -p", - "build:prod:watch": "webpack -p -w", - "dev": "webpack-dev-server -d" + "build": "parcel build ./src/index.html", + "dev": "parcel ./src/index.html" }, "dependencies": { - "animejs": "~3", - "react": "~16", - "react-dom": "~16", - "react-router-dom": "~5" + "animejs": "3.x", + "parcel-bundler": "1.x", + "react": "16.12.x", + "react-dom": "16.12.x", + "react-router-dom": "5.x" }, "devDependencies": { - "@types/animejs": "3", - "@types/react": "~16", - "@types/react-dom": "~16", - "@types/react-router-dom": "~4", - "awesome-typescript-loader": "~5", - "copy-webpack-plugin": "~5", - "css-loader": "~3", - "file-loader": "~4", - "html-webpack-plugin": "~3", - "mini-css-extract-plugin": "~0", - "style-loader": "~1", - "stylus": "~0", - "stylus-loader": "~3", - "typescript": "~3", - "webpack": "~4", - "webpack-cli": "~3", - "webpack-dev-server": "~3" + "@types/animejs": "3.x", + "@types/react": "16.9.x", + "@types/react-dom": "16.9.x", + "@types/react-router-dom": "5.x", + "stylus": "0.54.x", + "typescript": "3.7.x" } -} +} \ No newline at end of file diff --git a/src/Assets/site.webmanifest b/src/Assets/site.webmanifest index 8d243e0..38cf3f1 100644 --- a/src/Assets/site.webmanifest +++ b/src/Assets/site.webmanifest @@ -3,12 +3,12 @@ "short_name": "nicco.io", "icons": [ { - "src": "/android-chrome-192x192.png", + "src": "./android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" }, { - "src": "/android-chrome-512x512.png", + "src": "./android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" } @@ -16,4 +16,4 @@ "theme_color": "#16b4e9", "background_color": "#16b4e9", "display": "standalone" -} +} \ No newline at end of file diff --git a/src/index.html b/src/index.html index cc5cb78..98448f5 100755 --- a/src/index.html +++ b/src/index.html @@ -7,18 +7,19 @@ - - - - - + + + + + -
+
+ \ No newline at end of file diff --git a/src/index.styl b/src/index.styl index ec9a44d..b76ac55 100644 --- a/src/index.styl +++ b/src/index.styl @@ -1,2 +1,2 @@ -@require './vendor/fonts/import.css' +@require './vendor/fonts/import' @require './styles/*' \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index 8e2872a..1fa4860 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -4,14 +4,16 @@ import ReactDOM from 'react-dom' import App from './App' import './index.styl' -// Favicons -import './Assets/favicon.ico' -import './Assets/favicon-16x16.png' -import './Assets/favicon-32x32.png' -import './Assets/apple-touch-icon.png' -import './Assets/site.webmanifest' -import './Assets/android-chrome-192x192.png' -import './Assets/android-chrome-512x512.png' -import './Assets/safari-pinned-tab.svg' +//@ts-ignore +const _paq = window._paq || []; +_paq.push(['trackPageView']); +_paq.push(['enableLinkTracking']); +(function () { + var u = "//stats.nicco.io/"; + _paq.push(['setTrackerUrl', u + 'p_unicorns']); + _paq.push(['setSiteId', '1']); + var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0]; + g.type = 'text/javascript'; g.async = true; g.defer = true; g.src = u + 'j_unicorns'; s.parentNode.insertBefore(g, s); +})(); -ReactDOM.render(, document.getElementById('root')) \ No newline at end of file +ReactDOM.render(, document.getElementById('root')) \ No newline at end of file diff --git a/src/vendor/fonts/import.css b/src/vendor/fonts/import.styl similarity index 62% rename from src/vendor/fonts/import.css rename to src/vendor/fonts/import.styl index 6ec9acd..471155c 100644 --- a/src/vendor/fonts/import.css +++ b/src/vendor/fonts/import.styl @@ -1,6 +1,6 @@ @font-face { font-family: 'Inconsolata'; - src: url('./Inconsolata-Regular.woff2') format('woff2'); + src: url('vendor/fonts/Inconsolata-Regular.woff2') format('woff2'); font-weight: normal; font-style: normal; font-display: swap; @@ -8,7 +8,7 @@ @font-face { font-family: 'Merriweather'; - src: url('./Merriweather-Regular.woff2') format('woff2'); + src: url('vendor/fonts/Merriweather-Regular.woff2') format('woff2'); font-weight: normal; font-style: normal; font-display: swap; @@ -16,7 +16,7 @@ @font-face { font-family: 'Inconsolata'; - src: url('./Inconsolata-Bold.woff2') format('woff2'); + src: url('vendor/fonts/Inconsolata-Bold.woff2') format('woff2'); font-weight: normal; font-style: normal; font-display: swap; diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100755 index e004954..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,65 +0,0 @@ -const path = require('path') - -const HtmlWebpackPlugin = require('html-webpack-plugin') -const MiniCssExtractPlugin = require('mini-css-extract-plugin') -const CopyPlugin = require('copy-webpack-plugin') - -module.exports = { - entry: [ - './index.tsx', - ], - output: { - filename: 'bundle.js', - path: path.resolve(__dirname, 'public'), - }, - resolve: { - extensions: ['.js', '.jsx', '.ts', '.tsx'], - }, - context: path.resolve(__dirname, 'src'), - devServer: { - contentBase: path.resolve(__dirname, 'public/assets'), - historyApiFallback: true, - open: false, - }, - plugins: [ - new HtmlWebpackPlugin({ - template: 'index.html', - }), - new MiniCssExtractPlugin({ - filename: 'bundle.css', - }), - new CopyPlugin([ - { from: 'Static/robots.txt', to: '.' }, - ]), - ], - stats: { - assets: true, - assetsSort: 'size', - all: false, - errors: true, - colors: true, - performance: true, - timings: true, - }, - module: { - rules: [{ - test: /\.tsx?$/, - loader: 'awesome-typescript-loader', - }, { - test: /\.css$/, - use: [MiniCssExtractPlugin.loader, 'css-loader'], - }, { - test: /\.styl$/, - use: [MiniCssExtractPlugin.loader, 'css-loader', 'stylus-loader'], - }, { - test: /\.(jpg|png|gif|svg|woff2?|ttf|eot|svg|otf|ico|webmanifest)$/, - use: [{ - loader: 'file-loader', - options: { - name: '[name].[ext]', - outputPath: './', - }, - }], - }], - }, -} \ No newline at end of file