tools: use lint-md.js

* remove unused `tools/remark-cli`
* vcbuild tested with `vcbuild nobuild noprojgen lint-md-build lint-md`

PR-URL: https://github.com/nodejs/node/pull/20109
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Refael Ackermann 2018-09-06 16:17:54 -04:00
parent fe6c74c2a5
commit e4dd213516
12 changed files with 22 additions and 1471 deletions

View File

@ -9,7 +9,6 @@ test/message/esm_display_syntax_error.mjs
tools/icu
tools/lint-md.js
tools/node-lint-md-cli-rollup/dist
tools/remark-*
benchmark/tmp
doc/**/*.js
!.eslintrc.js

3
.gitignore vendored
View File

@ -14,7 +14,6 @@
!.gitkeep
!.mailmap
!.nycrc
!.remarkrc
!.travis.yml
core
@ -114,8 +113,6 @@ tools/doc/node_modules
tools/clang-format/node_modules
# test artifacts
tools/remark-cli/node_modules
tools/remark-preset-lint-node/node_modules
icu_config.gypi
*.tap

View File

@ -1,5 +0,0 @@
{
"plugins": [
"./tools/node-lint-md-cli-rollup/remark-preset-lint-node/"
]
}

26
LICENSE
View File

@ -1277,32 +1277,6 @@ The externally maintained libraries used by Node.js are:
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
- remark-cli, located at tools/remark-cli, is licensed as follows:
"""
(The MIT License)
Copyright (c) 2014-2016 Titus Wormer <tituswormer@gmail.com>
Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
- node-inspect, located at deps/node-inspect, is licensed as follows:
"""
Copyright Node.js contributors. All rights reserved.

View File

@ -615,6 +615,13 @@ apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json))
apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
tools/doc/node_modules: tools/doc/package.json
ifeq ($(node_use_openssl),true)
cd tools/doc && $(call available-node,$(run-npm-ci))
else
@echo "Skipping tools/doc/node_modules (no crypto)"
endif
.PHONY: doc-only
doc-only: tools/doc/node_modules \
$(apidoc_dirs) $(apiassets) ## Builds the docs with the local or the global Node.js binary.
@ -932,8 +939,6 @@ $(TARBALL): release-only $(NODE_EXE) doc
$(RM) -r $(TARNAME)/tools/osx-*
$(RM) -r $(TARNAME)/tools/osx-pkg.pmdoc
$(RM) -r $(TARNAME)/tools/pkgsrc
$(RM) -r $(TARNAME)/tools/remark-cli
$(RM) -r $(TARNAME)/tools/remark-preset-lint-node
find $(TARNAME)/ -name ".eslint*" -maxdepth 2 | xargs $(RM)
find $(TARNAME)/ -type l | xargs $(RM) # annoying on windows
tar -cf $(TARNAME).tar $(TARNAME)
@ -1061,74 +1066,41 @@ lint-md-rollup:
cd tools/node-lint-md-cli-rollup && npm up
cd tools/node-lint-md-cli-rollup && npm run build-node
.PHONY: lint-md-clean
lint-md-clean:
$(RM) -r tools/remark-cli/node_modules
$(RM) -r tools/node-lint-md-cli-rollup/remark-preset-lint-node/node_modules
$(RM) -r tools/node-lint-md-cli-rollup/node_modules
$(RM) tools/.*mdlintstamp
tools/remark-cli/node_modules: tools/remark-cli/package.json
@echo "Markdown linter: installing remark-cli into tools/"
@cd tools/remark-cli && $(call available-node,$(run-npm-ci))
tools/node-lint-md-cli-rollup/remark-preset-lint-node/node_modules: \
tools/node-lint-md-cli-rollup/remark-preset-lint-node/package.json
@echo "Markdown linter: installing remark-preset-lint-node"
@cd tools/node-lint-md-cli-rollup/remark-preset-lint-node && $(call available-node,$(run-npm-ci))
.PHONY: lint-md-build
lint-md-build: tools/remark-cli/node_modules \
tools/doc/node_modules \
tools/node-lint-md-cli-rollup/remark-preset-lint-node/node_modules
tools/doc/node_modules: tools/doc/package.json
ifeq ($(node_use_openssl),true)
cd tools/doc && $(call available-node,$(run-npm-ci))
else
@echo "Skipping tools/doc/node_modules (no crypto)"
endif
.PHONY: lint-md
ifneq ("","$(wildcard tools/remark-cli/node_modules/)")
lint-md-build:
$(warning "Deprecated no-op target 'lint-md-build'")
LINT_MD_DOC_FILES = $(shell ls doc/*.md doc/**/*.md)
run-lint-doc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_DOC_FILES)
run-lint-doc-md = tools/lint-md.js -q -f $(LINT_MD_DOC_FILES)
# Lint all changed markdown files under doc/
tools/.docmdlintstamp: $(LINT_MD_DOC_FILES)
ifeq ($(node_use_openssl),true)
@echo "Running Markdown linter on docs..."
@$(call available-node,$(run-lint-doc-md))
@touch $@
else
@echo "Skipping Markdown linter on docs (no crypto)"
endif
$(call available-node,$(run-lint-doc-md))
touch $@
LINT_MD_TARGETS = src lib benchmark test tools/doc tools/icu
LINT_MD_ROOT_DOCS := $(wildcard *.md)
LINT_MD_MISC_FILES := $(shell find $(LINT_MD_TARGETS) -type f \
-not -path '*node_modules*' -name '*.md') $(LINT_MD_ROOT_DOCS)
run-lint-misc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_MISC_FILES)
run-lint-misc-md = tools/lint-md.js -q -f $(LINT_MD_MISC_FILES)
# Lint other changed markdown files maintained by us
tools/.miscmdlintstamp: $(LINT_MD_MISC_FILES)
ifeq ($(node_use_openssl),true)
@echo "Running Markdown linter on misc docs..."
@$(call available-node,$(run-lint-misc-md))
@touch $@
else
@echo "Skipping Markdown linter on misc docs (no crypto)"
endif
$(call available-node,$(run-lint-misc-md))
touch $@
tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp
.PHONY: lint-md
# Lints the markdown documents maintained by us in the codebase.
lint-md: | tools/.mdlintstamp
else
lint-md:
@echo "The markdown linter is not installed."
@echo "To install (requires internet access) run: $ make lint-md-build"
endif
LINT_JS_TARGETS = .eslintrc.js benchmark doc lib test tools

View File

@ -85,9 +85,6 @@ addlicense "gtest" "deps/gtest" "$(cat ${rootdir}/deps/gtest/LICENSE)"
# nghttp2
addlicense "nghttp2" "deps/nghttp2" "$(cat ${rootdir}/deps/nghttp2/COPYING)"
# remark
addlicense "remark-cli" "tools/remark-cli" "$(cat ${rootdir}/tools/remark-cli/LICENSE)"
# node-inspect
addlicense "node-inspect" "deps/node-inspect" "$(cat ${rootdir}/deps/node-inspect/LICENSE)"

View File

@ -1,22 +0,0 @@
(The MIT License)
Copyright (c) 2014-2016 Titus Wormer <tituswormer@gmail.com>
Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,34 +0,0 @@
#!/usr/bin/env node
/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module remark:cli
* @fileoverview CLI to process markdown.
*/
'use strict';
/* Dependencies. */
var start = require('unified-args');
var extensions = require('markdown-extensions');
var processor = require('remark');
var proc = require('remark/package.json');
var cli = require('./package.json');
/* Start. */
start({
processor: processor,
name: proc.name,
description: cli.description,
version: [
proc.name + ': ' + proc.version,
cli.name + ': ' + cli.version
].join(', '),
pluginPrefix: proc.name,
presetPrefix: proc.name + '-preset',
packageField: proc.name + 'Config',
rcName: '.' + proc.name + 'rc',
ignoreName: '.' + proc.name + 'ignore',
extensions: extensions
});

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +0,0 @@
{
"name": "remark-cli",
"version": "4.0.0",
"description": "CLI to process markdown with remark using plugins",
"license": "MIT",
"keywords": [
"markdown",
"remark",
"cli",
"bin"
],
"dependencies": {
"markdown-extensions": "^1.1.0",
"remark": "^8.0.0",
"unified-args": "^4.0.0"
},
"homepage": "http://remark.js.org",
"repository": "https://github.com/wooorm/remark/tree/master/packages/remark-cli",
"bugs": "https://github.com/wooorm/remark/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)"
],
"bin": {
"remark": "cli.js"
},
"files": [
"cli.js"
],
"scripts": {},
"xo": false
}

View File

@ -1,111 +0,0 @@
# remark-cli [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat]
Command-line interface for [**remark**][remark].
* Loads [`remark-` plugins][plugins]
* Searches for [markdown extensions][markdown-extensions]
* Ignores paths found in [`.remarkignore` files][ignore-file]
* Loads configuration from [`.remarkrc`, `.remarkrc.js` files][config-file]
* Uses configuration from [`remarkConfig` fields in `package.json`
files][config-file]
## Installation
[npm][]:
```sh
npm install remark-cli
```
## Usage
```sh
# Add a table of contents to `readme.md`
$ remark readme.md --use toc --output
# Lint markdown files in the current directory
# according to the markdown style guide.
$ remark . --use preset-lint-markdown-style-guide
```
## CLI
See [**unified-args**][unified-args], which provides the interface,
for more information on all available options.
```txt
Usage: remark [options] [path | glob ...]
CLI to process markdown with remark using plugins
Options:
-h --help output usage information
-v --version output version number
-o --output [path] specify output location
-r --rc-path <path> specify configuration file
-i --ignore-path <path> specify ignore file
-s --setting <settings> specify settings
-e --ext <extensions> specify extensions
-u --use <plugins> use plugins
-p --preset <presets> use presets
-w --watch watch for changes and reprocess
-q --quiet output only warnings and errors
-S --silent output only errors
-f --frail exit with 1 on warnings
-t --tree specify input and output as syntax tree
--file-path <path> specify path to process as
--tree-in specify input as syntax tree
--tree-out output syntax tree
--[no-]stdout specify writing to stdout (on by default)
--[no-]color specify color in report (on by default)
--[no-]config search for configuration files (on by default)
--[no-]ignore search for ignore files (on by default)
Examples:
# Process `input.md`
$ remark input.md -o output.md
# Pipe
$ remark < input.md > output.md
# Rewrite all applicable files
$ remark . -o
```
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://img.shields.io/travis/wooorm/remark.svg
[build-status]: https://travis-ci.org/wooorm/remark
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/remark.svg
[coverage-status]: https://codecov.io/github/wooorm/remark
[chat-badge]: https://img.shields.io/gitter/room/wooorm/remark.svg
[chat]: https://gitter.im/wooorm/remark
[license]: https://github.com/wooorm/remark/blob/master/LICENSE
[author]: http://wooorm.com
[npm]: https://docs.npmjs.com/cli/install
[remark]: https://github.com/wooorm/remark
[plugins]: https://github.com/wooorm/remark/blob/master/doc/plugins.md
[markdown-extensions]: https://github.com/sindresorhus/markdown-extensions
[config-file]: https://github.com/wooorm/unified-engine/blob/master/doc/configure.md
[ignore-file]: https://github.com/wooorm/unified-engine/blob/master/doc/ignore.md
[unified-args]: https://github.com/wooorm/unified-args#cli

View File

@ -197,8 +197,6 @@ if defined TAG set configure_flags=%configure_flags% --tag=%TAG%
if not "%target%"=="Clean" goto skip-clean
rmdir /Q /S "%~dp0%config%\node-v%FULLVERSION%-win-%target_arch%" > nul 2> nul
rmdir /Q /S "%~dp0tools\remark-cli\node_modules"
rmdir /Q /S "%~dp0tools\remark-preset-lint-node\node_modules"
:skip-clean
if defined noprojgen if defined nobuild if not defined sign if not defined msi goto licensertf
@ -609,49 +607,23 @@ goto lint-md-build
:lint-md-build
if not defined lint_md_build goto lint-md
SETLOCAL
echo Markdown linter: installing remark-cli into tools\
cd tools\remark-cli
%npm_exe% ci
cd ..\..
if errorlevel 1 goto lint-md-build-failed
echo Markdown linter: installing remark-preset-lint-node into tools\
cd tools\remark-preset-lint-node
%npm_exe% ci
cd ..\..
if errorlevel 1 goto lint-md-build-failed
ENDLOCAL
echo "Deprecated no-op target 'lint_md_build'"
goto lint-md
:if errorlevel 1 goto lint-md-build-failed
ENDLOCAL
echo Failed to install markdown linter
exit /b 1
:lint-md
if not defined lint_md goto exit
if not exist tools\remark-cli\node_modules goto lint-md-no-tools
if not exist tools\remark-preset-lint-node\node_modules goto lint-md-no-tools
echo Running Markdown linter on docs...
SETLOCAL ENABLEDELAYEDEXPANSION
set lint_md_files=
cd doc
for /D %%D IN (*) do (
for /D %%D IN (doc\*) do (
for %%F IN (%%D\*.md) do (
set "lint_md_files="doc\%%F" !lint_md_files!"
set "lint_md_files="%%F" !lint_md_files!"
)
)
cd ..
%config%\node tools\remark-cli\cli.js -q -f %lint_md_files%
%config%\node tools\lint-md.js -q -f %lint_md_files%
ENDLOCAL
goto exit
:lint-md-no-tools
echo The markdown linter is not installed.
echo To install (requires internet access) run: vcbuild lint-md-build
goto exit
:create-msvs-files-failed
echo Failed to create vc project files.
del .used_configure_flags