Skip to content

Commit

Permalink
Improve build process (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
kytta authored Jan 25, 2023
2 parents 54601a5 + c611962 commit bacd69c
Show file tree
Hide file tree
Showing 8 changed files with 315 additions and 492 deletions.
26 changes: 0 additions & 26 deletions .eslintrc.json

This file was deleted.

27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Sourcemaps are not being output any more
- They're being loaded automatically and don't serve any other purpose.
Disabling those helps us save a few bytes
- Change minifier to esbuild (instead of terser)
- This disables the minification of ESM, which is a good thing, because
otherwise the file can't be tree-shaken properly
- Shareon is now `type: "module"`
- This doesn't change anything for the end users
- Banner was removed
- It took unnecessary bytes, and embedding it was somewhat buggy
- Browserslist config now targets `defaults`
- Opera 90 and Samsung Browser 17 aren't targeted. Shareon will still work on
these browsers.
- the previous config (using `last 3 versions instead` of `last 2 versions`)
didn't change coverage that much

### Behind-the-scenes

- Updated to Vite v4
- CSS is now bundled using Vite
- this makes the build script leaner; it's still processed with PostCSS
- Moved PostCSS and ESLint config to package.json

## [2.0.1] - 2023-01-23

### Changed
Expand Down
2 changes: 0 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
font-weight: 600;
}
</style>

<link rel="stylesheet" href="./src/shareon.css" />
</head>

<body>
Expand Down
50 changes: 41 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shareon",
"version": "2.0.1",
"version": "2.0.2-0",
"description": "Lightweight, stylish and ethical share buttons for popular social networks",
"license": "MIT",
"homepage": "https://shareon.js.org",
Expand All @@ -26,6 +26,7 @@
"https://liberapay.com/kytta",
"https://www.paypal.com/paypalme/NickKaramoff"
],
"type": "module",
"main": "./dist/shareon.umd.js",
"unpkg": "./dist/shareon.iife.js",
"jsdelivr": "./dist/shareon.iife.js",
Expand All @@ -41,9 +42,7 @@
"dist"
],
"scripts": {
"build": "pnpm run build:js && pnpm run build:css",
"build:js": "vite build",
"build:css": "postcss src/shareon.css -o dist/shareon.min.css --map",
"build": "vite build",
"dev": "vite",
"lint": "prettier --check . && eslint .",
"size": "size-limit",
Expand All @@ -60,16 +59,46 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-unicorn": "^44.0.2",
"postcss": "^8.4.19",
"postcss-banner": "^4.0.1",
"postcss-calc": "^8.2.4",
"postcss-cli": "^10.0.0",
"postcss-css-variables": "^0.18.0",
"postcss-csso": "^6.0.1",
"prettier": "^2.7.1",
"size-limit": "^8.1.0",
"vite": "^2.8.0"
"vite": "^4.0.4"
},
"eslintConfig": {
"env": {
"browser": true
},
"extends": [
"eslint:recommended",
"plugin:unicorn/recommended",
"prettier"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"overrides": [
{
"files": [
"vite.config.js"
],
"env": {
"node": true,
"browser": false
}
}
]
},
"postcss": {
"plugins": {
"postcss-css-variables": {},
"postcss-calc": {},
"autoprefixer": {},
"postcss-csso": {}
}
},
"browserslist": "> 0.3%, last 2 versions, Firefox ESR, not dead",
"size-limit": [
{
"limit": "7 KB",
Expand All @@ -85,6 +114,9 @@
},
"clean-publish": {
"withoutPublish": true,
"tempDir": "package"
"tempDir": "package",
"fields": [
"postcss"
]
}
}
Loading

0 comments on commit bacd69c

Please sign in to comment.