Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: first blood, should just work #1

Merged
merged 4 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.6.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "rx-ts/markuplint-sync"
}
],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/little-hats-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"markuplint-sync": minor
---

feat: first blood, should just work
4 changes: 4 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"node": "14",
"sandboxes": []
}
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [JounQin]
open_collective: rxts
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
- push
- pull_request

jobs:
ci:
name: Lint and Test with Node.js ${{ matrix.node }}
strategy:
matrix:
node:
- 10
- 12
- 14
- 16
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node }}

- name: Link Yarn global binaries into PATH
run: echo "$(yarn global bin)" >> $GITHUB_PATH

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install Dependencies
run: yarn --frozen-lockfile

- name: Build, Lint and test
run: |
yarn build
yarn lint
yarn test
env:
EFF_NO_LINK_RULES: true
PARSER_NO_WATCH: true

- name: Codecov
if: matrix.node == 14 # only report coverage once per commit
run: |
yarn global add codecov codacy-coverage
codecov
cat ./coverage/lcov.info | codacy-coverage -u rx-ts -n markuplint-sync
env:
CI: 'true'
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODACY_ACCOUNT_TOKEN: ${{ secrets.CODACY_ACCOUNT_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js 14.x
uses: actions/setup-node@master
with:
node-version: 14.x

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install Dependencies
run: yarn --frozen-lockfile --ignore-scripts

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@master
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage
lib
node_modules
tmp*
/rules
1 change: 1 addition & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@1stg/lint-staged')
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/rules/**
1 change: 1 addition & 0 deletions .simple-git-hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@1stg/simple-git-hooks')
Empty file added CHANGELOG.md
Empty file.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,53 @@
# markuplint-sync

[![GitHub Actions](https://github.com/rx-ts/markuplint-sync/workflows/CI/badge.svg)](https://github.com/rx-ts/markuplint-sync/actions/workflows/ci.yml)
[![Codecov](https://img.shields.io/codecov/c/github/rx-ts/markuplint-sync.svg)](https://codecov.io/gh/rx-ts/markuplint-sync)
[![Codacy Grade](https://img.shields.io/codacy/grade/b9c7ab8f6c644e7fa6cf80528ad306c6)](https://www.codacy.com/gh/rx-ts/markuplint-sync)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Frx-ts%2Fmarkuplint-sync%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![npm](https://img.shields.io/npm/v/markuplint-sync.svg)](https://www.npmjs.com/package/markuplint-sync)
[![GitHub Release](https://img.shields.io/github/release/rx-ts/markuplint-sync)](https://github.com/rx-ts/markuplint-sync/releases)

[![David Peer](https://img.shields.io/david/peer/rx-ts/markuplint-sync.svg)](https://david-dm.org/rx-ts/markuplint-sync?type=peer)
[![David](https://img.shields.io/david/rx-ts/markuplint-sync.svg)](https://david-dm.org/rx-ts/markuplint-sync)
[![David Dev](https://img.shields.io/david/dev/rx-ts/markuplint-sync.svg)](https://david-dm.org/rx-ts/markuplint-sync?type=dev)

[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

Same as markuplint but extends with sync API.

## Usage

```sh
# yarn
yarn add markuplint-sync

# npm
npm i markuplint-sync
```

### API

```js
import { exec } from 'markuplint-sync'

const result = exec({
files: './**/*.html',
})

console.log(result) // => The results in JSON format
```

## Changelog

Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).

## License

[MIT][] © [JounQin][]@[1stG.me][]

[1stg.me]: https://www.1stg.me
[jounqin]: https://GitHub.com/JounQin
[mit]: http://opensource.org/licenses/MIT
115 changes: 115 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"name": "markuplint-sync",
"version": "0.0.0",
"description": "Same as markuplint but extends with sync API.",
"repository": "git+https://github.com/rx-ts/markuplint-sync.git",
"author": "JounQin <admin@1stg.me>",
"license": "MIT",
"engines": {
"node": ">=10"
},
"main": "lib",
"module": "lib/es2015",
"es2015": "lib/es2015",
"types": "lib",
"files": [
"lib",
"rules",
"!*.tsbuildinfo"
],
"keywords": [],
"scripts": {
"build": "run-p build:*",
"build:r": "r -f es2015",
"build:rules": "rimraf rules && node scripts/patch-rules",
"build:ts": "tsc -P src",
"lint": "run-p lint:*",
"lint:es": "eslint . --cache -f friendly --max-warnings 10",
"lint:tsc": "tsc --noEmit",
"prepare": "simple-git-hooks && patch-package && yarn-deduplicate --strategy fewer || exit 0",
"prerelease": "npm run build",
"release": "clean-publish && changeset publish",
"test": "jest",
"typecov": "type-coverage"
},
"dependencies": {
"@markuplint/file-resolver": "^1.2.1",
"@markuplint/html-spec": "^1.4.2",
"@markuplint/i18n": "^1.1.0",
"@markuplint/ml-ast": "^1.3.0",
"@markuplint/ml-config": "^1.1.0",
"@markuplint/ml-core": "^1.4.1",
"@markuplint/ml-spec": "^1.3.0",
"cosmiconfig": "^7.0.0",
"glob": "^7.1.6",
"markuplint": "^1.6.1",
"os-locale": "^5.0.0",
"tslib": "^2.2.0"
},
"devDependencies": {
"@1stg/lib-config": "^1.2.10",
"@changesets/changelog-github": "^0.4.0",
"@changesets/cli": "^2.16.0",
"@markuplint/rule-textlint": "^0.0.1-alpha.46",
"@types/jest": "^26.0.22",
"@types/node": "^15.0.1",
"@types/uuid": "^8.3.0",
"clean-publish": "^2.1.1",
"eslint-plugin-mdx": "https://pkg.csb.dev/mdx-js/eslint-mdx/commit/625996b8/eslint-plugin-mdx",
"fs-extra": "^9.1.0",
"npm-run-all": "^4.1.5",
"patch-package": "^6.4.7",
"remark-validate-links": "^10.0.4",
"rimraf": "^3.0.2",
"ts-expect": "^1.3.0",
"ts-jest": "^26.5.5",
"ts-node": "^9.1.1",
"type-coverage": "^2.17.3",
"typescript": "^4.2.4",
"yarn-deduplicate": "^3.1.0"
},
"resolutions": {
"tslib": "^2.2.0"
},
"commitlint": {
"extends": "@1stg"
},
"eslintConfig": {
"extends": "@1stg"
},
"eslintIgnore": [
"coverage",
"lib",
"CHANGELOG.md",
"/rules"
],
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"collectCoverage": true,
"coveragePathIgnorePatterns": [
"<rootDir>/rules"
],
"moduleNameMapper": {
"^markuplint-sync$": "<rootDir>/src"
}
},
"prettier": "@1stg/prettier-config",
"remarkConfig": {
"plugins": [
"@1stg/remark-config",
"validate-links"
]
},
"renovate": {
"extends": [
"@1stg"
]
},
"typeCoverage": {
"atLeast": 98.24,
"detail": true,
"strict": true,
"update": true
}
}
56 changes: 56 additions & 0 deletions patches/@markuplint+file-resolver+1.2.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
diff --git a/node_modules/@markuplint/file-resolver/lib/helper.d.ts b/node_modules/@markuplint/file-resolver/lib/helper.d.ts
index 63cb3a6..fff40c0 100644
--- a/node_modules/@markuplint/file-resolver/lib/helper.d.ts
+++ b/node_modules/@markuplint/file-resolver/lib/helper.d.ts
@@ -10,4 +10,5 @@ export declare function load<T = CosmiConfig>(filePath: string, cacheClear: bool
config: T;
} | null>;
export declare function recursiveLoad(config: Config, filePath: string, files: Set<string>, cacheClear: boolean): Promise<ConfigSet>;
+export declare function margeConfig(a: Config, b: Config): Config;
export {};
diff --git a/node_modules/@markuplint/file-resolver/lib/helper.js b/node_modules/@markuplint/file-resolver/lib/helper.js
index 6f8e576..26c902e 100644
--- a/node_modules/@markuplint/file-resolver/lib/helper.js
+++ b/node_modules/@markuplint/file-resolver/lib/helper.js
@@ -99,3 +99,4 @@ exports.recursiveLoad = recursiveLoad;
function margeConfig(a, b) {
return Object.assign(Object.assign(Object.assign({}, a), b), { rules: Object.assign(Object.assign({}, a.rules), b.rules), nodeRules: [...(a.nodeRules || []), ...(b.nodeRules || [])], childNodeRules: [...(a.childNodeRules || []), ...(b.childNodeRules || [])] });
}
+exports.margeConfig = margeConfig;
diff --git a/node_modules/@markuplint/file-resolver/lib/index.d.ts b/node_modules/@markuplint/file-resolver/lib/index.d.ts
index 41f4bda..ceb6256 100644
--- a/node_modules/@markuplint/file-resolver/lib/index.d.ts
+++ b/node_modules/@markuplint/file-resolver/lib/index.d.ts
@@ -1,7 +1,7 @@
export { getAnonymousFile } from './get-anonymous-file';
export { getFiles } from './get-files';
export { getFile } from './get-file';
-export { recursiveLoad } from './helper';
+export { recursiveLoad, margeConfig } from './helper';
export { loadConfigFile } from './load-config-file';
export { MLFile } from './ml-file';
export { searchConfigFile } from './search-config-file';
diff --git a/node_modules/@markuplint/file-resolver/lib/index.js b/node_modules/@markuplint/file-resolver/lib/index.js
index ef9b20b..6eb3adf 100644
--- a/node_modules/@markuplint/file-resolver/lib/index.js
+++ b/node_modules/@markuplint/file-resolver/lib/index.js
@@ -9,6 +9,7 @@ var get_file_1 = require("./get-file");
Object.defineProperty(exports, "getFile", { enumerable: true, get: function () { return get_file_1.getFile; } });
var helper_1 = require("./helper");
Object.defineProperty(exports, "recursiveLoad", { enumerable: true, get: function () { return helper_1.recursiveLoad; } });
+Object.defineProperty(exports, "margeConfig", { enumerable: true, get: function () { return helper_1.margeConfig; } });
var load_config_file_1 = require("./load-config-file");
Object.defineProperty(exports, "loadConfigFile", { enumerable: true, get: function () { return load_config_file_1.loadConfigFile; } });
var ml_file_1 = require("./ml-file");
diff --git a/node_modules/@markuplint/file-resolver/lib/types.d.ts b/node_modules/@markuplint/file-resolver/lib/types.d.ts
index 1203b14..215292d 100644
--- a/node_modules/@markuplint/file-resolver/lib/types.d.ts
+++ b/node_modules/@markuplint/file-resolver/lib/types.d.ts
@@ -1,5 +1,5 @@
-import { Config } from '@markuplint/ml-config/';
-export { Config } from '@markuplint/ml-config/';
+import { Config } from '@markuplint/ml-config';
+export { Config } from '@markuplint/ml-config';
export interface ConfigSet {
config: Config;
files: Set<string>;
Loading