daily-color 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +3 -0
- package/.github/workflows/code-quality.yml +29 -0
- package/.github/workflows/publish-please.yml +26 -0
- package/.github/workflows/release-please.yml +21 -0
- package/.github/workflows/update-please.yml +45 -0
- package/.npmpackagejsonlintrc.json +3 -0
- package/.prettierignore +2 -0
- package/CHANGELOG.md +19 -0
- package/README.md +51 -0
- package/bin/dailycolor.js +5 -0
- package/index.js +11 -0
- package/package.json +38 -0
- package/test/index.js +3 -0
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Code quality
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
code-quality:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Use Node.js
|
|
15
|
+
uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: node
|
|
18
|
+
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: npm install
|
|
21
|
+
|
|
22
|
+
- name: Check package linting
|
|
23
|
+
run: npm run package:lint
|
|
24
|
+
|
|
25
|
+
- name: Check code linting
|
|
26
|
+
run: npm run lint:check
|
|
27
|
+
|
|
28
|
+
- name: Check formatting
|
|
29
|
+
run: npm run format:check
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish please
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build-and-publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Check out code
|
|
12
|
+
uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Set up Node.js
|
|
15
|
+
uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: node
|
|
18
|
+
registry-url: https://registry.npmjs.org
|
|
19
|
+
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: npm install
|
|
22
|
+
|
|
23
|
+
- name: Publish to npm
|
|
24
|
+
run: npm publish
|
|
25
|
+
env:
|
|
26
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Release please
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
pull-requests: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
release-please:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: googleapis/release-please-action@v3
|
|
18
|
+
with:
|
|
19
|
+
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
|
20
|
+
release-type: node
|
|
21
|
+
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"deps","section":"Dependencies","hidden":false}]'
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Update please
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
target:
|
|
7
|
+
type: choice
|
|
8
|
+
description: Target versions to upgrade to
|
|
9
|
+
required: true
|
|
10
|
+
options:
|
|
11
|
+
- latest
|
|
12
|
+
- minor
|
|
13
|
+
- patch
|
|
14
|
+
schedule:
|
|
15
|
+
- cron: "0 0 10 * *"
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
update-please:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout Repository
|
|
23
|
+
uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Setup Node.js Environment
|
|
26
|
+
uses: actions/setup-node@v4
|
|
27
|
+
|
|
28
|
+
- name: Install npm-check-updates
|
|
29
|
+
run: npm install -g npm-check-updates
|
|
30
|
+
|
|
31
|
+
- name: Update ${{ github.event.inputs.target || 'minor' }} dependencies
|
|
32
|
+
run: ncu -t ${{ github.event.inputs.target || 'minor' }} -u --install always
|
|
33
|
+
|
|
34
|
+
- name: Audit dependencies
|
|
35
|
+
run: npm audit fix ${{ github.event.inputs.target == 'latest' && '--force' || ''}}
|
|
36
|
+
|
|
37
|
+
- name: Create Pull Request
|
|
38
|
+
uses: peter-evans/create-pull-request@v6
|
|
39
|
+
with:
|
|
40
|
+
token: ${{ secrets.UPDATE_PLEASE_TOKEN }}
|
|
41
|
+
commit-message: "deps: update dependencies"
|
|
42
|
+
title: "deps: update dependencies"
|
|
43
|
+
body: "Update Please has found one or more dependencies to be updated! 🚀"
|
|
44
|
+
branch: update-please-${{ github.sha }}
|
|
45
|
+
labels: chore
|
package/.prettierignore
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 (2024-11-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Add a bin script for CLI ([f81da29](https://github.com/aimeerivers/daily-color/commit/f81da29a370963f941b161992a79040b045d6b9a))
|
|
9
|
+
* Start a new project ([a9f5689](https://github.com/aimeerivers/daily-color/commit/a9f56899a72d35c4168131bc9dfb2172f0238f97))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* Fix version ([0a1af33](https://github.com/aimeerivers/daily-color/commit/0a1af33525693ae8d5f7f5f186abb7a946ce70d8))
|
|
15
|
+
* Install eslint-config-plus-prettier ([36e2f49](https://github.com/aimeerivers/daily-color/commit/36e2f49af188015a4736541e0412cb9580063c4c))
|
|
16
|
+
* Install npm-package-json-lint ([6281541](https://github.com/aimeerivers/daily-color/commit/6281541c637d7b546dfc2a479ba76eb800ddb5ab))
|
|
17
|
+
* Uninstall npm-package-json-lint ([9a330b1](https://github.com/aimeerivers/daily-color/commit/9a330b11f131d287cb51b8ac430393c49b94c1cb))
|
|
18
|
+
* Update eslint-config-plus-prettier ([e08d8d4](https://github.com/aimeerivers/daily-color/commit/e08d8d47e47b55c04b4cb3f9411cadb924191761))
|
|
19
|
+
* Update eslint-config-plus-prettier to v1.6.0 which limits the eslint version ([fd17ce9](https://github.com/aimeerivers/daily-color/commit/fd17ce9be58db5bdb726f1f363e1bae2cf2bc99f))
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# daily-color
|
|
2
|
+
|
|
3
|
+
Provides a unique hex code each day
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install daily-color
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Use
|
|
12
|
+
|
|
13
|
+
In a JavaScript/TypeScript project:
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
const getDailyColor = require("daily-color");
|
|
17
|
+
|
|
18
|
+
console.log("Today's color is: ", getDailyColor());
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Using the CLI:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
dailycolor
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
Install dependencies:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Run tests:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm run test
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The project uses ESLint and Prettier to ensure consistent coding standards.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm run lint
|
|
45
|
+
npm run format
|
|
46
|
+
npm run package:lint
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- `lint` will check for errors and fix formatting in `.ts` and `.js` files.
|
|
50
|
+
- `format` will apply format rules to all possible files.
|
|
51
|
+
- `package:lint` will warn of any inconsistencies in the `package.json` file.
|
package/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const crypto = require("crypto");
|
|
2
|
+
|
|
3
|
+
function getDailyColor() {
|
|
4
|
+
const date = new Date().toISOString().split("T")[0];
|
|
5
|
+
const hash = crypto.createHash("sha256").update(date).digest("hex");
|
|
6
|
+
const color = `#${hash.slice(0, 6)}`;
|
|
7
|
+
|
|
8
|
+
return color;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = getDailyColor;
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "daily-color",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Provides a unique hex code each day",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"color",
|
|
7
|
+
"daily",
|
|
8
|
+
"date",
|
|
9
|
+
"hash",
|
|
10
|
+
"hex color"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/aimeerivers/daily-color#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/aimeerivers/daily-color/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"author": "aimee rivers",
|
|
18
|
+
"main": "index.js",
|
|
19
|
+
"bin": {
|
|
20
|
+
"dailycolor": "./bin/dailycolor.js"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/aimeerivers/daily-color.git"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"format": "prettier --write .",
|
|
28
|
+
"format:check": "prettier --check .",
|
|
29
|
+
"lint": "eslint . --ext .ts,.js --fix",
|
|
30
|
+
"lint:check": "eslint . --ext .ts,.js",
|
|
31
|
+
"package:lint": "npx npm-package-json-lint .",
|
|
32
|
+
"test": "node test/index.js"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"eslint-config-plus-prettier": "1.7.0"
|
|
36
|
+
},
|
|
37
|
+
"prettier": "eslint-config-plus-prettier/.prettierrc.json"
|
|
38
|
+
}
|
package/test/index.js
ADDED