@tryghost/mg-jekyll-export 0.1.10 → 0.2.1

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/README.md CHANGED
@@ -49,8 +49,8 @@ It's possible to pass more options, in order to achieve a better migration file
49
49
  - **`-s` `--scrape`**
50
50
  - Configure scraping tasks
51
51
  - string - default: `all`
52
- - Choices: `all`, `img`, `web`, `media`, `none`
53
- - **`--size_limit`**
52
+ - Choices: `all`, `img`, `web`, `media`, `files`, `none`
53
+ - **`--sizeLimit`**
54
54
  - number - default: `false`
55
55
  - Media files larger than this size (defined in MB [i.e. `5`]) will be flagged as oversize
56
56
  - **`-u` `--url`**
package/index.js CHANGED
@@ -1,13 +1,9 @@
1
- const readZip = require('./lib/read-zip');
2
- const process = require('./lib/process');
1
+ import readZip from './lib/read-zip.js';
2
+ import process from './lib/process.js';
3
3
 
4
- const jekyllExport = module.exports = (pathToZip, options) => {
4
+ export default (pathToZip, options) => {
5
5
  let input = readZip(pathToZip, options);
6
6
  let output = process(input, options);
7
7
 
8
8
  return output;
9
9
  };
10
-
11
- if (require.main === module && process.argv[2]) {
12
- console.log(JSON.stringify(jekyllExport(process.argv[2]), null, 2)); // eslint-disable-line
13
- }
@@ -1,4 +1,4 @@
1
- const $ = require('cheerio');
1
+ import $ from 'cheerio';
2
2
 
3
3
  /*
4
4
  Process the HTML of a single Jekyll Post.
@@ -6,7 +6,7 @@ Process the HTML of a single Jekyll Post.
6
6
  Receives raw HTML, returns processed HTML
7
7
  */
8
8
 
9
- module.exports = (rawHtml, options = {}) => {
9
+ export default (rawHtml, options = {}) => {
10
10
  const $html = $.load(rawHtml, {
11
11
  decodeEntities: false
12
12
  });
@@ -1,11 +1,12 @@
1
- const MarkdownIt = require('markdown-it');
1
+ import MarkdownIt from 'markdown-it';
2
+ import string from '@tryghost/string';
3
+ import errors from '@tryghost/errors';
4
+ import fm from 'front-matter';
5
+ import processHtml from './process-html.js';
6
+
2
7
  const md = new MarkdownIt({
3
8
  html: true
4
9
  });
5
- const string = require('@tryghost/string');
6
- const errors = require('@tryghost/errors');
7
- const fm = require('front-matter');
8
- const processHtml = require('./process-html');
9
10
 
10
11
  // The frontmatter date may be a Date object or a string
11
12
  function _parseFrontMatterDate(fmDate) {
@@ -200,7 +201,7 @@ const processMeta = (fileName, fileContents, options) => {
200
201
  return post;
201
202
  };
202
203
 
203
- module.exports = (fileName, fileContents, globalUser = false, options = {}) => {
204
+ export default (fileName, fileContents, globalUser = false, options = {}) => {
204
205
  const post = processMeta(fileName, fileContents, options);
205
206
 
206
207
  // The post body may be in Markdown or HTML.
package/lib/process.js CHANGED
@@ -1,6 +1,6 @@
1
- const processPost = require('./process-post');
1
+ import processPost from './process-post.js';
2
2
 
3
- module.exports = (input, options = {}) => {
3
+ export default (input, options = {}) => {
4
4
  let output = {};
5
5
 
6
6
  let globalUser = {
package/lib/read-zip.js CHANGED
@@ -1,8 +1,8 @@
1
- const errors = require('@tryghost/errors');
2
- const fsUtils = require('@tryghost/mg-fs-utils');
3
- const ui = require('@tryghost/pretty-cli').ui;
1
+ import errors from '@tryghost/errors';
2
+ import fsUtils from '@tryghost/mg-fs-utils';
3
+ import {ui} from '@tryghost/pretty-cli';
4
4
 
5
- module.exports = (zipPath, options) => {
5
+ export default (zipPath, options) => {
6
6
  let content = {
7
7
  posts: []
8
8
  };
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@tryghost/mg-jekyll-export",
3
- "version": "0.1.10",
3
+ "version": "0.2.1",
4
4
  "description": "tbc",
5
5
  "repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-jekyll-export",
6
6
  "author": "Ghost Foundation",
7
7
  "license": "MIT",
8
8
  "main": "index.js",
9
+ "type": "module",
9
10
  "scripts": {
10
11
  "dev": "echo \"Implement me!\"",
11
- "test": "NODE_ENV=testing mocha ./test/**/*.test.js",
12
+ "test": "node --experimental-vm-modules $(yarn bin jest)",
12
13
  "lint": "eslint . --ext .js --cache",
13
14
  "posttest": "yarn lint"
14
15
  },
@@ -20,17 +21,17 @@
20
21
  "access": "public"
21
22
  },
22
23
  "devDependencies": {
23
- "mocha": "10.0.0",
24
- "should": "13.2.3",
25
- "sinon": "14.0.0"
24
+ "eslint": "8.25.0",
25
+ "jest": "29.1.2",
26
+ "jest-extended": "3.1.0"
26
27
  },
27
28
  "dependencies": {
28
29
  "@tryghost/errors": "^1.2.14",
29
- "@tryghost/mg-fs-utils": "^0.9.3",
30
+ "@tryghost/mg-fs-utils": "^0.10.1",
30
31
  "@tryghost/string": "^0.2.0",
31
32
  "cheerio": "0.22.0",
32
33
  "front-matter": "4.0.2",
33
34
  "markdown-it": "13.0.1"
34
35
  },
35
- "gitHead": "eb8c218c3b133ec2babb7c1911a8792d95c7e976"
36
+ "gitHead": "8f119b6c370337a90aa51dfbdb8d46ed7f5d154c"
36
37
  }