From 79d0698cc91f8585f7d8fa4d4160667173fc97f7 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 7 Nov 2022 11:55:20 +0100 Subject: [PATCH] Remove unneeded build script --- build.js | 18 ------------------ index.js | 12 +++++++++++- package.json | 8 +++----- 3 files changed, 14 insertions(+), 24 deletions(-) delete mode 100644 build.js diff --git a/build.js b/build.js deleted file mode 100644 index 057dc77..0000000 --- a/build.js +++ /dev/null @@ -1,18 +0,0 @@ -import fs from 'node:fs' -import {emojiEmotion} from 'emoji-emotion' -import {emojiToName} from 'gemoji' - -/** @type {Record} */ -const data = {} -let index = -1 - -while (++index < emojiEmotion.length) { - const info = emojiEmotion[index] - data[info.emoji] = info.polarity - data[':' + emojiToName[info.emoji] + ':'] = info.polarity -} - -fs.writeFileSync( - 'emoji.js', - 'export const emoji = ' + JSON.stringify(data, null, 2) + '\n' -) diff --git a/index.js b/index.js index 6ffa8fc..b329292 100644 --- a/index.js +++ b/index.js @@ -10,13 +10,23 @@ */ import {afinn165} from 'afinn-165' -import {emoji} from './emoji.js' +import {emojiEmotion} from 'emoji-emotion' /** @type {Record} */ export const polarities = {} const own = {}.hasOwnProperty +/** @type {Record} */ +const emoji = {} +let index = 0 + +while (++index < emojiEmotion.length) { + const info = emojiEmotion[index] + polarities[info.emoji] = info.polarity + polarities[':' + info.name + ':'] = info.polarity +} + inject(afinn165) inject(emoji) diff --git a/package.json b/package.json index f08de4c..57f6cde 100644 --- a/package.json +++ b/package.json @@ -32,16 +32,15 @@ "types": "index.d.ts", "files": [ "index.d.ts", - "index.js", - "emoji.js" + "index.js" ], "dependencies": { - "afinn-165": "^2.0.0" + "afinn-165": "^2.0.0", + "emoji-emotion": "^3.0.0" }, "devDependencies": { "@types/node": "^18.0.0", "c8": "^7.0.0", - "emoji-emotion": "^3.0.0", "gemoji": "^7.0.0", "nyc": "^15.0.0", "prettier": "^2.0.0", @@ -53,7 +52,6 @@ }, "scripts": { "prepack": "npm run build && npm run format", - "generate": "node build.js", "build": "tsc --build --clean && tsc --build && type-coverage", "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", "test-api": "node --conditions development test/index.js",