-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: update Markdown linter to be cross-platform
Prior to this commit, the dependencies were not matching the build procedure. This has been corrected and it has the added benefit of being able to be built on Windows as well. * continue using `rollup` rather than `ncc` * do not require `fs-event`s for non-macOS * use `npx` and `shx` for cross-platform building * ensure `lint-md-rollup` runs before `lint-md` PR-URL: #31239 Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent
fda97fa
commit 95d509e
Showing
5 changed files
with
44,790 additions
and
127 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
{ | ||
"name": "node-lint-md-cli-rollup", | ||
"description": "remark packaged for Node.js Markdown linting", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"devDependencies": { | ||
"@zeit/ncc": "^0.21.0" | ||
"@rollup/plugin-commonjs": "^11.0.1", | ||
"@rollup/plugin-json": "^4.0.1", | ||
"@rollup/plugin-node-resolve": "^7.0.0", | ||
"rollup": "^1.30.1", | ||
"shx": "^0.3.2" | ||
}, | ||
"dependencies": { | ||
"markdown-extensions": "^1.1.1", | ||
"remark": "^11.0.2", | ||
"remark-lint": "^6.0.5", | ||
"remark-preset-lint-node": "^1.11.0", | ||
"remark-preset-lint-node": "^1.12.0", | ||
"unified-args": "^7.1.0" | ||
}, | ||
"main": "src/cli-entry.js", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "ncc build -m", | ||
"build-node": "npm run build && cp dist/index.js ../lint-md.js" | ||
"build": "npx rollup -c", | ||
"build-node": "npm run build && npx shx cp dist/index.js ../lint-md.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict'; | ||
|
||
const resolve = require('@rollup/plugin-node-resolve'); | ||
const commonjs = require('@rollup/plugin-commonjs'); | ||
const json = require('@rollup/plugin-json'); | ||
|
||
module.exports = { | ||
input: 'src/cli-entry.js', | ||
output: { | ||
file: 'dist/index.js', | ||
format: 'cjs', | ||
sourcemap: false, | ||
}, | ||
external: [ | ||
'stream', | ||
'path', | ||
'module', | ||
'util', | ||
'tty', | ||
'os', | ||
'fs', | ||
'fsevents', | ||
'events', | ||
'assert', | ||
], | ||
plugins: [ | ||
{ | ||
name: 'brute-replace', | ||
transform(code, id) { | ||
const normID = id.replace(__dirname, '').replace(/\\+/g, '/'); | ||
if (normID === '/node_modules/concat-stream/index.js') { | ||
return code.replace('\'readable-stream\'', '\'stream\''); | ||
} | ||
if (normID === '/node_modules/unified-args/lib/options.js') { | ||
return code.replace('\'./schema\'', '\'./schema.json\''); | ||
} | ||
if (normID === '/node_modules/chokidar/lib/fsevents-handler.js' && | ||
process.platform !== 'darwin') { | ||
return code.replace( | ||
'fsevents = require(\'fsevents\');', 'fsevents = undefined;' | ||
); | ||
} | ||
} | ||
}, | ||
json({ | ||
preferConst: true | ||
}), | ||
resolve(), // tells Rollup how to find date-fns in node_modules | ||
commonjs(), // Converts date-fns to ES modules | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters