daily-color
Advanced tools
Comparing version 1.3.1 to 2.0.0
#!/usr/bin/env node | ||
const getDailyColor = require("../index"); | ||
import { getDailyColor } from "../index.js"; | ||
console.log(getDailyColor()); |
# Changelog | ||
## [2.0.0](https://github.com/aimeerivers/daily-color/compare/v1.3.1...v2.0.0) (2024-11-09) | ||
### ⚠ BREAKING CHANGES | ||
* Importing with `require` will no longer work. Instead use `import { getDailyColor } from "daily-color";` | ||
### Features | ||
* Convert to ES module ([#15](https://github.com/aimeerivers/daily-color/issues/15)) ([0444973](https://github.com/aimeerivers/daily-color/commit/04449739647216ddda101b5fdd4b3c7be2e0a662)) | ||
## [1.3.1](https://github.com/aimeerivers/daily-color/compare/v1.3.0...v1.3.1) (2024-11-09) | ||
@@ -4,0 +15,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.getDailyColor=e():t.getDailyColor=e()}(self,(()=>{return t={237:t=>{t.exports=function(){const t=function(t){const e=t.getDate(),o=t.getMonth()+1,r=`${t.getFullYear()}-${o}-${e}`;let n=0;for(let t=0;t<r.length;t++)n=(n<<5)-n+r.charCodeAt(t),n|=0;return Math.abs(n)}(new Date),e=t>>8&255,o=255&t;return`#${(t>>16&255).toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}`}}},e={},function o(r){var n=e[r];if(void 0!==n)return n.exports;var a=e[r]={exports:{}};return t[r](a,a.exports,o),a.exports}(237);var t,e})); | ||
var t={d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};function r(){const t=function(t){const e=t.getDate(),r=t.getMonth()+1,o=`${t.getFullYear()}-${r}-${e}`;let a=0;for(let t=0;t<o.length;t++)a=(a<<5)-a+o.charCodeAt(t),a|=0;return Math.abs(a)}(new Date),e=t>>8&255,r=255&t;return`#${(t>>16&255).toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}t.d(e,{x:()=>r});var o=e.x;export{o as getDailyColor}; |
@@ -1,2 +0,2 @@ | ||
function getDailyColor() { | ||
export function getDailyColor() { | ||
const date = new Date(); | ||
@@ -28,3 +28,1 @@ const hash = getSimpleHash(date); | ||
} | ||
module.exports = getDailyColor; |
{ | ||
"name": "daily-color", | ||
"version": "1.3.1", | ||
"version": "2.0.0", | ||
"description": "Provides a unique hex code each day", | ||
@@ -26,2 +26,3 @@ "keywords": [ | ||
}, | ||
"type": "module", | ||
"scripts": { | ||
@@ -28,0 +29,0 @@ "format": "prettier --write .", |
@@ -18,3 +18,3 @@ # daily-color | ||
```javascript | ||
const getDailyColor = require("daily-color"); | ||
import { getDailyColor } from "daily-color"; | ||
@@ -27,4 +27,5 @@ console.log("Today's color is:", getDailyColor()); | ||
```html | ||
<script src="https://www.aimeerivers.com/daily-color/dist/daily-color.js"></script> | ||
<script> | ||
<script type="module"> | ||
import { getDailyColor } from "https://www.aimeerivers.com/daily-color/dist/daily-color.js"; | ||
console.log("Today's color is:", getDailyColor()); | ||
@@ -31,0 +32,0 @@ </script> |
@@ -1,4 +0,8 @@ | ||
const path = require("path"); | ||
import path from "path"; | ||
import { fileURLToPath } from "url"; | ||
module.exports = { | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
export default { | ||
entry: "./index.js", | ||
@@ -8,6 +12,10 @@ output: { | ||
filename: "daily-color.js", | ||
library: "getDailyColor", | ||
libraryTarget: "umd", | ||
library: { | ||
type: "module", | ||
}, | ||
}, | ||
experiments: { | ||
outputModule: true, | ||
}, | ||
mode: "production", | ||
}; |
Sorry, the diff of this file is not supported yet
12134
50
74
Yes