Skip to content

Commit

Permalink
use path alias
Browse files Browse the repository at this point in the history
Former-commit-id: 4b06a78
  • Loading branch information
milesstoetzner authored Nov 12, 2022
1 parent a5b9972 commit 0f5716e
Show file tree
Hide file tree
Showing 44 changed files with 4,637 additions and 162 deletions.
3 changes: 3 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"require": ["ts-node/register", "tsconfig-paths/register"]
}
4 changes: 4 additions & 0 deletions docs/docs/assets/documents/licenses.csv
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ js-yaml,4.1.0,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.
json-parse-even-better-errors,2.3.1,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/npm/json-parse-even-better-errors
jsonfile,6.1.0,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/jprichardson/node-jsonfile
license-checker,25.0.1,BSD-3-Clause,Standalone,https://opensource.org/licenses/BSD-3-Clause,http://github.com/davglass/license-checker
lodash,4.17.21,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/lodash/lodash
loupe,2.3.4,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/chaijs/loupe
media-typer,0.3.0,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/jshttp/media-typer
merge-descriptors,1.0.1,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/component/merge-descriptors
Expand Down Expand Up @@ -122,6 +123,7 @@ readdir-scoped-modules,1.1.0,ISC,Standalone,https://opensource.org/licenses/ISC,
resolve,1.22.1,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/browserify/resolve
safe-buffer,5.2.1,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/feross/safe-buffer
safer-buffer,2.1.2,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/ChALkeR/safer-buffer
sax,1.2.4,ISC,Standalone,https://opensource.org/licenses/ISC,https://github.com/isaacs/sax-js
semver,5.7.1,ISC,Standalone,https://opensource.org/licenses/ISC,https://github.com/npm/node-semver
send,0.18.0,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/pillarjs/send
serve-static,1.15.0,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/expressjs/serve-static
Expand Down Expand Up @@ -150,4 +152,6 @@ uuid,8.3.2,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com
validate-npm-package-license,3.0.4,Apache-2.0,Standalone,https://www.apache.org/licenses/LICENSE-2.0,https://github.com/kemitchell/validate-npm-package-license.js
vary,1.1.2,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/jshttp/vary
wrappy,1.0.2,ISC,Standalone,https://opensource.org/licenses/ISC,https://github.com/npm/wrappy
xml2js,0.4.23,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/Leonidas-from-XIV/node-xml2js
xmlbuilder,11.0.1,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/oozcitak/xmlbuilder-js
yauzl,2.10.0,MIT,Standalone,https://opensource.org/licenses/MIT,https://github.com/thejoshwolfe/yauzl
146 changes: 75 additions & 71 deletions docs/docs/dependencies.md

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,35 +54,37 @@
"prettier": "^2.7.1",
"semver": "^7.3.7",
"ts-node": "^10.8.2",
"tsc-alias": "^1.7.1",
"tsconfig-paths": "^4.1.0",
"typescript": "^4.7.4"
},
"scripts": {
"git:fix": "git add . && git commit -m fix && git push",
"git:improve-docs": "git add . && git commit -m \"improve docs\" && git push",
"git:open": "open-cli https://github.com/opentosca/opentosca-vintner",
"build": "tsc --build",
"build": "tsc --build && tsc-alias -p tsconfig.json",
"package": "pkg --config .pkgrc.json build/cli/index.js",
"deploy": "cp ./dist/vintner-linux-x64 /usr/bin/vintner",
"lint:check": "eslint .",
"lint:fix": "eslint . --fix",
"style:check": "prettier --check --end-of-line auto \"./**/*.{ts,json,yaml,yml}\"",
"style:fix": "prettier --write --end-of-line auto \"./**/*.{ts,json,yaml,yml}\"",
"vintner": "node build/cli/index",
"cli": "yarn ts-node src/cli/index",
"cli": "yarn ts-node -r tsconfig-paths/register src/cli/index",
"test": "yarn test:local",
"test:local": "nyc mocha --require ts-node/register \"tests/**/*.ts\"",
"test:local": "nyc mocha \"tests/**/*.ts\"",
"test:docker": "docker build .",
"benchmark": "yarn cli setup benchmark --latex",
"server:start": "node -r dotenv/config -r ts-node/register src/cli/index.ts server start",
"server:serve": "nodemon -r dotenv/config --ext \"ts,json\" src/cli/index.ts server start",
"server:start": "node -r dotenv/config -r ts-node/register -r tsconfig-paths/register src/cli/index.ts server start",
"server:serve": "nodemon -r dotenv/config -r tsconfig-paths/register --ext \"ts,json\" src/cli/index.ts server start",
"docs:install": "cd docs && pip install -r requirements.txt",
"docs:serve": "cd docs && MKDOCS_IS_DEV=true mkdocs serve --watch-theme",
"docs:open": "open-cli http://localhost:8000",
"docs:build": "cd docs && mkdocs build",
"docs:clean": "cd docs && rm -rf site",
"docs:deploy": "cd docs && mkdocs gh-deploy --force",
"docs:generate:interface": "yarn build && yarn ts-node docs/cmds/interface/generate.ts",
"docs:generate:licenses": "yarn ts-node docs/cmds/licenses/generate.ts",
"docs:generate:interface": "yarn build && yarn ts-node -r tsconfig-paths/register docs/cmds/interface/generate",
"docs:generate:licenses": "yarn ts-node -r tsconfig-paths/register docs/cmds/licenses/generate",
"docs:record:home": "cd docs/cmds/casts && ./record.sh home",
"docs:record:getting-started": "cd docs/cmds/casts && ./record.sh getting-started",
"examples:opera": "./examples/opera-motivation/demo.sh",
Expand Down
9 changes: 4 additions & 5 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {Command, Option} from 'commander'
import hae from './hae'
import config from './config'
import Controller from '../controller'
import * as files from '../utils/files'
import {toBoolean} from '../utils/utils'
import benchmark, {benchmark2latex, benchmark2markdown} from '../controller/setup/benchmark'
import config from '#config'
import Controller from '#controller'
import * as files from '#files'
import benchmark, {benchmark2latex, benchmark2markdown} from '#controller/setup/benchmark'

const program = new Command()

Expand Down
2 changes: 1 addition & 1 deletion src/controller/instances/create.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Instance} from '../../repository/instances'
import {Instance} from '#repository/instances'

export type InstancesCreateArguments = {instance: string; template: string}

Expand Down
2 changes: 1 addition & 1 deletion src/controller/instances/delete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Instance} from '../../repository/instances'
import {Instance} from '#repository/instances'

export type InstancesDeleteArguments = {instance: string}

Expand Down
4 changes: 2 additions & 2 deletions src/controller/instances/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Instance} from '../../repository/instances'
import {Orchestrators} from '../../repository/orchestrators'
import {Instance} from '#repository/instances'
import {Orchestrators} from '#repository/orchestrators'

export type InstancesDeployArguments = {instance: string; inputs?: string}

Expand Down
2 changes: 1 addition & 1 deletion src/controller/instances/inspect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Instance} from '../../repository/instances'
import {Instance} from '#repository/instances'

export type InspectArguments = {instance: string}

Expand Down
2 changes: 1 addition & 1 deletion src/controller/instances/list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Instances} from '../../repository/instances'
import {Instances} from '#repository/instances'

export default async function () {
return Instances.all()
Expand Down
2 changes: 1 addition & 1 deletion src/controller/instances/open.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import open from 'open'
import {Instance} from '../../repository/instances'
import {Instance} from '#repository/instances'

export type InstancesOpenArguments = {instance: string}

Expand Down
4 changes: 2 additions & 2 deletions src/controller/instances/undeploy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Instance} from '../../repository/instances'
import {Orchestrators} from '../../repository/orchestrators'
import {Instance} from '#repository/instances'
import {Orchestrators} from '#repository/orchestrators'

export type InstancesUndeployArguments = {instance: string}

Expand Down
4 changes: 2 additions & 2 deletions src/controller/instances/update.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Instance} from '../../repository/instances'
import {Orchestrators} from '../../repository/orchestrators'
import {Instance} from '#repository/instances'
import {Orchestrators} from '#repository/orchestrators'

export type InstancesUpdateArguments = {instance: string; inputs?: string}

Expand Down
2 changes: 1 addition & 1 deletion src/controller/orchestrators/enable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Orchestrators} from '../../repository/orchestrators'
import {Orchestrators} from '#repository/orchestrators'

export type OrchestratorsEnableArguments = {orchestrator: string}

Expand Down
4 changes: 2 additions & 2 deletions src/controller/orchestrators/init-opera-wsl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Orchestrators} from '../../repository/orchestrators'
import {OperaWLSConfig} from '../../orchestrators/opera'
import {Orchestrators} from '#repository/orchestrators'
import {OperaWLSConfig} from '#orchestrators/opera'

export default async function (option: OperaWLSConfig) {
const data = Orchestrators.getConfig()
Expand Down
4 changes: 2 additions & 2 deletions src/controller/orchestrators/init-opera.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Orchestrators} from '../../repository/orchestrators'
import {OperaNativeConfig} from '../../orchestrators/opera'
import {Orchestrators} from '#repository/orchestrators'
import {OperaNativeConfig} from '#orchestrators/opera'

export default async function (option: OperaNativeConfig) {
const data = Orchestrators.getConfig()
Expand Down
4 changes: 2 additions & 2 deletions src/controller/orchestrators/init-unfurl-wsl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Orchestrators} from '../../repository/orchestrators'
import {UnfurlWSLConfig} from '../../orchestrators/unfurl'
import {Orchestrators} from '#repository/orchestrators'
import {UnfurlWSLConfig} from '#orchestrators/unfurl'

export default async function (option: UnfurlWSLConfig) {
const data = Orchestrators.getConfig()
Expand Down
4 changes: 2 additions & 2 deletions src/controller/orchestrators/init-unfurl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Orchestrators} from '../../repository/orchestrators'
import {UnfurlNativeConfig} from '../../orchestrators/unfurl'
import {Orchestrators} from '#repository/orchestrators'
import {UnfurlNativeConfig} from '#orchestrators/unfurl'

export default async function (option: UnfurlNativeConfig) {
const data = Orchestrators.getConfig()
Expand Down
2 changes: 1 addition & 1 deletion src/controller/server/start.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import server from '../../server'
import server from '#/server'

export type ServerStartOptions = {
port: number
Expand Down
6 changes: 3 additions & 3 deletions src/controller/setup/benchmark.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ServiceTemplate, TOSCA_DEFINITIONS_VERSION} from '../../specification/service-template'
import {countLines, getSize, loadYAML, storeYAML, temporaryFile} from '../../utils/files'
import {getMedianFromSorted, hrtime2ms, prettyBytes, prettyMilliseconds, prettyNumber} from '../../utils/utils'
import {ServiceTemplate, TOSCA_DEFINITIONS_VERSION} from '#spec/service-template'
import {countLines, getSize, loadYAML, storeYAML, temporaryFile} from '#files'
import {getMedianFromSorted, hrtime2ms, prettyBytes, prettyMilliseconds, prettyNumber} from '#utils'
import {VariabilityResolver} from '../template/resolve'

type BenchmarkArguments = {
Expand Down
4 changes: 2 additions & 2 deletions src/controller/setup/clean.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as files from '../../utils/files'
import config from '../../cli/config'
import * as files from '#files'
import config from '#config'

export default async function () {
files.removeDirectory(config.home)
Expand Down
10 changes: 5 additions & 5 deletions src/controller/setup/init.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as files from '../../utils/files'
import config from '../../cli/config'
import {Templates} from '../../repository/templates'
import {Instances} from '../../repository/instances'
import {Orchestrators} from '../../repository/orchestrators'
import * as files from '#files'
import config from '#config'
import {Templates} from '#repository/templates'
import {Instances} from '#repository/instances'
import {Orchestrators} from '#repository/orchestrators'

export default async function () {
files.createDirectory(config.home)
Expand Down
2 changes: 1 addition & 1 deletion src/controller/setup/open-home.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import open from 'open'
import config from '../../cli/config'
import config from '#config'

export default async function () {
await open(config.home)
Expand Down
20 changes: 10 additions & 10 deletions src/controller/template/resolve.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {ServiceTemplate, TOSCA_DEFINITIONS_VERSION} from '../../specification/service-template'
import {InputAssignmentMap} from '../../specification/topology-template'
import {Instance} from '../../repository/instances'
import * as files from '../../utils/files'
import {InputAssignmentPreset, VariabilityExpression} from '../../specification/variability'
import * as utils from '../../utils/utils'
import * as validator from '../../utils/validator'
import {GroupMember, TOSCA_GROUP_TYPES} from '../../specification/group-type'
import {listIsEmpty, prettyJSON} from '../../utils/utils'
import * as featureIDE from '../../utils/feature-ide'
import {ServiceTemplate, TOSCA_DEFINITIONS_VERSION} from '#spec/service-template'
import {InputAssignmentMap} from '#spec/topology-template'
import {Instance} from '#repository/instances'
import * as files from '#files'
import {InputAssignmentPreset, VariabilityExpression} from '#spec/variability'
import * as utils from '#utils'
import * as validator from '#validator'
import {GroupMember, TOSCA_GROUP_TYPES} from '#spec/group-type'
import {listIsEmpty, prettyJSON} from '#utils'
import * as featureIDE from '#utils/feature-ide'

export type TemplateResolveArguments = {
instance?: string
Expand Down
2 changes: 1 addition & 1 deletion src/controller/templates/delete.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Template} from '../../repository/templates'
import {Template} from '#repository/templates'

export type TemplatesDeleteArguments = {template: string}

Expand Down
2 changes: 1 addition & 1 deletion src/controller/templates/import.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Template} from '../../repository/templates'
import {Template} from '#repository/templates'

export type TemplatesCreateArguments = {template: string; path: string}

Expand Down
2 changes: 1 addition & 1 deletion src/controller/templates/inspect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Template} from '../../repository/templates'
import {Template} from '#repository/templates'

export type TemplatesInspectArguments = {template: string}

Expand Down
2 changes: 1 addition & 1 deletion src/controller/templates/list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Templates} from '../../repository/templates'
import {Templates} from '#repository/templates'

export default async function () {
return Templates.all()
Expand Down
2 changes: 1 addition & 1 deletion src/controller/templates/open.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Template} from '../../repository/templates'
import {Template} from '#repository/templates'
import open from 'open'

export type TemplatesOpenArguments = {template: string}
Expand Down
8 changes: 4 additions & 4 deletions src/orchestrators/opera.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Instance} from '../repository/instances'
import {Orchestrator} from '../repository/orchestrators'
import {joinNotNull} from '../utils/utils'
import {Shell} from '../utils/shell'
import {Instance} from '#repository/instances'
import {Orchestrator} from '#repository/orchestrators'
import {joinNotNull} from '#utils'
import {Shell} from '#shell'

export type OperaConfig = (OperaNativeConfig & {wsl: false}) | (OperaWLSConfig & {wsl: true})

Expand Down
10 changes: 5 additions & 5 deletions src/orchestrators/unfurl.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Instance} from '../repository/instances'
import {Orchestrator} from '../repository/orchestrators'
import * as files from '../utils/files'
import {Instance} from '#repository/instances'
import {Orchestrator} from '#repository/orchestrators'
import * as files from '#files'
import path from 'path'
import {joinNotNull} from '../utils/utils'
import {Shell} from '../utils/shell'
import {joinNotNull} from '#utils'
import {Shell} from '#shell'

export type UnfurlConfig = (UnfurlNativeConfig & {wsl: false}) | (UnfurlWSLConfig & {wsl: true})

Expand Down
6 changes: 3 additions & 3 deletions src/repository/instances.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path'
import config from '../cli/config'
import * as files from '../utils/files'
import {ServiceTemplate} from '../specification/service-template'
import config from '#config'
import * as files from '#files'
import {ServiceTemplate} from '#spec/service-template'
import {Template} from './templates'

export class Instances {
Expand Down
10 changes: 5 additions & 5 deletions src/repository/orchestrators.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as files from '../utils/files'
import * as files from '#files'
import path from 'path'
import config from '../cli/config'
import {Opera, OperaNativeConfig, OperaWLSConfig} from '../orchestrators/opera'
import {Unfurl, UnfurlNativeConfig, UnfurlWSLConfig} from '../orchestrators/unfurl'
import config from '#config'
import {Opera, OperaNativeConfig, OperaWLSConfig} from '#orchestrators/opera'
import {Unfurl, UnfurlNativeConfig, UnfurlWSLConfig} from '#orchestrators/unfurl'
import {Instance} from './instances'
import * as validator from '../utils/validator'
import * as validator from '#validator'

export interface Orchestrator {
deploy: (instance: Instance) => Promise<void>
Expand Down
6 changes: 3 additions & 3 deletions src/repository/templates.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as files from '../utils/files'
import * as files from '#files'
import path from 'path'
import config from '../cli/config'
import {ServiceTemplate} from '../specification/service-template'
import config from '#config'
import {ServiceTemplate} from '#spec/service-template'

export class Templates {
static all() {
Expand Down
2 changes: 1 addition & 1 deletion src/server/resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as express from 'express'
import hae from './hae'
import Controller from '../controller'
import Controller from '#controller'

const resolvers = express.Router()

Expand Down
2 changes: 1 addition & 1 deletion src/utils/feature-ide.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {InputAssignmentMap} from '../specification/topology-template'
import {InputAssignmentMap} from '#spec/topology-template'
import * as validator from './validator'
import * as files from './files'
import * as utils from './utils'
Expand Down
6 changes: 3 additions & 3 deletions tests/benchmark/test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {expect} from 'chai'
import benchmark, {generateBenchmarkServiceTemplate} from '../../src/controller/setup/benchmark'
import * as files from '../../src/utils/files'
import {ServiceTemplate} from '../../src/specification/service-template'
import benchmark, {generateBenchmarkServiceTemplate} from '#controller/setup/benchmark'
import * as files from '#files'
import {ServiceTemplate} from '#spec/service-template'
import * as path from 'path'
import {getDefaultTest} from '../utils'

Expand Down
4 changes: 2 additions & 2 deletions tests/expressions.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect} from 'chai'
import {VariabilityResolver} from '../src/controller/template/resolve'
import {VariabilityExpression} from '../src/specification/variability'
import {VariabilityResolver} from '#controller/template/resolve'
import {VariabilityExpression} from '#spec/variability'
import {getDefaultVariabilityResolver} from './utils'

it('and: empty -> true', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/feature-ide/test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path'
import {expect} from 'chai'
import * as featureIDE from '../../src/utils/feature-ide'
import * as files from '../../src/utils/files'
import * as featureIDE from '#utils/feature-ide'
import * as files from '#files'

it('feature-ide', async () => {
const result = await featureIDE.loadConfiguration(path.join(__dirname, 'inputs.xml'))
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {expect} from 'chai'
import {getMedianFromSorted, hrtime2ms, prettyBytes, prettyMilliseconds, prettyNumber, toList} from '../src/utils/utils'
import {getMedianFromSorted, hrtime2ms, prettyBytes, prettyMilliseconds, prettyNumber, toList} from '#utils'

it('median of array of even length', () => {
const median = getMedianFromSorted([1, 2])
Expand Down
Loading

0 comments on commit 0f5716e

Please sign in to comment.