@ui5/cli 3.0.0-alpha.9 → 3.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.reuse/dep5 +1 -1
- package/CHANGELOG.md +82 -1
- package/CONTRIBUTING.md +1 -1
- package/README.md +4 -4
- package/bin/ui5.cjs +104 -0
- package/jsdoc.json +4 -2
- package/lib/cli/base.js +78 -0
- package/lib/cli/cli.js +74 -0
- package/lib/cli/commands/add.js +5 -3
- package/lib/cli/commands/build.js +6 -8
- package/lib/cli/commands/init.js +11 -11
- package/lib/cli/commands/remove.js +7 -3
- package/lib/cli/commands/serve.js +15 -14
- package/lib/cli/commands/tree.js +12 -11
- package/lib/cli/commands/use.js +6 -3
- package/lib/cli/commands/versions.js +20 -17
- package/lib/cli/middlewares/base.js +4 -4
- package/lib/cli/middlewares/logger.js +5 -6
- package/lib/cli/version.js +7 -9
- package/lib/framework/add.js +7 -6
- package/lib/framework/remove.js +9 -7
- package/lib/framework/updateYaml.js +9 -11
- package/lib/framework/use.js +7 -6
- package/lib/framework/utils.js +27 -29
- package/lib/init/init.js +11 -10
- package/lib/utils/fsHelper.js +4 -12
- package/npm-shrinkwrap.json +4204 -3693
- package/package.json +40 -30
- package/bin/ui5.js +0 -98
- package/index.js +0 -7
- package/lib/cli/commands/base.js +0 -76
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/cli",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"description": "UI5 Tooling - CLI",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -17,11 +17,16 @@
|
|
|
17
17
|
"tool"
|
|
18
18
|
],
|
|
19
19
|
"bin": {
|
|
20
|
-
"ui5": "./bin/ui5.
|
|
20
|
+
"ui5": "./bin/ui5.cjs"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
"./bin/ui5.js": "./bin/ui5.cjs",
|
|
25
|
+
"./bin/ui5.cjs": "./bin/ui5.cjs",
|
|
26
|
+
"./package.json": "./package.json"
|
|
21
27
|
},
|
|
22
|
-
"main": "index.js",
|
|
23
28
|
"engines": {
|
|
24
|
-
"node": "
|
|
29
|
+
"node": "^16.18.0 || >=18.0.0",
|
|
25
30
|
"npm": ">= 8"
|
|
26
31
|
},
|
|
27
32
|
"scripts": {
|
|
@@ -30,11 +35,11 @@
|
|
|
30
35
|
"lint": "eslint ./",
|
|
31
36
|
"unit": "rimraf test/tmp && ava",
|
|
32
37
|
"unit-verbose": "rimraf test/tmp && cross-env UI5_LOG_LVL=verbose ava --verbose --serial",
|
|
33
|
-
"unit-watch": "
|
|
34
|
-
"unit-nyan": "
|
|
35
|
-
"unit-xunit": "rimraf test/tmp && ava --tap | tap-xunit --dontUseCommentsAsTestNames=true > test-results.xml",
|
|
38
|
+
"unit-watch": "npm run unit -- --watch",
|
|
39
|
+
"unit-nyan": "npm run unit -- --tap | tnyan",
|
|
40
|
+
"unit-xunit": "rimraf test/tmp && ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\" --tap | tap-xunit --dontUseCommentsAsTestNames=true > test-results.xml",
|
|
36
41
|
"unit-inspect": "cross-env UI5_LOG_LVL=verbose ava debug --break",
|
|
37
|
-
"coverage": "nyc
|
|
42
|
+
"coverage": "rimraf test/tmp && nyc ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\"",
|
|
38
43
|
"coverage-xunit": "nyc --reporter=text --reporter=text-summary --reporter=cobertura npm run unit-xunit",
|
|
39
44
|
"jsdoc": "npm run jsdoc-generate && open-cli jsdocs/index.html",
|
|
40
45
|
"jsdoc-generate": "jsdoc -c ./jsdoc.json -t $(node -p 'path.dirname(require.resolve(\"docdash\"))') ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
|
|
@@ -43,12 +48,11 @@
|
|
|
43
48
|
"version": "git-chglog --sort semver --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
|
|
44
49
|
"prepublishOnly": "git push --follow-tags",
|
|
45
50
|
"release-note": "git-chglog --sort semver -c .chglog/release-config.yml v$npm_package_version | node .chglog/consolidate-changelogs.js",
|
|
46
|
-
"depcheck": "depcheck --ignores docdash,@ui5/fs,@ui5/builder"
|
|
51
|
+
"depcheck": "depcheck --ignores @ui5/cli,docdash,@istanbuljs/esm-loader-hook,@ui5/fs,@ui5/builder"
|
|
47
52
|
},
|
|
48
53
|
"files": [
|
|
49
54
|
"CHANGELOG.md",
|
|
50
55
|
"CONTRIBUTING.md",
|
|
51
|
-
"index.js",
|
|
52
56
|
"jsdoc.json",
|
|
53
57
|
"npm-shrinkwrap.json",
|
|
54
58
|
"bin/**",
|
|
@@ -60,6 +64,10 @@
|
|
|
60
64
|
"files": [
|
|
61
65
|
"test/bin/**/*.js",
|
|
62
66
|
"test/lib/**/*.js"
|
|
67
|
+
],
|
|
68
|
+
"nodeArguments": [
|
|
69
|
+
"--loader=esmock",
|
|
70
|
+
"--no-warnings"
|
|
63
71
|
]
|
|
64
72
|
},
|
|
65
73
|
"nyc": {
|
|
@@ -74,8 +82,8 @@
|
|
|
74
82
|
"jsdocs/**",
|
|
75
83
|
"coverage/**",
|
|
76
84
|
"test/**",
|
|
77
|
-
".eslintrc.
|
|
78
|
-
"jsdoc-plugin.
|
|
85
|
+
".eslintrc.cjs",
|
|
86
|
+
"jsdoc-plugin.cjs"
|
|
79
87
|
],
|
|
80
88
|
"check-coverage": true,
|
|
81
89
|
"statements": 80,
|
|
@@ -108,37 +116,39 @@
|
|
|
108
116
|
"url": "git@github.com:SAP/ui5-cli.git"
|
|
109
117
|
},
|
|
110
118
|
"dependencies": {
|
|
111
|
-
"@ui5/builder": "^3.0.0-
|
|
112
|
-
"@ui5/fs": "^3.0.0-
|
|
113
|
-
"@ui5/logger": "^3.0.1-
|
|
114
|
-
"@ui5/project": "^3.0.0-
|
|
115
|
-
"@ui5/server": "^3.0.0-
|
|
116
|
-
"chalk": "^
|
|
119
|
+
"@ui5/builder": "^3.0.0-beta.2",
|
|
120
|
+
"@ui5/fs": "^3.0.0-beta.3",
|
|
121
|
+
"@ui5/logger": "^3.0.1-beta.1",
|
|
122
|
+
"@ui5/project": "^3.0.0-beta.3",
|
|
123
|
+
"@ui5/server": "^3.0.0-beta.2",
|
|
124
|
+
"chalk": "^5.1.2",
|
|
117
125
|
"data-with-position": "^0.5.0",
|
|
118
126
|
"import-local": "^3.1.0",
|
|
119
127
|
"js-yaml": "^4.1.0",
|
|
120
|
-
"open": "^
|
|
128
|
+
"open": "^8.4.0",
|
|
121
129
|
"pretty-hrtime": "^1.0.3",
|
|
122
|
-
"semver": "^7.3.
|
|
123
|
-
"update-notifier": "^
|
|
124
|
-
"yargs": "^
|
|
130
|
+
"semver": "^7.3.8",
|
|
131
|
+
"update-notifier": "^6.0.2",
|
|
132
|
+
"yargs": "^17.6.2"
|
|
125
133
|
},
|
|
126
134
|
"devDependencies": {
|
|
127
|
-
"
|
|
135
|
+
"@istanbuljs/esm-loader-hook": "^0.2.0",
|
|
136
|
+
"ava": "^5.1.0",
|
|
128
137
|
"chokidar-cli": "^3.0.0",
|
|
129
138
|
"cross-env": "^7.0.3",
|
|
130
139
|
"depcheck": "^1.4.3",
|
|
131
|
-
"docdash": "^
|
|
132
|
-
"eslint": "^8.
|
|
140
|
+
"docdash": "^2.0.0",
|
|
141
|
+
"eslint": "^8.28.0",
|
|
133
142
|
"eslint-config-google": "^0.14.0",
|
|
134
|
-
"eslint-plugin-
|
|
143
|
+
"eslint-plugin-ava": "^13.2.0",
|
|
144
|
+
"eslint-plugin-jsdoc": "^39.6.4",
|
|
145
|
+
"esmock": "^2.0.9",
|
|
135
146
|
"execa": "^5.1.1",
|
|
136
|
-
"jsdoc": "^3.6.
|
|
137
|
-
"mock-require": "^3.0.3",
|
|
147
|
+
"jsdoc": "^3.6.11",
|
|
138
148
|
"nyc": "^15.1.0",
|
|
139
|
-
"open-cli": "^
|
|
149
|
+
"open-cli": "^7.1.0",
|
|
140
150
|
"rimraf": "^3.0.2",
|
|
141
|
-
"sinon": "^
|
|
151
|
+
"sinon": "^14.0.2",
|
|
142
152
|
"tap-nyan": "^1.1.0",
|
|
143
153
|
"tap-xunit": "^2.4.1"
|
|
144
154
|
}
|
package/bin/ui5.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// The following block should be compatible to as many Node.js versions as possible
|
|
4
|
-
/* eslint-disable no-var */
|
|
5
|
-
var pkg = require("../package.json");
|
|
6
|
-
var semver;
|
|
7
|
-
try {
|
|
8
|
-
semver = require("semver");
|
|
9
|
-
} catch (err) {
|
|
10
|
-
// SyntaxError indicates an outdated Node.js version
|
|
11
|
-
if (err.name !== "SyntaxError") {
|
|
12
|
-
throw err;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
var nodeVersion = process.version;
|
|
16
|
-
/* eslint-enable no-var */
|
|
17
|
-
if (
|
|
18
|
-
pkg.engines && pkg.engines.node &&
|
|
19
|
-
(!semver || !semver.satisfies(nodeVersion, pkg.engines.node, {includePrerelease: true}))
|
|
20
|
-
) {
|
|
21
|
-
console.log("==================== UNSUPPORTED NODE.JS VERSION ====================");
|
|
22
|
-
console.log("You are using an unsupported version of Node.js");
|
|
23
|
-
console.log("Detected version " + nodeVersion + " but " + pkg.name + " requires " + pkg.engines.node);
|
|
24
|
-
console.log("");
|
|
25
|
-
console.log("=> Please upgrade to a supported version of Node.js to use this tool");
|
|
26
|
-
console.log("=====================================================================");
|
|
27
|
-
process.exit(1);
|
|
28
|
-
} else {
|
|
29
|
-
if (semver && semver.prerelease(nodeVersion)) {
|
|
30
|
-
console.log("====================== UNSTABLE NODE.JS VERSION =====================");
|
|
31
|
-
console.log("You are using an unstable version of Node.js");
|
|
32
|
-
console.log("Detected Node.js version " + nodeVersion);
|
|
33
|
-
console.log("");
|
|
34
|
-
console.log("=> Please note that an unstable version might cause unexpected");
|
|
35
|
-
console.log(" behavior. For productive use please consider using a stable");
|
|
36
|
-
console.log(" version of Node.js! For the release policy of Node.js, see");
|
|
37
|
-
console.log(" https://nodejs.org/en/about/releases");
|
|
38
|
-
console.log("=====================================================================");
|
|
39
|
-
}
|
|
40
|
-
// Timeout is required to log info when importing from local installation
|
|
41
|
-
setTimeout(() => {
|
|
42
|
-
if (!process.env.UI5_CLI_NO_LOCAL) {
|
|
43
|
-
const importLocal = require("import-local");
|
|
44
|
-
// Prefer a local installation of @ui5/cli.
|
|
45
|
-
// This will invoke the local CLI, so no further action required
|
|
46
|
-
if (importLocal(__filename)) {
|
|
47
|
-
if (process.argv.includes("--verbose")) {
|
|
48
|
-
console.info(`INFO: This project contains an individual ${pkg.name} installation which ` +
|
|
49
|
-
"will be used over the global one.");
|
|
50
|
-
console.info("See https://github.com/SAP/ui5-cli#local-vs-global-installation for details.");
|
|
51
|
-
console.info("");
|
|
52
|
-
} else {
|
|
53
|
-
console.info(`INFO: Using local ${pkg.name} installation`);
|
|
54
|
-
console.info("");
|
|
55
|
-
}
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const updateNotifier = require("update-notifier");
|
|
61
|
-
updateNotifier({
|
|
62
|
-
pkg,
|
|
63
|
-
updateCheckInterval: 1000 * 60 * 60 * 24, // 1 day
|
|
64
|
-
shouldNotifyInNpmScript: true
|
|
65
|
-
}).notify();
|
|
66
|
-
// Remove --no-update-notifier from argv as it's not known to yargs, but we still want to support using it
|
|
67
|
-
const NO_UPDATE_NOTIFIER = "--no-update-notifier";
|
|
68
|
-
if (process.argv.includes(NO_UPDATE_NOTIFIER)) {
|
|
69
|
-
process.argv = process.argv.filter((v) => v !== NO_UPDATE_NOTIFIER);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const cli = require("yargs");
|
|
73
|
-
|
|
74
|
-
cli.parserConfiguration({
|
|
75
|
-
"parse-numbers": false
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Explicitly set CLI version as the yargs default might
|
|
79
|
-
// be wrong in case a local CLI installation is used
|
|
80
|
-
// Also add CLI location
|
|
81
|
-
const version = `${pkg.version} (from ${__filename})`;
|
|
82
|
-
require("../lib/cli/version").set(version);
|
|
83
|
-
cli.version(version);
|
|
84
|
-
|
|
85
|
-
// Explicitly set script name to prevent windows from displaying "ui5.js"
|
|
86
|
-
cli.scriptName("ui5");
|
|
87
|
-
|
|
88
|
-
// CLI modules
|
|
89
|
-
cli.commandDir("../lib/cli/commands");
|
|
90
|
-
|
|
91
|
-
// Format terminal output to full available width
|
|
92
|
-
cli.wrap(cli.terminalWidth());
|
|
93
|
-
|
|
94
|
-
// yargs registers a get method on the argv property.
|
|
95
|
-
// The property needs to be accessed to initialize everything.
|
|
96
|
-
cli.argv;
|
|
97
|
-
}, 0);
|
|
98
|
-
}
|
package/index.js
DELETED
package/lib/cli/commands/base.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
const cli = require("yargs");
|
|
2
|
-
|
|
3
|
-
cli.usage("Usage: ui5 <command> [options]")
|
|
4
|
-
.demandCommand(1, "Command required! Please have a look at the help documentation above.")
|
|
5
|
-
.option("config", {
|
|
6
|
-
describe: "Path to project configuration file in YAML format",
|
|
7
|
-
type: "string"
|
|
8
|
-
})
|
|
9
|
-
.option("dependency-definition", {
|
|
10
|
-
describe: "Path to a YAML file containing the project's dependency tree. " +
|
|
11
|
-
"This option will disable resolution of node package dependencies.",
|
|
12
|
-
type: "string"
|
|
13
|
-
})
|
|
14
|
-
.option("verbose", {
|
|
15
|
-
describe: "Enable verbose logging.",
|
|
16
|
-
type: "boolean"
|
|
17
|
-
})
|
|
18
|
-
.option("loglevel", {
|
|
19
|
-
alias: "log-level",
|
|
20
|
-
describe: "Set the logging level (error|warn|info|verbose|silly).",
|
|
21
|
-
default: "info",
|
|
22
|
-
type: "string"
|
|
23
|
-
})
|
|
24
|
-
.option("x-perf", {
|
|
25
|
-
describe: "Outputs performance measurements",
|
|
26
|
-
default: false,
|
|
27
|
-
type: "boolean"
|
|
28
|
-
})
|
|
29
|
-
.showHelpOnFail(true)
|
|
30
|
-
.strict(true)
|
|
31
|
-
.alias("help", "h")
|
|
32
|
-
.alias("version", "v")
|
|
33
|
-
.example("ui5 <command> --translator static:/path/to/projectDependencies.yaml",
|
|
34
|
-
"Execute command using a \"static\" translator with translator parameters")
|
|
35
|
-
.example("ui5 <command> --config /path/to/ui5.yaml",
|
|
36
|
-
"Execute command using a project configuration from custom path")
|
|
37
|
-
.fail(function(msg, err, yargs) {
|
|
38
|
-
const chalk = require("chalk");
|
|
39
|
-
if (err) {
|
|
40
|
-
// Exception
|
|
41
|
-
const logger = require("@ui5/logger");
|
|
42
|
-
if (logger.isLevelEnabled("error")) {
|
|
43
|
-
console.log("");
|
|
44
|
-
console.log(chalk.bold.red("⚠️ Process Failed With Error"));
|
|
45
|
-
|
|
46
|
-
console.log("");
|
|
47
|
-
console.log(chalk.underline("Error Message:"));
|
|
48
|
-
console.log(err.message);
|
|
49
|
-
|
|
50
|
-
// Unexpected errors should always be logged with stack trace
|
|
51
|
-
const unexpectedErrors = ["SyntaxError", "ReferenceError", "TypeError"];
|
|
52
|
-
if (unexpectedErrors.includes(err.name) || logger.isLevelEnabled("verbose")) {
|
|
53
|
-
console.log("");
|
|
54
|
-
console.log(chalk.underline("Stack Trace:"));
|
|
55
|
-
console.log(err.stack);
|
|
56
|
-
console.log("");
|
|
57
|
-
console.log(
|
|
58
|
-
chalk.dim(
|
|
59
|
-
`If you think this is an issue of the UI5 Tooling, you might report it using the ` +
|
|
60
|
-
`following URL: `) +
|
|
61
|
-
chalk.dim.bold.underline(`https://github.com/SAP/ui5-tooling/issues/new/choose`));
|
|
62
|
-
} else {
|
|
63
|
-
console.log("");
|
|
64
|
-
console.log(chalk.dim(
|
|
65
|
-
`For details, execute the same command again with an additional '--verbose' parameter`));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
// Yargs error
|
|
70
|
-
console.log(chalk.bold.yellow("Command Failed:"));
|
|
71
|
-
console.log(`${msg}`);
|
|
72
|
-
console.log("");
|
|
73
|
-
console.log(chalk.dim(`See 'ui5 --help' or 'ui5 build --help' for help`));
|
|
74
|
-
}
|
|
75
|
-
process.exit(1);
|
|
76
|
-
});
|