Comparing version 3.0.0-rc.4 to 3.0.0-rc.5
@@ -5,4 +5,19 @@ # Changelog | ||
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-cli/compare/v3.0.0-rc.4...HEAD). | ||
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-cli/compare/v3.0.0-rc.5...HEAD). | ||
<a name="v3.0.0-rc.5"></a> | ||
## [v3.0.0-rc.5] - 2023-02-06 | ||
### Bug Fixes | ||
- Streamline log-level flags, allow overwrite with env variable [`af9614b`](https://github.com/SAP/ui5-cli/commit/af9614bde7712d71c6f69342af81e98e28e14258) | ||
- **updateYaml:** Array update preserves indentation of following node [`b966d6c`](https://github.com/SAP/ui5-cli/commit/b966d6cbb040df2a1ce32710d979c38539da36cb) | ||
### Dependency Updates | ||
- Bump [@ui5](https://github.com/ui5)/server from 3.0.0-rc.2 to 3.0.0-rc.3 [`0e94001`](https://github.com/SAP/ui5-cli/commit/0e94001b332c693d71d878adb10416b818b10d4c) | ||
- Bump [@ui5](https://github.com/ui5)/builder from 3.0.0-rc.4 to 3.0.0-rc.5 [`adcbdd0`](https://github.com/SAP/ui5-cli/commit/adcbdd0d822ea15ec69d3b54ba1f00b7e1a87d73) | ||
- Bump [@ui5](https://github.com/ui5)/fs from 3.0.0-rc.5 to 3.0.0-rc.6 [`cfe8912`](https://github.com/SAP/ui5-cli/commit/cfe8912334e0dc34dde25e77f986c5128b232d8c) | ||
- Bump [@ui5](https://github.com/ui5)/builder from 3.0.0-rc.3 to 3.0.0-rc.4 [`fcee27c`](https://github.com/SAP/ui5-cli/commit/fcee27c3254eec5463fcf9e1e6ee6dfa1df61712) | ||
- Bump [@ui5](https://github.com/ui5)/fs from 3.0.0-rc.4 to 3.0.0-rc.5 [`ba7452a`](https://github.com/SAP/ui5-cli/commit/ba7452a98557db24f813428ed4088c5fd3b55196) | ||
- Bump [@ui5](https://github.com/ui5)/logger from 3.0.1-rc.2 to 3.0.1-rc.3 [`5d02da0`](https://github.com/SAP/ui5-cli/commit/5d02da0ec5647cb29a0399a0f64cf70025e93e8b) | ||
<a name="v3.0.0-rc.4"></a> | ||
@@ -938,2 +953,3 @@ ## [v3.0.0-rc.4] - 2023-01-25 | ||
[v3.0.0-rc.5]: https://github.com/SAP/ui5-cli/compare/v3.0.0-rc.4...v3.0.0-rc.5 | ||
[v3.0.0-rc.4]: https://github.com/SAP/ui5-cli/compare/v3.0.0-rc.3...v3.0.0-rc.4 | ||
@@ -940,0 +956,0 @@ [v3.0.0-rc.3]: https://github.com/SAP/ui5-cli/compare/v3.0.0-rc.2...v3.0.0-rc.3 |
import chalk from "chalk"; | ||
import {isLogLevelEnabled} from "@ui5/logger"; | ||
import ConsoleWriter from "@ui5/logger/writers/Console"; | ||
@@ -8,2 +9,3 @@ export default function(cli) { | ||
.option("config", { | ||
alias: "c", | ||
describe: "Path to project configuration file in YAML format", | ||
@@ -17,17 +19,61 @@ type: "string" | ||
}) | ||
.option("verbose", { | ||
describe: "Enable verbose logging.", | ||
type: "boolean" | ||
.option("workspace-config", { | ||
describe: "Path to workspace configuration file in YAML format", | ||
type: "string" | ||
}) | ||
.option("workspace", { | ||
alias: "w", | ||
describe: "Name of the workspace configuration to use", | ||
default: "default", | ||
type: "string" | ||
}) | ||
.option("loglevel", { | ||
alias: "log-level", | ||
describe: "Set the logging level (error|warn|info|verbose|silly).", | ||
describe: "Set the logging level (silent|error|warn|info|perf|verbose|silly).", | ||
default: "info", | ||
type: "string" | ||
type: "string", | ||
choices: ["silent", "error", "warn", "info", "perf", "verbose", "silly"] | ||
}) | ||
.option("x-perf", { | ||
describe: "Outputs performance measurements", | ||
.option("verbose", { | ||
describe: "Enable verbose logging.", | ||
default: false, | ||
type: "boolean" | ||
}) | ||
.option("perf", { | ||
describe: "Enable performance measurements and related logging.", | ||
default: false, | ||
type: "boolean" | ||
}) | ||
.option("silent", { | ||
describe: "Disable all log output.", | ||
default: false, | ||
type: "boolean" | ||
}) | ||
.coerce([ | ||
// base.js | ||
"config", "dependency-definition", "workspace-config", "workspace", "log-level", | ||
// tree.js, build.js & serve.js | ||
"framework-version", | ||
// build.js | ||
"dest", | ||
// serve.js | ||
"open", "port", "key", "cert", | ||
], (arg) => { | ||
// If an option is specified multiple times, yargs creates an array for all the values, | ||
// independently of whether the option is of type "array" or "string". | ||
// This is unexpected for options listed above, which should all only have only one definitive value. | ||
// The yargs behavior could be disabled by using the parserConfiguration "duplicate-arguments-array": true | ||
// However, yargs would then cease to create arrays for those options where we *do* expect the | ||
// automatic creation of arrays in case the option is specified multiple times. Like "--include-task". | ||
// Also see https://github.com/yargs/yargs/issues/1318 | ||
// Note: This is not necessary for options of type "boolean" | ||
if (Array.isArray(arg)) { | ||
// If the option is specified multiple times, use the value of the last option | ||
return arg[arg.length - 1]; | ||
} | ||
return arg; | ||
}) | ||
.showHelpOnFail(true) | ||
@@ -37,8 +83,13 @@ .strict(true) | ||
.alias("version", "v") | ||
.example("ui5 <command> --translator static:/path/to/projectDependencies.yaml", | ||
"Execute command using a \"static\" translator with translator parameters") | ||
.example("ui5 <command> --dependency-definition /path/to/projectDependencies.yaml", | ||
"Execute command using a static dependency tree instead of resolving node package dependencies") | ||
.example("ui5 <command> --config /path/to/ui5.yaml", | ||
"Execute command using a project configuration from custom path") | ||
.example("ui5 <command> --workspace dolphin", | ||
"Execute command using the 'dolphin' workspace of a ui5-workspace.yaml") | ||
.example("ui5 <command> --log-level silly", | ||
"Execute command with the maximum log output") | ||
.fail(function(msg, err, yargs) { | ||
if (err) { | ||
ConsoleWriter.stop(); | ||
// Exception | ||
@@ -45,0 +96,0 @@ if (isLogLevelEnabled("error")) { |
@@ -39,3 +39,4 @@ import baseMiddleware from "../middlewares/base.js"; | ||
" overruled by dependencies defined in 'exclude-dependency'.", | ||
type: "array" | ||
type: "string", | ||
array: true | ||
}) | ||
@@ -45,3 +46,4 @@ .option("include-dependency-regexp", { | ||
" This list is prioritized like 'include-dependency'.", | ||
type: "array" | ||
type: "string", | ||
array: true | ||
}) | ||
@@ -52,3 +54,4 @@ .option("include-dependency-tree", { | ||
" the selection of 'exclude-dependency-tree' but can be overruled by 'exclude-dependency'.", | ||
type: "array" | ||
type: "string", | ||
array: true | ||
}) | ||
@@ -58,3 +61,4 @@ .option("exclude-dependency", { | ||
" be overruled by dependencies defined in 'include-dependency'.", | ||
type: "array" | ||
type: "string", | ||
array: true | ||
}) | ||
@@ -64,3 +68,4 @@ .option("exclude-dependency-regexp", { | ||
" This list is prioritized like 'exclude-dependency'.", | ||
type: "array" | ||
type: "string", | ||
array: true | ||
}) | ||
@@ -70,3 +75,4 @@ .option("exclude-dependency-tree", { | ||
" implicitly included and do not need to be part of this list.", | ||
type: "array" | ||
type: "string", | ||
array: true | ||
}) | ||
@@ -92,7 +98,9 @@ .option("dest", { | ||
"This option takes precedence over any excludes.", | ||
type: "array" | ||
type: "string", | ||
array: true | ||
}) | ||
.option("exclude-task", { | ||
describe: "A list of tasks to be excluded from the default task execution set", | ||
type: "array" | ||
type: "string", | ||
array: true | ||
}) | ||
@@ -136,3 +144,5 @@ .option("framework-version", { | ||
rootConfigPath: argv.config, | ||
versionOverride: argv.frameworkVersion | ||
versionOverride: argv.frameworkVersion, | ||
workspaceConfigPath: argv.workspaceConfig, | ||
workspaceName: argv.workspace === false ? null : argv.workspace, | ||
}); | ||
@@ -139,0 +149,0 @@ } |
@@ -91,3 +91,5 @@ import path from "node:path"; | ||
rootConfigPath: argv.config, | ||
versionOverride: argv.frameworkVersion | ||
versionOverride: argv.frameworkVersion, | ||
workspaceConfigPath: argv.workspaceConfig, | ||
workspaceName: argv.workspace === false ? null : argv.workspace, | ||
}); | ||
@@ -94,0 +96,0 @@ } |
@@ -25,3 +25,3 @@ // Tree | ||
let elapsedTime; | ||
if (argv.xPerf) { | ||
if (argv.perf) { | ||
startTime = process.hrtime(); | ||
@@ -39,7 +39,9 @@ } | ||
rootConfigPath: argv.config, | ||
versionOverride: argv.frameworkVersion | ||
versionOverride: argv.frameworkVersion, | ||
workspaceConfigPath: argv.workspaceConfig, | ||
workspaceName: argv.workspace === false ? null : argv.workspace, | ||
}); | ||
} | ||
if (argv.xPerf) { | ||
if (argv.perf) { | ||
elapsedTime = await getElapsedTime(startTime); | ||
@@ -60,5 +62,5 @@ } | ||
`${baseString}${connectorString} ${chalk.bold(project.getName())} ` + | ||
`${project.getNamespace ? chalk.inverse(project.getNamespace()) + " " : ""}` + | ||
`${project.getNamespace() ? chalk.inverse(project.getNamespace()) + " " : ""}` + | ||
chalk.dim(`(${project.getVersion()}, ${project.getType()}) `) + | ||
chalk.dim.italic(`${project.getPath()}`) | ||
chalk.dim.italic(`${project.getRootPath()}`) | ||
); | ||
@@ -94,3 +96,3 @@ | ||
chalk.dim(`(${extension.getVersion()}, ${extension.getType()}) `) + | ||
chalk.dim.italic(`${extension.getPath()}`)); | ||
chalk.dim.italic(`${extension.getRootPath()}`)); | ||
}); | ||
@@ -100,3 +102,3 @@ } else { | ||
} | ||
if (argv.xPerf) { | ||
if (argv.perf) { | ||
console.log(""); | ||
@@ -103,0 +105,0 @@ console.log(chalk.blue( |
@@ -1,2 +0,2 @@ | ||
import {setLogLevel, getLogger} from "@ui5/logger"; | ||
import {setLogLevel, isLogLevelEnabled, getLogger} from "@ui5/logger"; | ||
import ConsoleWriter from "@ui5/logger/writers/Console"; | ||
@@ -10,9 +10,21 @@ import {getVersion} from "../version.js"; | ||
export async function initLogger(argv) { | ||
ConsoleWriter.init(); | ||
if (argv.loglevel) { | ||
setLogLevel(argv.loglevel); | ||
if (argv.silent) { | ||
setLogLevel("silent"); | ||
} | ||
if (argv.perf) { | ||
setLogLevel("perf"); | ||
} | ||
if (argv.verbose) { | ||
setLogLevel("verbose"); | ||
} | ||
if (argv.loglevel && argv.loglevel !== "info") { | ||
// argv.loglevel defaults to "info", which is anyways already the Logger's default | ||
// Therefore do not explicitly set it again in order to allow overwriting the log level | ||
// using the UI5_LOG_LVL environment variable | ||
setLogLevel(argv.loglevel); | ||
} | ||
// Initialize writer | ||
ConsoleWriter.init(); | ||
if (isLogLevelEnabled("verbose")) { | ||
const log = getLogger("cli:middlewares:base"); | ||
@@ -19,0 +31,0 @@ log.verbose(`using @ui5/cli version ${getVersion()}`); |
@@ -36,3 +36,3 @@ import {getRootProjectConfiguration, getFrameworkResolver} from "./utils.js"; | ||
const resolver = new Resolver({ | ||
cwd: project.getPath(), | ||
cwd: project.getRootPath(), | ||
version: project.getFrameworkVersion() | ||
@@ -39,0 +39,0 @@ }); |
import path from "node:path"; | ||
import {readFile, writeFile} from "node:fs/promises"; | ||
import {loadAll, dump} from "js-yaml"; | ||
import {fromYaml, getPosition, getValue} from "data-with-position"; | ||
import {fromYaml, getPosition, getValue, getKind} from "data-with-position"; | ||
import {getLogger} from "@ui5/logger"; | ||
@@ -113,3 +113,19 @@ | ||
function getPositionFromPath(positionData, path) { | ||
return getPosition(getValueFromPath(positionData, path)); | ||
const data = getValueFromPath(positionData, path); | ||
const position = getPosition(data); | ||
const kind = getKind(data); | ||
if ((kind === "array" && data.length) || kind === "object") { | ||
// data-with-position treats arrays and objects different from primitives: | ||
// The end index of such nodes always reaches up to the beginning of the following node, instead of the end | ||
// of the contained data. | ||
// For example, if an array has entries, the end position of the array is *directly* at the beginning of | ||
// the next node instead of at the end of the last entry. | ||
// Typically this means one line and multiple columns *after* the array ended. | ||
// However, if an array has no entries (e.g. "[]"), the end is directly after the end of that data and | ||
// *not* in the next line (this appears to be an inconsistency). | ||
// Therefore, in case we encounter an array *with entries*, or an object, we reset the end column to "1" | ||
// to prevent replacing (i.e. removing) the indentation of the following node. | ||
position.end.column = 1; | ||
} | ||
return position; | ||
} | ||
@@ -150,6 +166,6 @@ | ||
} else { | ||
configPath = path.join(project.getPath(), configPathOverride); | ||
configPath = path.join(project.getRootPath(), configPathOverride); | ||
} | ||
} else { | ||
configPath = path.join(project.getPath(), "ui5.yaml"); | ||
configPath = path.join(project.getRootPath(), "ui5.yaml"); | ||
} | ||
@@ -156,0 +172,0 @@ |
@@ -45,3 +45,3 @@ import {getRootProjectConfiguration, getFrameworkResolver} from "./utils.js"; | ||
}, { | ||
cwd: project.getPath() | ||
cwd: project.getRootPath() | ||
}); | ||
@@ -48,0 +48,0 @@ } |
{ | ||
"name": "@ui5/cli", | ||
"version": "3.0.0-rc.4", | ||
"version": "3.0.0-rc.5", | ||
"description": "UI5 Tooling - CLI", | ||
@@ -29,3 +29,3 @@ "author": { | ||
"engines": { | ||
"node": "^16.18.0 || >=18.0.0", | ||
"node": "^16.18.0 || >=18.12.0", | ||
"npm": ">= 8" | ||
@@ -119,7 +119,7 @@ }, | ||
"dependencies": { | ||
"@ui5/builder": "^3.0.0-rc.3", | ||
"@ui5/fs": "^3.0.0-rc.4", | ||
"@ui5/logger": "^3.0.1-rc.2", | ||
"@ui5/builder": "^3.0.0-rc.5", | ||
"@ui5/fs": "^3.0.0-rc.6", | ||
"@ui5/logger": "^3.0.1-rc.3", | ||
"@ui5/project": "^3.0.0-rc.7", | ||
"@ui5/server": "^3.0.0-rc.2", | ||
"@ui5/server": "^3.0.0-rc.3", | ||
"chalk": "^5.2.0", | ||
@@ -142,6 +142,6 @@ "data-with-position": "^0.5.0", | ||
"docdash": "^2.0.1", | ||
"eslint": "^8.32.0", | ||
"eslint": "^8.33.0", | ||
"eslint-config-google": "^0.14.0", | ||
"eslint-plugin-ava": "^14.0.0", | ||
"eslint-plugin-jsdoc": "^39.6.8", | ||
"eslint-plugin-jsdoc": "^39.8.0", | ||
"esmock": "^2.1.0", | ||
@@ -148,0 +148,0 @@ "execa": "^6.1.0", |
Sorry, the diff of this file is too big to display
515671
11581
+ Added@adobe/css-tools@4.1.0(transitive)
+ Added@babel/parser@7.20.15(transitive)
+ Added@ui5/builder@3.0.0-rc.5(transitive)
+ Added@ui5/fs@3.0.0-rc.6(transitive)
+ Added@ui5/logger@3.0.1-rc.3(transitive)
+ Added@ui5/project@3.0.0-rc.8(transitive)
+ Added@ui5/server@3.0.0-rc.3(transitive)
+ Addedcacheable-request@10.2.6(transitive)
+ Addedcontent-type@1.0.5(transitive)
+ Addedfs-minipass@3.0.1(transitive)
+ Addedhttp-cache-semantics@4.1.1(transitive)
+ Addedmake-fetch-happen@11.0.3(transitive)
+ Addedminipass@4.0.1(transitive)
+ Addedterser@5.16.3(transitive)
+ Addedworkerpool@6.3.1(transitive)
- Removed@adobe/css-tools@4.0.2(transitive)
- Removed@babel/parser@7.20.13(transitive)
- Removed@ui5/builder@3.0.0-rc.3(transitive)
- Removed@ui5/fs@3.0.0-rc.4(transitive)
- Removed@ui5/logger@3.0.1-rc.2(transitive)
- Removed@ui5/project@3.0.0-rc.7(transitive)
- Removed@ui5/server@3.0.0-rc.2(transitive)
- Removedcacheable-request@10.2.5(transitive)
- Removedcontent-type@1.0.4(transitive)
- Removedfs-minipass@3.0.0(transitive)
- Removedhttp-cache-semantics@4.1.0(transitive)
- Removedmake-fetch-happen@11.0.2(transitive)
- Removedminipass@4.0.0(transitive)
- Removedterser@5.16.1(transitive)
Updated@ui5/builder@^3.0.0-rc.5
Updated@ui5/fs@^3.0.0-rc.6
Updated@ui5/logger@^3.0.1-rc.3
Updated@ui5/server@^3.0.0-rc.3