markdown-magic 4.0.4 → 4.0.5

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,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-magic",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "description": "Automatically update markdown files with content from external sources",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -22,6 +22,11 @@
22
22
  "docs": "node examples/generate-readme.js",
23
23
  "test": "uvu . '.test.([mc]js|[jt]sx?)$'",
24
24
  "cli": "node ./cli.js --path 'README.md' --config ./markdown.config.js",
25
+ "bundle": "npm run bundle:all",
26
+ "bundle:all": "npm run bundle:mac && npm run bundle:linux && npm run bundle:windows",
27
+ "bundle:mac": "bun build ./cli.js --compile --minify --target=bun-darwin-arm64 --outfile dist/md-magic-darwin-arm64 && bun build ./cli.js --compile --minify --target=bun-darwin-x64 --outfile dist/md-magic-darwin-x64",
28
+ "bundle:linux": "bun build ./cli.js --compile --minify --target=bun-linux-x64 --outfile dist/md-magic-linux-x64 && bun build ./cli.js --compile --minify --target=bun-linux-arm64 --outfile dist/md-magic-linux-arm64",
29
+ "bundle:windows": "bun build ./cli.js --compile --minify --target=bun-windows-x64 --outfile dist/md-magic-windows-x64.exe",
25
30
  "postpublish": "git push origin && git push origin --tags",
26
31
  "release:patch": "pnpm version patch --git-tag-version && pnpm publish",
27
32
  "release:minor": "pnpm version minor --git-tag-version && pnpm publish",
@@ -36,9 +41,10 @@
36
41
  },
37
42
  "dependencies": {
38
43
  "@davidwells/md-utils": "0.0.53",
39
- "comment-block-parser": "1.1.1",
40
- "comment-block-replacer": "0.1.3",
41
- "comment-block-transformer": "0.2.2",
44
+ "color-convert": "^2.0.1",
45
+ "comment-block-parser": "1.1.2",
46
+ "comment-block-replacer": "0.1.4",
47
+ "comment-block-transformer": "0.2.3",
42
48
  "globrex": "^0.1.2",
43
49
  "gray-matter": "^4.0.3",
44
50
  "is-glob": "^4.0.3",
@@ -48,11 +54,10 @@
48
54
  "module-alias": "^2.2.3",
49
55
  "mri": "^1.2.0",
50
56
  "node-fetch": "^2.7.0",
51
- "oparser": "^3.0.22",
57
+ "oparser": "^3.0.24",
52
58
  "punycode": "^2.3.1",
53
59
  "smart-glob": "^1.0.2",
54
- "string-width": "^4.2.3",
55
- "sync-request": "^6.1.0"
60
+ "string-width": "^4.2.3"
56
61
  },
57
62
  "devDependencies": {
58
63
  "concordance": "^5.0.1",
@@ -65,5 +70,5 @@
65
70
  "publishConfig": {
66
71
  "access": "public"
67
72
  },
68
- "gitHead": "c67e6884103de807711ff608e100e1e0a211c2d8"
73
+ "gitHead": "7d81950b7a6d27d1192b1bc2d0f19d1d5ff0f321"
69
74
  }
package/src/cli-run.js CHANGED
@@ -21,6 +21,33 @@ function findSingleDashStrings(arr) {
21
21
  }
22
22
 
23
23
  async function runCli(options = {}, rawArgv) {
24
+ if (options.help || options.h) {
25
+ console.log(`
26
+ Usage: md-magic [options] [files...]
27
+
28
+ Options:
29
+ --files, --file Files or glob patterns to process
30
+ --config Path to config file (default: md.config.js)
31
+ --output Output directory
32
+ --dry Dry run - show what would be changed
33
+ --debug Show debug output
34
+ --help, -h Show this help message
35
+ --version, -v Show version
36
+
37
+ Examples:
38
+ md-magic README.md
39
+ md-magic --files "**/*.md"
40
+ md-magic --config ./my-config.js
41
+ `)
42
+ return
43
+ }
44
+
45
+ if (options.version || options.v) {
46
+ const pkg = require('../package.json')
47
+ console.log(pkg.version)
48
+ return
49
+ }
50
+
24
51
  let configFile
25
52
  let opts = {}
26
53
 
@@ -39,6 +39,7 @@ test('getGitignoreContents', async () => {
39
39
  'yarn-error.log*',
40
40
  'test/fixtures/output',
41
41
  '_out.md',
42
+ 'dist',
42
43
  'misc',
43
44
  'misc/**/**.js',
44
45
  "__misc",
@@ -1,28 +1,9 @@
1
1
  const fetch = require('node-fetch')
2
- const request = require('sync-request')
3
2
 
4
3
  function formatUrl(url = '') {
5
4
  return url.match(/^https?:\/\//) ? url : `https://${url}`
6
5
  }
7
6
 
8
- function remoteRequestSync(url, settings = {}, srcPath) {
9
- let body
10
- const finalUrl = formatUrl(url)
11
- try {
12
- // @ts-expect-error
13
- const res = request('GET', finalUrl)
14
- body = res.getBody('utf8')
15
- } catch (e) {
16
- console.log(`⚠️ WARNING: REMOTE URL "${finalUrl}" NOT FOUND`)
17
- const msg = (e.message || '').split('\n')[0] + `\nFix "${url}" value in ${srcPath}`
18
- console.log(msg)
19
- if (settings.failOnMissingRemote) {
20
- throw new Error(msg)
21
- }
22
- }
23
- return body
24
- }
25
-
26
7
  async function remoteRequest(url, settings = {}, srcPath) {
27
8
  let body
28
9
  const finalUrl = formatUrl(url)
@@ -45,7 +26,6 @@ async function remoteRequest(url, settings = {}, srcPath) {
45
26
  }
46
27
 
47
28
  module.exports = {
48
- remoteRequestSync,
49
29
  remoteRequest
50
30
  }
51
31