Skip to content

Commit

Permalink
data: json => js
Browse files Browse the repository at this point in the history
  • Loading branch information
puzrin committed Dec 6, 2023
1 parent 80176ae commit 49b3b46
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ ignorePatterns:
- coverage/
- dist/
- rollup.config.js

- lib/data/full.js
- lib/data/light.js

rules:
accessor-pairs: 2
array-bracket-spacing: [ 2, "always", { "singleValue": true, "objectsInArrays": true, "arraysInArrays": true } ]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ __v1.+ requires `markdown-it` v4.+, see changelog.__
Three versions:

- __Full__ (default), with all github supported emojis.
- [Light](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/light.json), with only well-supported unicode emojis and reduced size.
- Bare, without included emojis or shortcuts. This requires defining your own definitions and shortcuts.
- [Light](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/light.js), with only well-supported unicode emojis and reduced size.
- Bare, without included emojis or shortcuts. This requires defining your own definitions and shortcuts.

Also supports emoticons [shortcuts](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/shortcuts.js) like `:)`, `:-(`, and others. See the full list in the link above.

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';


var emojies_defs = require('./lib/data/full.json');
var emojies_defs = require('./lib/data/full');
var emojies_shortcuts = require('./lib/data/shortcuts');
var bare_emoji_plugin = require('./bare');

Expand Down
5 changes: 3 additions & 2 deletions lib/data/full.json → lib/data/full.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
// Generated, don't edit
module.exports = {
"100": "💯",
"1234": "🔢",
"grinning": "😀",
Expand Down Expand Up @@ -1902,4 +1903,4 @@
"england": "🏴󠁧󠁢󠁥󠁮󠁧󠁿",
"scotland": "🏴󠁧󠁢󠁳󠁣󠁴󠁿",
"wales": "🏴󠁧󠁢󠁷󠁬󠁳󠁿"
}
}
5 changes: 3 additions & 2 deletions lib/data/light.json → lib/data/light.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
// Generated, don't edit
module.exports = {
"grinning": "😀",
"smiley": "😃",
"smile": "😄",
Expand Down Expand Up @@ -149,4 +150,4 @@
"white_medium_small_square": "◽",
"black_small_square": "▪️",
"white_small_square": "▫️"
}
}
2 changes: 1 addition & 1 deletion light.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';


var emojies_defs = require('./lib/data/light.json');
var emojies_defs = require('./lib/data/light');
var emojies_shortcuts = require('./lib/data/shortcuts');
var bare_emoji_plugin = require('./bare');

Expand Down
13 changes: 11 additions & 2 deletions support/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ function download(url) {
});
}

function obj2js(obj) {
return `// Generated, don't edit
module.exports = ${JSON.stringify(obj, null, 2)}
`;
}

download(emojiSrc).then(data => {

let defs = JSON.parse(data.toString());
Expand Down Expand Up @@ -54,7 +60,10 @@ download(emojiSrc).then(data => {
});
});

fs.writeFileSync(join(__dirname, '../lib/data/full.json'), JSON.stringify(emojies, null, 2), 'utf8');



fs.writeFileSync(join(__dirname, '../lib/data/full.js'), obj2js(emojies), 'utf8');

//
// Write light set
Expand All @@ -72,6 +81,6 @@ download(emojiSrc).then(data => {
});
});

fs.writeFileSync(join(__dirname, '../lib/data/light.json'), JSON.stringify(emoji_light, null, 2), 'utf8');
fs.writeFileSync(join(__dirname, '../lib/data/light.js'), obj2js(emoji_light), 'utf8');

}).catch(err => console.error(err));
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ describe('markdown-it-emoji-bare', function () {


var emojies_shortcuts = require('../lib/data/shortcuts');
var emojies_defs = require('../lib/data/full.json');
var emojies_defs_light = require('../lib/data/light.json');
var emojies_defs = require('../lib/data/full');
var emojies_defs_light = require('../lib/data/light');

describe('integrity', function () {

Expand Down

0 comments on commit 49b3b46

Please sign in to comment.