This commit is contained in:
Evert Prants 2021-12-18 10:36:28 +02:00
parent a72caa0cf9
commit c7bf60bd61
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
11 changed files with 2336 additions and 582 deletions

1
.eslintignore Normal file
View File

@ -0,0 +1 @@
*.js

46
.eslintrc.js Normal file
View File

@ -0,0 +1,46 @@
module.exports = {
'env': {
'es2021': true,
'node': true
},
'extends': [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaVersion': 13,
'sourceType': 'module',
'project': 'tsconfig.json',
'tsconfigRootDir': __dirname,
},
'plugins': [
'@typescript-eslint'
],
'rules': {
'no-empty': [
'error',
{
'allowEmptyCatch': true,
}
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'indent': [
'error',
2
],
'linebreak-style': [
'error',
'unix'
],
'quotes': [
'error',
'single'
],
'semi': [
'error',
'always'
]
}
};

2637
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@squeebot/cli",
"version": "3.4.2",
"version": "3.4.3",
"description": "Squeebot v3 runtime, environments and configuration",
"main": "dist/squeebot.js",
"bin": {
@ -25,11 +25,12 @@
"@types/node": "^16.7.10",
"@types/tar": "^4.0.5",
"@types/yargs": "^17.0.2",
"tslint": "^6.1.3",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"eslint": "^8.4.1",
"typescript": "^4.4.2"
},
"dependencies": {
"@squeebot/core": "^3.3.5",
"@squeebot/core": "^3.3.6",
"fs-extra": "^10.0.0",
"node-watch": "^0.7.1",
"tar": "^6.1.11",

View File

@ -1,4 +1,5 @@
export const gitignore = `/node_modules/
/.out/
deployment.json`;
deployment.json
`;

View File

@ -48,7 +48,7 @@ export async function buildRepository(
if (onlyDeploy) {
if (!await fs.pathExists(outDir)) {
throw new Error(`You need to build before deploying!`);
throw new Error('You need to build before deploying!');
} else {
return deploy(meta.name, location, outDir, doDeploy as string);
}

View File

@ -43,8 +43,10 @@ export async function newRepository(
await executor.installPackage('typescript');
await fs.writeJson(path.join(location, 'tsconfig.json'), tsConfig);
gitIgnore += '\n*.js';
gitIgnore += '\n!.eslintrc.js';
gitIgnore += '\n*.d.ts';
gitIgnore += '\n*.tsbuildinfo';
gitIgnore += '\n';
console.log('Adding TypeScript scripts to package.json');
const pkgjson = path.join(location, 'package.json');

View File

@ -55,7 +55,7 @@ export class Squeebot implements ISqueebotCore {
constructor(public environment: IEnvironment) {}
public async initialize(autostart: boolean = true): Promise<void> {
public async initialize(autostart = true): Promise<void> {
// Load configuration
await this.config.load();

View File

@ -11,9 +11,9 @@ const yar = yargs.scriptName('squeebot')
y.positional('name', {
describe: 'The name of the new environment',
})
.positional('path', {
describe: 'The path to create a new Squeebot environment at (default: working directory)',
});
.positional('path', {
describe: 'The path to create a new Squeebot environment at (default: working directory)',
});
}, (v) => newEnvironment(v.name as string, v.path as string))
.command('repository', 'manage repositories', (y) => {
y.command('new [name] [path]', 'create a new repository', (yi) => {
@ -21,40 +21,40 @@ const yar = yargs.scriptName('squeebot')
demandOption: 'The repository requires a name',
describe: 'The name of the new repository',
})
.positional('path', {
describe: 'The path to create the new Squeebot plugin repository at (default: working directory)',
})
.option('t', {
alias: 'no-typescript',
describe: 'Do not include typescript in the development environment',
type: 'boolean',
});
.positional('path', {
describe: 'The path to create the new Squeebot plugin repository at (default: working directory)',
})
.option('t', {
alias: 'no-typescript',
describe: 'Do not include typescript in the development environment',
type: 'boolean',
});
}, (v) => newRepository(v.name as string, v.path as string, v.t !== true));
y.command('build [path]', 'build a repository of plugins and generate the index file', (yi) => {
yi.positional('path', {
describe: 'The path of the repository',
})
.option('p', {
alias: 'no-output',
describe: 'Do not create an output directory, just build',
type: 'boolean',
})
.option('d', {
alias: 'deploy',
describe: 'Deploy the output directory as configured',
nargs: 1,
type: 'string',
})
.option('w', {
alias: 'watch',
describe: 'Watch files for changes',
type: 'boolean',
})
.option('o', {
alias: 'deploy-only',
describe: 'Deploy only, without rebuilding',
type: 'boolean',
});
.option('p', {
alias: 'no-output',
describe: 'Do not create an output directory, just build',
type: 'boolean',
})
.option('d', {
alias: 'deploy',
describe: 'Deploy the output directory as configured',
nargs: 1,
type: 'string',
})
.option('w', {
alias: 'watch',
describe: 'Watch files for changes',
type: 'boolean',
})
.option('o', {
alias: 'deploy-only',
describe: 'Deploy only, without rebuilding',
type: 'boolean',
});
}, (v) => {
const dargs = [
v.path,

View File

@ -47,22 +47,22 @@ yargs.scriptName('squeebotd')
demandOption: 'The environment file is mandatory.',
describe: 'The environment file to use, in json format',
})
.option('r', {
alias: 'root',
describe: 'Change the root directory of execution to differ from the one in your environment file',
nargs: 1,
type: 'string',
})
.option('e', {
alias: 'no-enable',
describe: 'Do not automatically execute enabled plugins on startup',
type: 'boolean',
})
.option('i', {
alias: 'interactive',
describe: 'Enable built-in command line interface',
type: 'boolean',
});
.option('r', {
alias: 'root',
describe: 'Change the root directory of execution to differ from the one in your environment file',
nargs: 1,
type: 'string',
})
.option('e', {
alias: 'no-enable',
describe: 'Do not automatically execute enabled plugins on startup',
type: 'boolean',
})
.option('i', {
alias: 'interactive',
describe: 'Enable built-in command line interface',
type: 'boolean',
});
});
start(yargs.argv).catch((e) => console.error(e.stack));

View File

@ -1,122 +0,0 @@
{
"extends": "tslint:recommended",
"rules": {
"align": {
"options": [
"parameters",
"statements"
]
},
"array-type": false,
"arrow-return-shorthand": true,
"curly": true,
"deprecation": {
"severity": "warning"
},
"eofline": true,
"import-spacing": true,
"indent": {
"options": [
"spaces"
]
},
"max-classes-per-file": false,
"max-line-length": [
true,
140
],
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-empty": false,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"no-switch-case-fall-through": true,
"no-var-requires": false,
"object-literal-key-quotes": [
true,
"as-needed"
],
"quotemark": [
true,
"single"
],
"semicolon": {
"options": [
"always"
]
},
"space-before-function-paren": {
"options": {
"anonymous": "never",
"asyncArrow": "always",
"constructor": "never",
"method": "never",
"named": "never"
}
},
"typedef": [
true,
"call-signature"
],
"forin": false,
"ban-types": {
"function": false
},
"typedef-whitespace": {
"options": [
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
},
{
"call-signature": "onespace",
"index-signature": "onespace",
"parameter": "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
]
},
"variable-name": {
"options": [
"ban-keywords",
"check-format",
"allow-pascal-case"
]
},
"whitespace": {
"options": [
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast"
]
}
}
}