Skip to content

Commit 95222f0

Browse files
committedOct 22, 2023
feat: basic CLI file structure
1 parent 9e6ca80 commit 95222f0

9 files changed

+6635
-0
lines changed
 

‎.eslintrc.cjs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
},
6+
7+
parser: '@typescript-eslint/parser',
8+
plugins: ['@typescript-eslint'],
9+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
10+
ignorePatterns: ['dist/**/*'],
11+
12+
rules: {
13+
'@typescript-eslint/ban-ts-comment': 'off',
14+
'@typescript-eslint/explicit-module-boundary-types': 'off',
15+
'@typescript-eslint/no-empty-function': 'off',
16+
'no-empty': 'off',
17+
},
18+
};

‎.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.sw*
2+
.DS_Store
3+
node_modules
4+
dist

‎.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

‎.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"bracketSpacing": true,
3+
"printWidth": 80,
4+
"semi": true,
5+
"singleQuote": true
6+
}

‎bin/cli.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env node
2+
3+
// Thin wrapper around mime
4+
import cli from '../dist/npmgraph_cli.js';
5+
6+
await cli();

‎package-lock.json

+6,517
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"author": {
3+
"name": "Robert Kieffer",
4+
"url": "http://github.com/broofa",
5+
"email": "robert@broofa.com"
6+
},
7+
"name": "npmgraph-cli",
8+
"version": "0.0.1",
9+
"type": "module",
10+
"description": "Command-line interface for npmgraph",
11+
"main": "index.js",
12+
"files": [
13+
"dist/*",
14+
"bin/*"
15+
],
16+
"bin": {
17+
"npmgraph": "bin/cli.js"
18+
},
19+
"license": "MIT",
20+
"devDependencies": {
21+
"@types/node": "20.5.9",
22+
"@typescript-eslint/eslint-plugin": "6.6.0",
23+
"@typescript-eslint/parser": "6.6.0",
24+
"chalk": "5.3.0",
25+
"prettier": "3.0.3",
26+
"runmd": "1.3.9",
27+
"standard-version": "9.5.0",
28+
"typescript": "5.2.2"
29+
},
30+
"scripts": {
31+
"build": "npm run build:clean && tsc",
32+
"build:clean": "rm -fr dist",
33+
"build:types": "node dist/scripts/build.js",
34+
"build:watch": "npm run build:clean && tsc --watch",
35+
"lint": "prettier -c .",
36+
"lint:fix": "prettier -w .",
37+
"prepare": "npm run build",
38+
"prepublishOnly": "npm run build && npm run build:types",
39+
"test": "node --test",
40+
"test:watch": "clear && node --enable-source-maps --test --watch test"
41+
},
42+
"repository": {
43+
"type": "git",
44+
"url": "git+https://github.com/npmgraph/npmgraph-cli.git"
45+
},
46+
"keywords": [
47+
"npmgraph",
48+
"cli"
49+
],
50+
"bugs": {
51+
"url": "https://github.com/npmgraph/npmgraph-cli/issues"
52+
},
53+
"homepage": "https://github.com/npmgraph/npmgraph-cli#readme",
54+
"funding": [
55+
"https://github.com/sponsors/broofa"
56+
]
57+
}

‎src/npmgraph_cli.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env node
2+
3+
import fs from 'node:fs/promises';
4+
import path from 'node:path';
5+
import { fileURLToPath } from 'node:url';
6+
7+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
8+
9+
export default async function () {
10+
process.title = 'npmgraph';
11+
12+
console.log('Hello, World!');
13+
}

‎tsconfig.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"allowSyntheticDefaultImports": true,
4+
"module": "es2022",
5+
"moduleResolution": "node",
6+
"outDir": "./dist",
7+
"removeComments": true,
8+
"strict": true,
9+
"sourceMap": true,
10+
"target": "ES2020"
11+
},
12+
"include": [ "src/**/*" ],
13+
}

0 commit comments

Comments
 (0)
Please sign in to comment.