color-name-list 11.9.0 → 11.10.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/.gitattributes +1 -0
- package/.github/workflows/build-and-release.yml +57 -0
- package/.github/workflows/build.yml +30 -15
- package/.github/workflows/linting.yml +4 -4
- package/.github/workflows/updatesponsors.yml +1 -1
- package/.husky/pre-commit +1 -1
- package/.prettierignore +5 -0
- package/.prettierrc.json +7 -0
- package/CODE_OF_CONDUCT.md +10 -10
- package/README.md +29 -24
- package/dist/colornames.bestof.csv +4532 -4532
- package/dist/colornames.csv +30290 -30289
- package/dist/colornames.esm.js +1 -1
- package/dist/colornames.esm.mjs +1 -1
- package/dist/colornames.html +1 -1
- package/dist/colornames.json +1 -1
- package/dist/colornames.min.json +1 -1
- package/dist/colornames.scss +1 -1
- package/dist/colornames.short.csv +2885 -2885
- package/dist/colornames.umd.js +1 -1
- package/dist/colornames.xml +4 -0
- package/dist/colornames.yaml +3 -0
- package/dist/history.json +1 -1
- package/eslint.config.js +26 -0
- package/package.json +16 -6
- package/scripts/build.js +92 -99
- package/scripts/lib.js +42 -30
- package/scripts/tools/filterUniques.js +9 -12
- package/scripts/tools/findLargestSpacesInRGB.js +8 -13
- package/scripts/tools/history.js +18 -11
- package/scripts/tools/remapNames.js +2 -4
- package/scripts/tools/shiftColors.js +7 -7
- package/src/colornames.csv +30292 -30291
- package/tests/formats.test.js +46 -0
- package/tests/imports.test.js +119 -0
- package/vitest.config.js +8 -0
- package/.eslintrc.json +0 -17
- package/.github/workflows/release.yml +0 -26
- package/.travis.yml +0 -27
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { parseCSVString } from '../scripts/lib.js';
|
|
5
|
+
|
|
6
|
+
describe('Other Format Tests', () => {
|
|
7
|
+
// Load CSV data for comparison
|
|
8
|
+
const csvSource = fs.readFileSync(path.resolve('./src/colornames.csv'), 'utf8').toString();
|
|
9
|
+
const csvData = parseCSVString(csvSource);
|
|
10
|
+
const csvColors = csvData.entries.map(entry => ({
|
|
11
|
+
name: entry.name,
|
|
12
|
+
hex: entry.hex
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
describe('CSV Output', () => {
|
|
16
|
+
it('should correctly generate CSV files', () => {
|
|
17
|
+
const mainCsv = fs.readFileSync(path.resolve('./dist/colornames.csv'), 'utf8');
|
|
18
|
+
const bestofCsv = fs.readFileSync(path.resolve('./dist/colornames.bestof.csv'), 'utf8');
|
|
19
|
+
const shortCsv = fs.readFileSync(path.resolve('./dist/colornames.short.csv'), 'utf8');
|
|
20
|
+
|
|
21
|
+
// Check that the files are not empty
|
|
22
|
+
expect(mainCsv.length).toBeGreaterThan(0);
|
|
23
|
+
expect(bestofCsv.length).toBeGreaterThan(0);
|
|
24
|
+
expect(shortCsv.length).toBeGreaterThan(0);
|
|
25
|
+
|
|
26
|
+
// Verify headers
|
|
27
|
+
expect(mainCsv).toMatch(/^name,hex/);
|
|
28
|
+
expect(bestofCsv).toMatch(/^name,hex/);
|
|
29
|
+
expect(shortCsv).toMatch(/^name,hex/);
|
|
30
|
+
|
|
31
|
+
// Parse the CSV files
|
|
32
|
+
const mainData = parseCSVString(mainCsv);
|
|
33
|
+
const bestofData = parseCSVString(bestofCsv);
|
|
34
|
+
const shortData = parseCSVString(shortCsv);
|
|
35
|
+
|
|
36
|
+
// Verify data integrity
|
|
37
|
+
expect(mainData.entries.length).toBe(csvColors.length);
|
|
38
|
+
expect(bestofData.entries.length).toBeLessThan(csvColors.length);
|
|
39
|
+
expect(shortData.entries.length).toBeLessThan(bestofData.entries.length);
|
|
40
|
+
|
|
41
|
+
// Verify structure
|
|
42
|
+
expect(mainData.entries[0]).toHaveProperty('name');
|
|
43
|
+
expect(mainData.entries[0]).toHaveProperty('hex');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import * as esmColors from '../dist/colornames.esm.js';
|
|
4
|
+
import * as esmBestOfColors from '../dist/colornames.bestof.esm.js';
|
|
5
|
+
import * as esmShortColors from '../dist/colornames.short.esm.js';
|
|
6
|
+
|
|
7
|
+
// Import JSON files directly
|
|
8
|
+
import jsonColors from '../dist/colornames.json' assert { type: 'json' };
|
|
9
|
+
import jsonBestOfColors from '../dist/colornames.bestof.json' assert { type: 'json' };
|
|
10
|
+
import jsonShortColors from '../dist/colornames.short.json' assert { type: 'json' };
|
|
11
|
+
|
|
12
|
+
// Import minified JSON files
|
|
13
|
+
import jsonMinColors from '../dist/colornames.min.json' assert { type: 'json' };
|
|
14
|
+
import jsonMinBestOfColors from '../dist/colornames.bestof.min.json' assert { type: 'json' };
|
|
15
|
+
import jsonMinShortColors from '../dist/colornames.short.min.json' assert { type: 'json' };
|
|
16
|
+
|
|
17
|
+
// Also import the source CSV file for verification
|
|
18
|
+
import fs from 'fs';
|
|
19
|
+
import path from 'path';
|
|
20
|
+
import { parseCSVString } from '../scripts/lib.js';
|
|
21
|
+
|
|
22
|
+
describe('Color Names Import Tests', () => {
|
|
23
|
+
// Load CSV data for comparison
|
|
24
|
+
const csvSource = fs.readFileSync(path.resolve('./src/colornames.csv'), 'utf8').toString();
|
|
25
|
+
const csvData = parseCSVString(csvSource);
|
|
26
|
+
const csvColors = csvData.entries.map(entry => ({
|
|
27
|
+
name: entry.name,
|
|
28
|
+
hex: entry.hex
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
describe('JSON Files', () => {
|
|
32
|
+
it('should import main JSON file correctly', () => {
|
|
33
|
+
expect(jsonColors).toBeDefined();
|
|
34
|
+
expect(Array.isArray(jsonColors)).toBe(true);
|
|
35
|
+
expect(jsonColors.length).toBeGreaterThan(0);
|
|
36
|
+
expect(jsonColors[0]).toHaveProperty('name');
|
|
37
|
+
expect(jsonColors[0]).toHaveProperty('hex');
|
|
38
|
+
expect(jsonColors.length).toBe(csvColors.length);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should import bestof JSON file correctly', () => {
|
|
42
|
+
expect(jsonBestOfColors).toBeDefined();
|
|
43
|
+
expect(Array.isArray(jsonBestOfColors)).toBe(true);
|
|
44
|
+
expect(jsonBestOfColors.length).toBeGreaterThan(0);
|
|
45
|
+
expect(jsonBestOfColors[0]).toHaveProperty('name');
|
|
46
|
+
expect(jsonBestOfColors[0]).toHaveProperty('hex');
|
|
47
|
+
expect(jsonBestOfColors.length).toBeLessThan(csvColors.length);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should import short JSON file correctly', () => {
|
|
51
|
+
expect(jsonShortColors).toBeDefined();
|
|
52
|
+
expect(Array.isArray(jsonShortColors)).toBe(true);
|
|
53
|
+
expect(jsonShortColors.length).toBeGreaterThan(0);
|
|
54
|
+
expect(jsonShortColors[0]).toHaveProperty('name');
|
|
55
|
+
expect(jsonShortColors[0]).toHaveProperty('hex');
|
|
56
|
+
expect(jsonShortColors.length).toBeLessThan(csvColors.length);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should import minified JSON files correctly', () => {
|
|
60
|
+
expect(jsonMinColors).toBeDefined();
|
|
61
|
+
expect(typeof jsonMinColors).toBe('object');
|
|
62
|
+
expect(Object.keys(jsonMinColors).length).toBeGreaterThan(0);
|
|
63
|
+
expect(Object.values(jsonMinColors).length).toBe(csvColors.length);
|
|
64
|
+
|
|
65
|
+
expect(jsonMinBestOfColors).toBeDefined();
|
|
66
|
+
expect(typeof jsonMinBestOfColors).toBe('object');
|
|
67
|
+
expect(Object.keys(jsonMinBestOfColors).length).toBeGreaterThan(0);
|
|
68
|
+
|
|
69
|
+
expect(jsonMinShortColors).toBeDefined();
|
|
70
|
+
expect(typeof jsonMinShortColors).toBe('object');
|
|
71
|
+
expect(Object.keys(jsonMinShortColors).length).toBeGreaterThan(0);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe('ESM Files', () => {
|
|
76
|
+
it('should import main ESM file correctly', () => {
|
|
77
|
+
expect(esmColors).toBeDefined();
|
|
78
|
+
expect(esmColors.colornames).toBeDefined();
|
|
79
|
+
expect(Array.isArray(esmColors.colornames)).toBe(true);
|
|
80
|
+
expect(esmColors.colornames.length).toBeGreaterThan(0);
|
|
81
|
+
expect(esmColors.colornames[0]).toHaveProperty('name');
|
|
82
|
+
expect(esmColors.colornames[0]).toHaveProperty('hex');
|
|
83
|
+
expect(esmColors.colornames.length).toBe(csvColors.length);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should import bestof ESM file correctly', () => {
|
|
87
|
+
expect(esmBestOfColors).toBeDefined();
|
|
88
|
+
expect(esmBestOfColors.colornames).toBeDefined();
|
|
89
|
+
expect(Array.isArray(esmBestOfColors.colornames)).toBe(true);
|
|
90
|
+
expect(esmBestOfColors.colornames.length).toBeGreaterThan(0);
|
|
91
|
+
expect(esmBestOfColors.colornames[0]).toHaveProperty('name');
|
|
92
|
+
expect(esmBestOfColors.colornames[0]).toHaveProperty('hex');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('should import short ESM file correctly', () => {
|
|
96
|
+
expect(esmShortColors).toBeDefined();
|
|
97
|
+
expect(esmShortColors.colornames).toBeDefined();
|
|
98
|
+
expect(Array.isArray(esmShortColors.colornames)).toBe(true);
|
|
99
|
+
expect(esmShortColors.colornames.length).toBeGreaterThan(0);
|
|
100
|
+
expect(esmShortColors.colornames[0]).toHaveProperty('name');
|
|
101
|
+
expect(esmShortColors.colornames[0]).toHaveProperty('hex');
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe('Content Verification', () => {
|
|
106
|
+
it('should contain expected color names', () => {
|
|
107
|
+
// Check for some common color names
|
|
108
|
+
const commonColors = ['black', 'white', 'red', 'blue', 'green', 'yellow', 'purple', 'pink'];
|
|
109
|
+
|
|
110
|
+
// Convert to lowercase for easier comparison
|
|
111
|
+
const allNames = jsonColors.map(color => color.name.toLowerCase());
|
|
112
|
+
|
|
113
|
+
commonColors.forEach(color => {
|
|
114
|
+
// Check if at least one entry contains this common color name
|
|
115
|
+
expect(allNames.some(name => name.includes(color))).toBe(true);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
package/vitest.config.js
ADDED
package/.eslintrc.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["eslint:recommended", "google"],
|
|
3
|
-
"parserOptions": {
|
|
4
|
-
"ecmaVersion": 6,
|
|
5
|
-
"sourceType": "module",
|
|
6
|
-
"ecmaFeatures": {
|
|
7
|
-
"jsx": true
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
"rules": {
|
|
11
|
-
"semi": 2,
|
|
12
|
-
"no-console": 0
|
|
13
|
-
},
|
|
14
|
-
"env": {
|
|
15
|
-
"node": true
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: Semantic Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ master ]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
release:
|
|
9
|
-
name: Release
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
steps:
|
|
12
|
-
- name: Checkout
|
|
13
|
-
uses: actions/checkout@v1
|
|
14
|
-
- name: Setup Node.js
|
|
15
|
-
uses: actions/setup-node@v1
|
|
16
|
-
with:
|
|
17
|
-
node-version: 20
|
|
18
|
-
- name: Install dependencies
|
|
19
|
-
run: npm ci
|
|
20
|
-
- name: Test
|
|
21
|
-
run: npm test
|
|
22
|
-
- name: Release
|
|
23
|
-
env:
|
|
24
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
25
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
26
|
-
run: npx semantic-release
|
package/.travis.yml
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
sudo: false
|
|
2
|
-
language: node_js
|
|
3
|
-
cache:
|
|
4
|
-
directories:
|
|
5
|
-
- $HOME/.npm
|
|
6
|
-
notifications:
|
|
7
|
-
email: true
|
|
8
|
-
node_js:
|
|
9
|
-
- '12'
|
|
10
|
-
before_script:
|
|
11
|
-
- npm prune
|
|
12
|
-
script:
|
|
13
|
-
- npm run test
|
|
14
|
-
after_success:
|
|
15
|
-
- npm run build
|
|
16
|
-
- npm run travis-deploy-once "npm run semantic-release"
|
|
17
|
-
branches:
|
|
18
|
-
except:
|
|
19
|
-
- "/^v\\d+\\.\\d+\\.\\d+$/"
|
|
20
|
-
deploy:
|
|
21
|
-
provider: rubygems
|
|
22
|
-
api_key:
|
|
23
|
-
secure: CNdCKlEU1SQDoIzULXWNWGA4KPPmtXqz33bhBlYeGlZEzdHmJjI9UXzMb+ddDjxx2OwTQPGWCOsynIMxEzzUtecf0xxrHuCbr9vhBXKbIiLbL6vRl2cHPLib4cMTdvwpngDAgHFV+WH0KiZltAR0PeSR/pAiXZRQYMJ7GyZtLGifIaUjxYZFXFuGS7QLoVrIMco/jjUPNWgXqSzVLaRtOOjnvwMFkMFfXaz1XBY+ODm7Zx5bIa16AmQijprLCdTYlSZelc1AwZ8+y2GBF7BipJtlO4LvcPR6H2S1Snl9umH8gNsmwo7n9JfPJAFAYS85WhOu3xA3ZhUKiGxxUjm81cukHaXbkq/bEnaw90fBujzfTlZgQiw00VD/8iX1pIzCzwnF41LVpTRP4zLP8BKcLKDoZL0REUTtAH0+8Lw+gjlmj4fhWEPBHUMGp6mGs/L1dSUMEjyM4DwuPDRp5JlUc5DNDIMHrWih19JNUFaDJnNVQ2gOFuErpeTkWdc3pqsp8W9kQPYcV6PMkOheMwwqwzGTd94L1y9cG+tdAdk7Af+KqWd958O7oHuhX4DM0G3LEqXInLfASbK1/sfOYu2sEVkXbCElC8iCwTUN2LNaLa4NsK0ar43ZVvRu9lzTyhfJUmWqzlNcBn8S9ShV7+7SHmac/cGFeUAmn5paHbJRwTs=
|
|
24
|
-
gem: color-names
|
|
25
|
-
on:
|
|
26
|
-
tags: false
|
|
27
|
-
repo: meodai/color-names
|