color-name-list 10.28.0 → 11.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/package.json CHANGED
@@ -1,9 +1,26 @@
1
1
  {
2
2
  "name": "color-name-list",
3
- "version": "10.28.0",
3
+ "version": "11.0.0",
4
4
  "description": "long list of color names",
5
5
  "main": "dist/colornames.json",
6
6
  "browser": "dist/colornames.umd.js",
7
+ "module": "dist/colornames.esm.js",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/colornames.esm.js",
12
+ "require": "./dist/colornames.umd.js"
13
+ },
14
+ "./bestof": {
15
+ "import": "./dist/colornames.bestof.esm.js",
16
+ "require": "./dist/colornames.bestof.umd.js"
17
+ },
18
+ "./short": {
19
+ "import": "./dist/colornames.short.esm.js",
20
+ "require": "./dist/colornames.short.umd.js"
21
+ },
22
+ "./package.json": "./package.json"
23
+ },
7
24
  "scripts": {
8
25
  "commit": "git-cz",
9
26
  "pull-colors": "curl -L 'https://docs.google.com/spreadsheets/d/e/2PACX-1vQube6Y0wHyEtJnjg0eU3N7VseoxVnD4L9uDqvWZdl_tzzrHDVN10IPP7cdFipX8j70atNMLfPCB0Q6/pub?gid=40578722&single=true&output=csv' -o src/colornames.csv",
@@ -11,7 +28,8 @@
11
28
  "clean-dist-folder": "rm -rf dist && mkdir dist",
12
29
  "build": "npm run clean-dist-folder && node scripts/build.js && npm run build-history",
13
30
  "semantic-release": "semantic-release",
14
- "build-history": "node scripts/tools/history.js > dist/history.json"
31
+ "build-history": "node scripts/tools/history.js > dist/history.json",
32
+ "prepare": "husky"
15
33
  },
16
34
  "repository": {
17
35
  "type": "git",
@@ -37,7 +55,7 @@
37
55
  "commitizen": "^4.2.4",
38
56
  "eslint": "^8.16.0",
39
57
  "eslint-config-google": "^0.10.0",
40
- "ghooks": "^2.0.4",
58
+ "husky": "^9.1.6",
41
59
  "seedrandom": "^3.0.5",
42
60
  "semantic-release": "^19.0.2"
43
61
  },
@@ -46,14 +64,10 @@
46
64
  "npm": ">=8.11.0"
47
65
  },
48
66
  "config": {
49
- "ghooks": {
50
- "pre-commit": "npm run test && npm run build"
51
- },
52
67
  "commitizen": {
53
68
  "path": "cz-conventional-changelog"
54
69
  }
55
70
  },
56
- "dependencies": {},
57
71
  "funding": [
58
72
  {
59
73
  "type": "ko-fi",
package/scripts/build.js CHANGED
@@ -1,12 +1,10 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const lib = require('./lib.js');
4
- const parseCSVString = lib.parseCSVString;
5
- const findDuplicates = lib.findDuplicates;
6
- const objArrToString = lib.objArrToString;
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { parseCSVString, findDuplicates, objArrToString } from './lib.js';
4
+ import { exec } from 'child_process';
5
+
7
6
  const args = process.argv;
8
7
  const isTestRun = !!args.find((arg) => (arg === '--testOnly'));
9
- const exec = require('child_process').exec;
10
8
 
11
9
  // only hex colors with 6 values
12
10
  const hexColorValidation = /^#[0-9a-f]{6}$/;
@@ -19,6 +17,7 @@ const spacesValidation = /^\s+|\s{2,}|\s$/;
19
17
  const quoteValidation = /"|'|`/;
20
18
 
21
19
  // setting
20
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
22
21
  const baseFolder = __dirname + '/../';
23
22
  const folderSrc = 'src/';
24
23
  const folderDist = 'dist/';
@@ -1 +1 @@
1
- export default ("{{COLORS}}");
1
+ export const colornames = "{{COLORS}}";
package/scripts/lib.js CHANGED
@@ -1,89 +1,94 @@
1
- module.exports = {
2
- /**
3
- * takes a CSV string an parse it
4
- * @param {String} csvString CSV file contents
5
- * @param {String} csvDelimitor
6
- * @param {String} csvNewLine
7
- * @return {Object} Object with all entries, headers as Array,
8
- * and entires per header as Array
9
- */
10
- parseCSVString: (csvString, csvDelimitor = ',', csvNewLine = '\r\n') => {
11
- const rows = csvString.split(csvNewLine);
12
-
13
- // remove last empty row (if there is any)
14
- if (!rows.slice(-1)[0]) {
15
- rows.pop();
16
- }
17
1
 
18
- // extracts all the CSV headers
19
- const headers = rows.shift().split(csvDelimitor);
2
+ /**
3
+ * takes a CSV string an parse it
4
+ * @param {String} csvString CSV file contents
5
+ * @param {String} csvDelimitor
6
+ * @param {String} csvNewLine
7
+ * @return {Object} Object with all entries, headers as Array,
8
+ * and entires per header as Array
9
+ */
10
+ export const parseCSVString = (
11
+ csvString, csvDelimitor = ',', csvNewLine = '\r\n'
12
+ ) => {
13
+ const rows = csvString.split(csvNewLine);
20
14
 
21
- // collection of values per row
22
- const values = {};
15
+ // remove last empty row (if there is any)
16
+ if (!rows.slice(-1)[0]) {
17
+ rows.pop();
18
+ }
23
19
 
24
- headers.forEach((header) => {
25
- values[header] = [];
26
- });
20
+ // extracts all the CSV headers
21
+ const headers = rows.shift().split(csvDelimitor);
27
22
 
28
- const entires = rows.map((row) => {
29
- // decomposes each row into its single entries
30
- const rowArr = row.split(csvDelimitor);
23
+ // collection of values per row
24
+ const values = {};
31
25
 
32
- // creates an object for for each entry
33
- const entry = {};
26
+ headers.forEach((header) => {
27
+ values[header] = [];
28
+ });
34
29
 
35
- // populates the entries
36
- headers.forEach((header, i) => {
37
- const value = rowArr[i];
38
- entry[header] = value;
30
+ const entires = rows.map((row) => {
31
+ // decomposes each row into its single entries
32
+ const rowArr = row.split(csvDelimitor);
39
33
 
40
- // collects values
41
- values[header].push(value);
42
- });
34
+ // creates an object for for each entry
35
+ const entry = {};
43
36
 
44
- return entry;
45
- });
37
+ // populates the entries
38
+ headers.forEach((header, i) => {
39
+ const value = rowArr[i];
40
+ entry[header] = value;
46
41
 
47
- return {headers, entires, values};
48
- },
49
-
50
- /**
51
- * finds duplicates in a simple array
52
- * @param {array} arr array of items containing comparable items
53
- * @return {array} array of second (or more) instance of duplicate items
54
- */
55
- findDuplicates: (arr) => {
56
- const lookUpObj={};
57
- const dupes = [];
58
-
59
- arr.forEach((item) => {
60
- if (lookUpObj.hasOwnProperty(item)) {
61
- dupes.push(item);
62
- }
63
- lookUpObj[item]=0;
42
+ // collects values
43
+ values[header].push(value);
64
44
  });
65
45
 
66
- return dupes;
67
- },
68
-
69
- objArrToString: (arr, keys, options) => {
70
- const settings = Object.assign({}, {
71
- includeKeyPerItem: false,
72
- beforeKey: '',
73
- afterKey: '',
74
- beforeValue: '',
75
- afterValue: '',
76
- keyValueSeparator: ':',
77
- insertBefore: '',
78
- insertAfter: '',
79
- rowDelimitor: '\r\n',
80
- itemDelimitor: ',',
81
- }, options);
82
-
83
- return settings.insertBefore + arr.map((item) => {
84
- return keys.map((key) => {
85
- return (settings.includeKeyPerItem ? settings.beforeKey + key + settings.afterKey + settings.keyValueSeparator : '') + settings.beforeValue + item[key] + settings.afterValue;
86
- }).join(settings.itemDelimitor);
87
- }).join(settings.rowDelimitor) + settings.insertAfter;
88
- },
46
+ return entry;
47
+ });
48
+
49
+ return {headers, entires, values};
50
+ };
51
+
52
+ /**
53
+ * finds duplicates in a simple array
54
+ * @param {array} arr array of items containing comparable items
55
+ * @return {array} array of second (or more) instance of duplicate items
56
+ */
57
+ export const findDuplicates = (arr) => {
58
+ const lookUpObj={};
59
+ const dupes = [];
60
+
61
+ arr.forEach((item) => {
62
+ if (lookUpObj.hasOwnProperty(item)) {
63
+ dupes.push(item);
64
+ }
65
+ lookUpObj[item]=0;
66
+ });
67
+
68
+ return dupes;
69
+ };
70
+
71
+ export const objArrToString = (arr, keys, options) => {
72
+ const settings = Object.assign({}, {
73
+ includeKeyPerItem: false,
74
+ beforeKey: '',
75
+ afterKey: '',
76
+ beforeValue: '',
77
+ afterValue: '',
78
+ keyValueSeparator: ':',
79
+ insertBefore: '',
80
+ insertAfter: '',
81
+ rowDelimitor: '\r\n',
82
+ itemDelimitor: ',',
83
+ }, options);
84
+
85
+ return settings.insertBefore + arr.map((item) => {
86
+ return keys.map((key) => {
87
+ return (
88
+ settings.includeKeyPerItem ?
89
+ settings.beforeKey + key +
90
+ settings.afterKey + settings.keyValueSeparator : ''
91
+ ) + settings.beforeValue + item[key] + settings.afterValue;
92
+ }).join(settings.itemDelimitor);
93
+ }).join(settings.rowDelimitor) + settings.insertAfter;
89
94
  };
@@ -1,8 +1,7 @@
1
- const child_process = require("child_process");
2
- const readline = require("readline");
1
+ import { execSync } from "child_process";
3
2
 
4
3
  function cmd(c) {
5
- const stdout = child_process.execSync(c);
4
+ const stdout = execSync(c);
6
5
  return stdout.toString().trim();
7
6
  }
8
7
 
@@ -14357,7 +14357,7 @@ Lady Nicole,#d6d6cd,
14357
14357
  Lady of the Night,#05498b,
14358
14358
  Lady of the Sea,#0000cc,
14359
14359
  Lady Pink,#f3d2cf,
14360
- Lady?S Cushions Pink,#c99bb0,
14360
+ Lady’s Cushions Pink,#c99bb0,
14361
14361
  Lady’s Slipper,#e3e3ea,
14362
14362
  Ladybug,#bd474e,
14363
14363
  Ladylike,#ffc3bf,
@@ -30239,4 +30239,5 @@ Zumthor,#cdd5d5,
30239
30239
  Zunda Green,#6bc026,x
30240
30240
  Zuni,#008996,
30241
30241
  Zürich Blue,#248bcc,
30242
- Zürich White,#e6e1d9,
30242
+ Zürich White,#e6e1d9,
30243
+ Rrosy-Fingered Dawn,#c11c84,x