init
This commit is contained in:
commit
80d0dc4a48
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@ -0,0 +1,2 @@
|
||||
/dist/
|
||||
*.d.ts
|
17
.eslintrc.js
Normal file
17
.eslintrc.js
Normal file
@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
commonjs: true,
|
||||
es6: true,
|
||||
node: true
|
||||
},
|
||||
extends: [
|
||||
'@scode'
|
||||
],
|
||||
globals: {
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly'
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018
|
||||
}
|
||||
}
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/node_modules/
|
||||
/dist/
|
||||
/.nyc_output/
|
||||
/coverage/
|
17
lib/.eslintrc.js
Normal file
17
lib/.eslintrc.js
Normal file
@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
commonjs: true,
|
||||
es6: true,
|
||||
node: true
|
||||
},
|
||||
extends: [
|
||||
'@scode/eslint-config-ts'
|
||||
],
|
||||
globals: {
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly'
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018
|
||||
}
|
||||
}
|
28
lib/InteractiveOptions.ts
Normal file
28
lib/InteractiveOptions.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { Persistent } from '@scode/modelling';
|
||||
|
||||
enum OptionType {
|
||||
string = 'string',
|
||||
number = 'number',
|
||||
boolean = 'boolean'
|
||||
}
|
||||
|
||||
interface Option {
|
||||
name: string;
|
||||
type: OptionType;
|
||||
required?: boolean;
|
||||
default: unknown;
|
||||
}
|
||||
|
||||
export class InteractiveOptions extends Persistent {
|
||||
public constructor (options: Array<Option>) {
|
||||
super ();
|
||||
for (const option of options) {
|
||||
if (typeof option.default !== option.type) {
|
||||
throw new Error (
|
||||
`default does not match option type on ${option.name}`
|
||||
);
|
||||
}
|
||||
this.properties[option.name] = option.type;
|
||||
}
|
||||
}
|
||||
}
|
29
package.json
Normal file
29
package.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "@scode/console-app",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"author": "Timo Hocker <thocker@oas.de>",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@ava/typescript": "^1.1.1",
|
||||
"@scode/eslint-config-ts": "^1.0.31",
|
||||
"ava": "^3.8.1",
|
||||
"eslint": "^6.8.0",
|
||||
"nyc": "^15.0.1",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs",
|
||||
"test": "echo \"no test\"",
|
||||
"compile": "tsc"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"/dist/"
|
||||
],
|
||||
"dependencies": {
|
||||
"@scode/modelling": "^1.0.24",
|
||||
"enquirer": "^2.3.5",
|
||||
"yargs": "^15.3.1"
|
||||
}
|
||||
}
|
12
tsconfig.json
Normal file
12
tsconfig.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./lib",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"declaration": true
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user