Skip to content

Commit

Permalink
- Migrate cli branch code to the main branch
Browse files Browse the repository at this point in the history
- The input parameter supports multiple paths
- Add eslint check for code
- Add an empty folder
- Fix: cli file parsing error
  • Loading branch information
meshareL committed Jul 2, 2024
1 parent e561aa6 commit 9eff781
Show file tree
Hide file tree
Showing 35 changed files with 3,448 additions and 350 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true

- run: npm install
- run: npm ci
- run: npm run test --if-present
env:
CI: true
13 changes: 13 additions & 0 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env node
const { exit } = require('node:process')
, chalk = require('chalk')
, command = require('../dist/cli/command');

(async () => {
try {
await command(process.argv);
} catch (e) {
console.log(chalk.red.bold(`j-icon-cli: ${e}`));
exit(1);
}
})();
44 changes: 44 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import jslint from '@eslint/js';
import tslint from 'typescript-eslint';
import stylistic from '@stylistic/eslint-plugin';

export default [
jslint.configs.recommended,
...tslint.configs.recommended,
stylistic.configs.customize({
indent: 4,
quotes: 'single',
semi: true,
jsx: true,
commaDangle: 'never',
quoteProps: 'as-needed',
braceStyle: '1tbs'
}),
{
ignores: [
'node_modules/**',
'dist/**',
'test/template/**'
]
},
{
rules: {
'@stylistic/jsx-indent': [ 'error', 2 ],
'@stylistic/arrow-parens': [ 'warn', 'as-needed' ],
'@stylistic/comma-style': [ 'warn', 'last', {
exceptions: { VariableDeclaration: true }
}],
'@stylistic/array-bracket-spacing': [ 'warn', 'always', {
singleValue: true,
objectsInArrays: false,
arraysInArrays: false
}],
'@stylistic/jsx-tag-spacing': [ 'warn', {
closingSlash: 'never',
beforeSelfClosing: 'never',
afterOpening: 'never',
beforeClosing: 'allow'
}]
}
}
];
Loading

0 comments on commit 9eff781

Please sign in to comment.