feat: Implement draft version of CLI package

This commit is contained in:
Faruk AYDIN
2022-02-26 00:29:37 +03:00
committed by Ömer Faruk Aydın
parent 059c039a8b
commit c732780672
16 changed files with 7625 additions and 146 deletions

View File

@@ -0,0 +1,11 @@
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

View File

@@ -0,0 +1 @@
/dist

0
packages/cli/.eslintrc Normal file
View File

16
packages/cli/.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: "npm"
versioning-strategy: increase
directory: "/"
schedule:
interval: "monthly"
labels:
- "dependencies"
open-pull-requests-limit: 100
pull-request-branch-name:
separator: "-"
ignore:
- dependency-name: "fs-extra"
- dependency-name: "*"
update-types: ["version-update:semver-major"]

9
packages/cli/.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
*-debug.log
*-error.log
/.nyc_output
/dist
/lib
/package-lock.json
/tmp
node_modules
oclif.manifest.json

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env node #!/usr/bin/env node
const packageJson = require('../package');
const version = packageJson.version;
console.log(`Automatisch@${version} CLI tool`); const oclif = require('@oclif/core')
process.exit(0);
oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'))

View File

@@ -0,0 +1,3 @@
@echo off
node "%~dp0\automatisch" %*

17
packages/cli/bin/dev Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env node
const oclif = require('@oclif/core')
const path = require('path')
const project = path.join(__dirname, '..', 'tsconfig.json')
// In dev mode -> use ts-node and dev plugins
process.env.NODE_ENV = 'development'
require('ts-node').register({project})
// In dev mode, always show stack traces
oclif.settings.debug = true;
// Start the CLI
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)

3
packages/cli/bin/dev.cmd Normal file
View File

@@ -0,0 +1,3 @@
@echo off
node "%~dp0\dev" %*

View File

@@ -9,28 +9,59 @@
} }
], ],
"homepage": "https://github.com/automatisch/automatisch#readme", "homepage": "https://github.com/automatisch/automatisch#readme",
"main": "src/cli.js", "main": "dist/index.js",
"directories": { "bin": {
"bin": "bin", "automatisch": "./bin/automatisch"
"src": "src",
"test": "__tests__"
}, },
"files": [ "files": [
"src", "/bin",
"bin" "/dist",
"oclif.manifest.json"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/automatisch/automatisch.git" "url": "git+https://github.com/automatisch/automatisch.git"
}, },
"scripts": { "scripts": {
"lint": "eslint . --ignore-path ../../.eslintignore", "build": "shx rm -rf dist && tsc -b",
"test": "echo \"Error: run tests from root\" && exit 1" "lint": "eslint . --ext .ts --config .eslintrc",
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "yarn lint",
"prepack": "yarn build && oclif manifest && oclif readme",
"version": "oclif readme && git add README.md"
},
"dependencies": {
"@oclif/core": "^1",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^2.0.1"
},
"devDependencies": {
"@oclif/test": "^2",
"@types/node": "^16.9.4",
"eslint": "^7.32.0",
"eslint-config-oclif": "^4",
"eslint-config-oclif-typescript": "^1.0.2",
"globby": "^11",
"oclif": "^2",
"shx": "^0.3.3",
"ts-node": "^10.2.1",
"tslib": "^2.3.1",
"typescript": "^4.4.3"
},
"oclif": {
"bin": "automatisch",
"dirname": "automatisch",
"commands": "./dist/commands",
"plugins": [
"@oclif/plugin-help",
"@oclif/plugin-plugins"
]
},
"engines": {
"node": ">=12.0.0"
}, },
"bugs": { "bugs": {
"url": "https://github.com/automatisch/automatisch/issues" "url": "https://github.com/automatisch/automatisch/issues"
}, },
"devDependencies": { "types": "dist/index.d.ts"
"eslint": "8.7.0"
}
} }

View File

@@ -1,8 +0,0 @@
'use strict';
// eslint-disable-next-line no-undef
module.exports = cli;
function cli() {
// TODO
}

View File

@@ -0,0 +1,9 @@
import { Command } from '@oclif/core';
export default class Start extends Command {
static description = 'Say hello world';
async run(): Promise<void> {
this.log('hello world from start script');
}
}

View File

@@ -0,0 +1 @@
export {run} from '@oclif/core'

View File

@@ -0,0 +1,13 @@
{
"compilerOptions": {
"declaration": true,
"importHelpers": true,
"module": "commonjs",
"outDir": "dist",
"rootDir": "src",
"strict": true,
"target": "es2019",
"typeRoots": ["node_modules/@types", "./src/types"]
},
"include": ["src/**/*"]
}

5484
packages/cli/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

2134
yarn.lock

File diff suppressed because it is too large Load Diff