diff --git a/.editorconfig b/.editorconfig index e89330a61..a64129e51 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,6 +5,8 @@ root = true charset = utf-8 indent_style = space indent_size = 2 +tab_width = 2 +max_line_length = 150 insert_final_newline = true trim_trailing_whitespace = true diff --git a/.eslintrc.json b/.eslintrc.json index 6454811c1..359933ab1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,71 +1,91 @@ { "root": true, "ignorePatterns": [ - "projects/**/*", - "electron/**/*" + "cli/gushio", + "cli/coverage/**/*", + "cli/dist/**/*", + "cli/tmp/**/*", + "core/coverage/**/*", + "core/dist/**/*", + "core/gushio", + "desktop-app/coverage/**/*", + "desktop-app/dist/**/*", + "desktop-app/electron/**/*", + "desktop-app/e2e/**/*", + "desktop-app/gushio", + "desktop-app/scripts/notarize.js", + "gushio/**/*" ], "overrides": [ { "files": [ "*.ts" ], - "parserOptions": { - "project": [ - "tsconfig.app.json", - "e2e/tsconfig.json" - ], - "createDefaultProgram": true - }, + "parser": "@typescript-eslint/parser", + "plugins": ["prettier"], "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", "plugin:@angular-eslint/ng-cli-compat", "plugin:@angular-eslint/ng-cli-compat--formatting-add-on", - "plugin:@angular-eslint/template/process-inline-templates" + "plugin:@angular-eslint/template/process-inline-templates", + "prettier" ], "rules": { - "@angular-eslint/component-selector": [ + "prettier/prettier": "error", + "brace-style": ["error", "1tbs"], + "id-blacklist": ["error"], + "no-underscore-dangle": "off", + "no-case-declarations": "off", + "no-dupe-else-if": "warn", + "no-unused-vars": [ "error", { - "type": "element", - "prefix": "app", - "style": "kebab-case" + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^_" } ], - "@angular-eslint/directive-selector": [ - "error", + "@typescript-eslint/explicit-module-boundary-types": [ + "warn", { - "type": "attribute", - "prefix": "app", - "style": "camelCase" + "allowArgumentsExplicitlyTypedAsAny": true } ], + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/prefer-for-of": "off", "@typescript-eslint/consistent-type-definitions": "error", "@typescript-eslint/dot-notation": "off", "@typescript-eslint/explicit-member-accessibility": [ - "off", + "warn", { - "accessibility": "explicit" + "accessibility": "explicit", + "overrides": { + "accessors": "off", + "constructors": "no-public", + "methods": "no-public", + "properties": "off", + "parameterProperties": "off" + } } ], "@typescript-eslint/no-use-before-define": "error", - "@typescript-eslint/prefer-for-of": "off", - "arrow-parens": [ - "off", - "always" - ], - "brace-style": [ + "@angular-eslint/component-selector": [ "error", - "1tbs" + { + "type": "element", + "prefix": "app", + "style": "kebab-case" + } ], - "id-blacklist": "error", - "import/order": "off", - "max-len": [ + "@angular-eslint/directive-selector": [ "error", { - "code": 1024 + "type": "attribute", + "prefix": "app", + "style": "camelCase" } - ], - "no-trailing-spaces": "off", - "no-underscore-dangle": "off" + ] } }, { diff --git a/.gitignore b/.gitignore index e8cbc92ed..6fd311728 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,30 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. # compiled output -/dist -/tmp -/out-tsc -/release +desktop-app/dist +desktop-app/tmp +desktop-app/out-tsc +desktop-app/release # Only exists if Bazel was run -/bazel-out +desktop-app/bazel-out +desktop-app/.angular # dependencies -/node_modules +**/node_modules # profiling files -chrome-profiler-events.json -speed-measure-plugin.json +**/chrome-profiler-events.json +**/speed-measure-plugin.json # IDEs and editors /.idea .project .classpath .c9/ -.cache/ -.python-version *.launch .settings/ *.sublime-workspace +release/ # IDE - VSCode .vscode/* @@ -35,26 +35,25 @@ speed-measure-plugin.json .history/* # misc -/.angular/cache -/.sass-cache -/connect.lock -/coverage -/libpeerconnection.log -npm-debug.log -yarn-error.log -testem.log -/typings +**/.sass-cache +**/connect.lock +**/coverage +**/libpeerconnection.log +**/npm-debug.log +**/yarn-error.log +**/testem.log +**/typings # System Files .DS_Store Thumbs.db # Windows certificate -windows.pfx +desktop-app/windows.pfx -package-lock.json +**/package-lock.json -/electron/dist +desktop-app/electron/dist start.sh buildAll.sh @@ -62,3 +61,19 @@ buildAll.sh #Mkdocs site/ temp/ + +core/package-lock.json +core/node_modules +core/dist + +cli/*-debug.log +cli/*-error.log +cli/.nyc_output +cli/dist +cli/lib +cli/package-lock.json +cli/tmp +cli/yarn.lock +cli/node_modules +cli/oclif.manifest.json +/release/ diff --git a/.husky/commit-msg b/.husky/commit-msg index 617efbdae..7cd8dd9a4 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npx --no-install commitlint --edit +npx --no-install commitlint --edit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..36af21989 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged diff --git a/.nvmrc b/.nvmrc index d5d3b29a4..832d38506 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.14.1 +16.14.0 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..c48887db6 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "arrow-parens": ["error", "always"], + "trailing-spaces": "off" +} diff --git a/.python-version b/.python-version new file mode 100644 index 000000000..7b59a5caa --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.10.2 diff --git a/.run/Buil Core.run.xml b/.run/Buil Core.run.xml new file mode 100644 index 000000000..f84d0cb35 --- /dev/null +++ b/.run/Buil Core.run.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + + + diff --git a/desktop-app/src/main.ts b/desktop-app/src/main.ts new file mode 100644 index 000000000..44942bc4c --- /dev/null +++ b/desktop-app/src/main.ts @@ -0,0 +1,12 @@ +import { enableProdMode } from "@angular/core"; +import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; +import "reflect-metadata"; + +import { AppModule } from "./app/app.module"; +import { environment } from "./environments/environment"; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule); // .catch(err => console.error(err)); diff --git a/src/polyfills.ts b/desktop-app/src/polyfills.ts similarity index 80% rename from src/polyfills.ts rename to desktop-app/src/polyfills.ts index 070ef7ab7..e2de0f2d8 100644 --- a/src/polyfills.ts +++ b/desktop-app/src/polyfills.ts @@ -18,6 +18,16 @@ * BROWSER POLYFILLS */ +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + /** * By default, zone.js will patch all possible macroTask and DomEvents * user can disable parts of macroTask/DomEvents patch by setting following flags @@ -45,10 +55,9 @@ /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js'; // Included with Angular CLI. - +import "zone.js"; // Included with Angular CLI. /*************************************************************************************************** * APPLICATION IMPORTS */ -(window as any)['global'] = window; +(window as any)["global"] = window; diff --git a/src/styles.scss b/desktop-app/src/styles.scss similarity index 100% rename from src/styles.scss rename to desktop-app/src/styles.scss diff --git a/desktop-app/src/test.ts b/desktop-app/src/test.ts new file mode 100644 index 000000000..b186f7483 --- /dev/null +++ b/desktop-app/src/test.ts @@ -0,0 +1,15 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files +import "zone.js/testing"; +import { getTestBed } from "@angular/core/testing"; +import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from "@angular/platform-browser-dynamic/testing"; + +declare const require: any; + +// Initialize the Angular testing environment +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); + +// Find all the tests +const context = require.context("./", true, /\.spec\.ts$/); + +// Load the modules +context.keys().map(context); diff --git a/tsconfig.app.json b/desktop-app/tsconfig.json similarity index 69% rename from tsconfig.app.json rename to desktop-app/tsconfig.json index d3d272644..a4139e97a 100644 --- a/tsconfig.app.json +++ b/desktop-app/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "../tsconfig.json", "compileOnSave": false, "angularCompilerOptions": { "fullTemplateTypeCheck": true, @@ -9,16 +10,16 @@ "baseUrl": "./", "declaration": false, "experimentalDecorators": true, - "lib": ["ES2021", "DOM"], - "module": "esnext", - "moduleResolution": "node", + "lib": ["ES2019", "DOM"], + "module": "ES2020", + "moduleResolution": "Node", "sourceMap": true, - "target": "ES6", + "target": "ES2019", "typeRoots": ["../node_modules/@types"], "paths": { - "stream": ["node_modules/stream-browserify"], - "assert": ["node_modules/assert"], - "fs": ["node_modules/fs-web"], + "stream": ["../node_modules/stream-browserify"], + "assert": ["../node_modules/assert"], + "fs": ["../node_modules/fs-web"] }, "esModuleInterop": true, "resolveJsonModule": true, @@ -28,6 +29,7 @@ "src/**/*.ts" ], "exclude": [ + "./gushio/**", "src/test.ts", "src/**/*.spec.ts", "src/base-injectables.ts", diff --git a/tsconfig.spec.json b/desktop-app/tsconfig.spec.json similarity index 100% rename from tsconfig.spec.json rename to desktop-app/tsconfig.spec.json diff --git a/windows_sign_certificate.pfx b/desktop-app/windows_sign_certificate.pfx similarity index 100% rename from windows_sign_certificate.pfx rename to desktop-app/windows_sign_certificate.pfx diff --git a/docs/cli/index.md b/docs/cli/index.md new file mode 100644 index 000000000..1bb7debbb --- /dev/null +++ b/docs/cli/index.md @@ -0,0 +1,33 @@ +Leapp's Command Line Interface. + +!!! warning + + Leapp CLI will works only if the Desktop App is installed and running. + Check the [installation guide](../installation/install-leapp/){: target='_blank'} to install the Desktop App. + + + +```console +$ npm install -g @noovolari/leapp-cli +$ leapp COMMAND +running command... +$ leapp (--version) +@noovolari/leapp-cli/0.1.2 darwin-x64 node-v16.14.0 +$ leapp --help [COMMAND] +USAGE + $ leapp COMMAND +... +``` + + + +## Command Topics + +* [`leapp help`](scopes/help.md) - Display help for leapp. +* [`leapp idp-url`](scopes/idp-url.md) - SAML 2.0 Identity providers URL management +* [`leapp integration`](scopes/integration.md) - Leapp Integrations management +* [`leapp profile`](scopes/profile.md) - Leapp AWS Multi-profile management +* [`leapp region`](scopes/region.md) - Leapp regions management +* [`leapp session`](scopes/session.md) - Sessions management + + diff --git a/docs/cli/scopes/help.md b/docs/cli/scopes/help.md new file mode 100644 index 000000000..13730a578 --- /dev/null +++ b/docs/cli/scopes/help.md @@ -0,0 +1,26 @@ +`leapp help` +============ + +Display help for leapp. + +* [`leapp help [COMMAND]`](#leapp-help-command) + +## `leapp help [COMMAND]` + +Display help for leapp. + +```console +USAGE + $ leapp help [COMMAND] [-n] + +ARGUMENTS + COMMAND Command to show help for. + +FLAGS + -n, --nested-commands Include all nested commands in the output. + +DESCRIPTION + Display help for leapp. +``` + +_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.12/src/commands/help.ts)_ diff --git a/docs/cli/scopes/idp-url.md b/docs/cli/scopes/idp-url.md new file mode 100644 index 000000000..9ea738ce3 --- /dev/null +++ b/docs/cli/scopes/idp-url.md @@ -0,0 +1,81 @@ +`leapp idp-url` +=============== + +SAML 2.0 Identity providers URL management + +* [`leapp idp-url create`](#leapp-idp-url-create) +* [`leapp idp-url delete`](#leapp-idp-url-delete) +* [`leapp idp-url edit`](#leapp-idp-url-edit) +* [`leapp idp-url list`](#leapp-idp-url-list) + +## `leapp idp-url create` + +Create a new identity provider URL + +```console +USAGE + $ leapp idp-url create + +DESCRIPTION + Create a new identity provider URL + +EXAMPLES + $leapp idp-url create +``` + +## `leapp idp-url delete` + +Delete an identity provider URL + +```console +USAGE + $ leapp idp-url delete + +DESCRIPTION + Delete an identity provider URL + +EXAMPLES + $leapp idp-url delete +``` + +## `leapp idp-url edit` + +Edit an identity provider URL + +```console +USAGE + $ leapp idp-url edit + +DESCRIPTION + Edit an identity provider URL + +EXAMPLES + $leapp idp-url edit +``` + +## `leapp idp-url list` + +Show identity providers list + +```console +USAGE + $ leapp idp-url list [--columns | -x] [--sort ] [--filter ] [--output csv|json|yaml | | + [--csv | --no-truncate]] [--no-header | ] + +FLAGS + -x, --extended show extra columns + --columns= only show provided columns (comma-separated) + --csv output is csv format [alias: --output=csv] + --filter= filter property by partial string matching, ex: name=foo + --no-header hide table header from output + --no-truncate do not truncate output to fit screen + --output=