Skip to content

Commit 700ba3c

Browse files
authored
feat: define interface for LessPluginModuleResolverOptions (#2)
1 parent 0904b34 commit 700ba3c

File tree

27 files changed

+2457
-76
lines changed

27 files changed

+2457
-76
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
*.js

.eslintrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
root: true,
3+
parser: '@typescript-eslint/parser',
4+
plugins: [
5+
'@typescript-eslint',
6+
],
7+
extends: [
8+
'eslint:recommended',
9+
'plugin:@typescript-eslint/recommended',
10+
'prettier',
11+
],
12+
rules: {
13+
'no-unused-vars': 'off',
14+
'@typescript-eslint/no-unused-vars': 'error',
15+
}
16+
};

.github/workflows/node.js.yml

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,46 @@ jobs:
2121
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2222

2323
steps:
24-
- uses: actions/checkout@v3
25-
- name: Use Node.js ${{ matrix.node-version }}
26-
uses: actions/setup-node@v1
27-
with:
28-
node-version: ${{ matrix.node-version }}
29-
cache: 'npm'
30-
- run: npm i
31-
- run: npm run build --if-present
32-
- run: npm run coverage
33-
- if: ${{ matrix.node-version == '14.x' && matrix.os == 'ubuntu-latest' }}
34-
name: Upload coverage to Codecov
35-
uses: codecov/codecov-action@v2
36-
with:
37-
token: ${{ secrets.CODECOV_TOKEN }}
38-
directory: ./coverage
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Install Node.js ${{ matrix.node-version }}
28+
uses: actions/setup-node@v1
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
cache: 'npm'
32+
33+
- name: Install pnpm
34+
uses: pnpm/action-setup@v2.2.1
35+
id: pnpm-install
36+
with:
37+
version: 7
38+
run_install: false
39+
40+
- name: Get pnpm store directory
41+
id: pnpm-cache
42+
run: |
43+
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
44+
45+
- name: Setup pnpm cache
46+
uses: actions/cache@v3
47+
with:
48+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
49+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
50+
restore-keys: |
51+
${{ runner.os }}-pnpm-store-
52+
53+
- name: Install dependencies
54+
run: pnpm install
55+
56+
- name: Tests
57+
run: |
58+
npm run lint
59+
npm run compile
60+
npm run coverage
61+
- if: ${{ matrix.node-version == '16.x' && matrix.os == 'ubuntu-latest' }}
62+
name: Upload coverage to Codecov
63+
uses: codecov/codecov-action@v2
64+
with:
65+
token: ${{ secrets.CODECOV_TOKEN }}
66+
directory: ./coverage

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,5 @@ dist
103103
# TernJS port file
104104
.tern-port
105105

106-
# pnpm lockfile
107-
pnpm-lock.yaml
108-
109106
# output
110-
lib
107+
lib

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run lint-staged

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "es5",
4+
"printWidth": 100,
5+
"proseWrap": "never",
6+
"arrowParens": "avoid"
7+
}

.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3+
"version": "0.2.0",
4+
"configurations": [
5+
{
6+
"type": "pwa-node",
7+
"request": "launch",
8+
"name": "Debug Current Test File",
9+
"autoAttachChildProcesses": true,
10+
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
11+
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
12+
"args": ["run", "${relativeFile}", "--threads", "false"],
13+
"smartStep": true,
14+
"console": "integratedTerminal"
15+
}
16+
]
17+
}

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# less-plugin-module-resolver
2-
1+
# Less Plugin Module Resolver
32

43
## Usage
54

@@ -10,4 +9,4 @@ const ModuleResolverPlugin = require('less-plugin-module-resolver');
109
less.render('input', {
1110
plugins: [new ModuleResolverPlugin()],
1211
});
13-
```
12+
```

package.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
"name": "less-plugin-module-resolver",
33
"version": "0.0.1",
44
"description": "",
5-
"main": "index.js",
5+
"main": "lib/index.js",
66
"scripts": {
77
"compile": "tsc",
8+
"lint": "eslint src",
89
"test": "vitest",
9-
"coverage": "vitest run --coverage"
10+
"coverage": "c8 --reporter=lcov vitest run --coverage",
11+
"lint-staged": "lint-staged"
1012
},
1113
"repository": {
1214
"type": "git",
@@ -23,9 +25,21 @@
2325
"@less/test-data": "^4.1.0",
2426
"@types/less": "^3.0.3",
2527
"@types/node": "^17.0.31",
28+
"@typescript-eslint/eslint-plugin": "^5.23.0",
29+
"@typescript-eslint/parser": "^5.23.0",
2630
"c8": "^7.11.2",
31+
"eslint": "^8.15.0",
32+
"eslint-config-prettier": "^8.5.0",
33+
"husky": "^8.0.1",
2734
"less": "^4.1.2",
35+
"lint-staged": "^12.4.1",
36+
"normalize.css": "^8.0.1",
37+
"prettier": "^2.6.2",
2838
"typescript": "^4.6.4",
2939
"vitest": "^0.10.2"
40+
},
41+
"lint-staged": {
42+
"*.{ts,js}": "eslint --cache --fix",
43+
"*.{ts,js,css,md}": "prettier --write"
3044
}
3145
}

0 commit comments

Comments
 (0)