Skip to content

Commit

Permalink
feat: make @svgmoji/core a peer dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ifiokjr committed Jan 16, 2021
1 parent b549183 commit 67a34b4
Show file tree
Hide file tree
Showing 13 changed files with 153 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .changeset/silver-scissors-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@svgmoji/blob': minor
'@svgmoji/noto': minor
'@svgmoji/openmoji': minor
'@svgmoji/twemoji': minor
---

- Make `@svgmoji/core` a peer dependency.
- Improve type inference by setting the `name` to a `const` for `Blobmoji`, `Notomoji`, `Twemoji` and `Openmoji`
7 changes: 6 additions & 1 deletion packages/svgmoji__blob/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@
"svg"
],
"dependencies": {
"@babel/runtime": "^7.12.5",
"@babel/runtime": "^7.12.5"
},
"devDependencies": {
"@svgmoji/core": "0.2.0"
},
"peerDependencies": {
"@svgmoji/core": "^0.2.0"
},
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EmojiGithubMeta, Moji } from '@svgmoji/core';
import { getVersion } from 'json.macro';

export class Blobmoji extends Moji {
name = 'blob';
name = 'blob' as const;
version = getVersion();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/svgmoji__blob/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './blob';
export * from './blobmoji';
2 changes: 2 additions & 0 deletions packages/svgmoji__core/src/regexp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as EMOJI_REGEX } from 'emojibase-regex/emoji';
export { default as EMOTICON_REGEX } from 'emojibase-regex/emoticon';
112 changes: 112 additions & 0 deletions packages/svgmoji__core/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import type { Emoji as BaseEmoji, SkinTone } from 'emojibase';

export interface FlatEmoji extends Omit<BaseEmoji, 'skins' | 'tone'> {
/**
* The hexcodes for the skins contained.
*/
skins?: string[];

/**
* The skin tone.
*/
tone?: SkinToneTuple;
}

export interface Emoji extends Omit<FlatEmoji, 'skins'> {
/**
* The populated skin value.
*/
skins?: FlatEmoji[];
}

export interface HexcodeWithTone {
hexcode: string;
tone: SkinToneTuple;
}

/**
* The skin tone which allows a second tone for complex emoji that support multiple tones for
* different characters.
*/
export type SkinToneTuple = [primary: SkinTone, secondary?: SkinTone];

/**
* A minified emoji object which takes the flattened emoji value and minifies all the keys to
* prevent a bloated json file.
*/
export interface MinifiedEmoji {
/**
* Alias for `annotation` property.
*/
a: FlatEmoji['annotation'];

/**
* Alias for `emoji` property.
*/
e: FlatEmoji['emoji'];

/**
* Alias for `emoticon` property.
*/
u?: FlatEmoji['emoticon'];

/**
* Alias for `gender` property.
*/
g?: FlatEmoji['gender'];

/**
* Alias for `group` property.
*/
b?: FlatEmoji['group'];

/**
* Alias for `hexcode` property.
*/
h: FlatEmoji['hexcode'];

/**
* Alias for `order` property.
*/
o?: FlatEmoji['order'];

/**
* Alias for `shortcodes` property.
*/
s?: FlatEmoji['shortcodes'];

/**
* Alias for `skins` property.
*/
k?: FlatEmoji['skins'];

/**
* Alias for `subgroup` property.
*/
c?: FlatEmoji['subgroup'];

/**
* Alias for `tags` property.
*/
t?: FlatEmoji['tags'];

/**
* Alias for `text` property.
*/
d: FlatEmoji['text'];

/**
* Alias for `tone` property.
*/
f?: FlatEmoji['tone'];

/**
* Alias for `type` property.
*/
i: FlatEmoji['type'];

/**
* Alias for `version` property.
*/
v: FlatEmoji['version'];
}
7 changes: 6 additions & 1 deletion packages/svgmoji__noto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@
"svg"
],
"dependencies": {
"@babel/runtime": "^7.12.5",
"@babel/runtime": "^7.12.5"
},
"devDependencies": {
"@svgmoji/core": "0.2.0"
},
"peerDependencies": {
"@svgmoji/core": "^0.2.0"
},
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/svgmoji__noto/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './noto';
export * from './notomoji';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EmojiGithubMeta, Moji } from '@svgmoji/core';
import { getVersion } from 'json.macro';

export class Notomoji extends Moji {
name = 'noto';
name = 'noto' as const;
version = getVersion();
}

Expand Down
7 changes: 6 additions & 1 deletion packages/svgmoji__openmoji/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@
"svg"
],
"dependencies": {
"@babel/runtime": "^7.12.5",
"@babel/runtime": "^7.12.5"
},
"devDependencies": {
"@svgmoji/core": "0.2.0"
},
"peerDependencies": {
"@svgmoji/core": "^0.2.0"
},
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/svgmoji__openmoji/src/openmoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EmojiGithubMeta, Moji } from '@svgmoji/core';
import { getVersion } from 'json.macro';

export class Openmoji extends Moji {
name = 'openmoji';
name = 'openmoji' as const;
version = getVersion();
}

Expand Down
7 changes: 6 additions & 1 deletion packages/svgmoji__twemoji/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@
"svg"
],
"dependencies": {
"@babel/runtime": "^7.12.5",
"@babel/runtime": "^7.12.5"
},
"devDependencies": {
"@svgmoji/core": "0.2.0"
},
"peerDependencies": {
"@svgmoji/core": "^0.2.0"
},
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/svgmoji__twemoji/src/twemoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EmojiGithubMeta, Moji } from '@svgmoji/core';
import { getVersion } from 'json.macro';

export class Twemoji extends Moji {
name = 'twemoji';
name = 'twemoji' as const;
version = getVersion();
}

Expand Down

0 comments on commit 67a34b4

Please sign in to comment.