Skip to content

Commit

Permalink
[BREAKING] Task API arguments rename (#995)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
Task API `namespace` option got renamed to `projectNamespace`

JIRA: CPOUI5FOUNDATION-802
Relates to: SAP/ui5-tooling#701
  • Loading branch information
d3xter666 authored Feb 29, 2024
1 parent 4af782c commit d1f87e0
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 23 deletions.
3 changes: 1 addition & 2 deletions lib/tasks/bundlers/generateFlexChangesBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import semver from "semver";
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
*/
export default async function({workspace, taskUtil, options = {}}) {
// Backward compatibility: "namespace" option got renamed to "projectNamespace"
const namespace = options.projectNamespace || options.namespace;
const namespace = options.projectNamespace;

// Use the given namespace if available, otherwise use no namespace
// (e.g. in case no manifest.json is present)
Expand Down
3 changes: 1 addition & 2 deletions lib/tasks/bundlers/generateStandaloneAppBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ function getBundleDefinition(config) {
*/
export default async function({workspace, dependencies, taskUtil, options}) {
const {projectName} = options;
// Backward compatibility: "namespace" option got renamed to "projectNamespace"
const namespace = options.projectNamespace || options.namespace;
const namespace = options.projectNamespace;

if (!namespace) {
log.warn(`Namespace of project ${projectName} is not known. Self contained bundling is currently ` +
Expand Down
3 changes: 1 addition & 2 deletions lib/tasks/generateCachebusterInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ function getSigner(type) {
*/
export default function({workspace, options}) {
const {signatureType} = options;
// Backward compatibility: "namespace" option got renamed to "projectNamespace"
const namespace = options.projectNamespace || options.namespace;
const namespace = options.projectNamespace;

const basePath = `/resources/${namespace}/`;
return workspace.byGlob(`/resources/${namespace}/**/*`)
Expand Down
3 changes: 1 addition & 2 deletions lib/tasks/generateThemeDesignerResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ async function generateCssVariablesLess({workspace, combo, namespace}) {
*/
export default async function({workspace, dependencies, options}) {
const {projectName, version} = options;
// Backward compatibility: "namespace" option got renamed to "projectNamespace"
const namespace = options.projectNamespace || options.namespace;
const namespace = options.projectNamespace;

// Skip sap.ui.documentation since it is not intended to be available in SAP Theme Designer to create custom themes
if (namespace === "sap/ui/documentation") {
Expand Down
5 changes: 2 additions & 3 deletions lib/tasks/transformBootstrapHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import bootstrapHtmlTransformer from "../processors/bootstrapHtmlTransformer.js"
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
* @param {object} parameters.options Options
* @param {string} parameters.options.projectName Project name
* @param {string} [parameters.options.namespace] Project namespace
* @param {string} [parameters.options.projectNamespace] Project namespace
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
*/
export default async function({workspace, options}) {
const {projectName} = options;
// Backward compatibility: "namespace" option got renamed to "projectNamespace"
const namespace = options.projectNamespace || options.namespace;
const namespace = options.projectNamespace;

let indexPath;
if (namespace) {
Expand Down
8 changes: 4 additions & 4 deletions test/lib/tasks/bundlers/generateStandaloneAppBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test.serial("execute module bundler and write results", async (t) => {
dependencies: dummyReaderWriter,
options: {
projectName: "some.project.name",
namespace: "some/project/namespace"
projectNamespace: "some/project/namespace"
}
};
await generateStandaloneAppBundle(params);
Expand Down Expand Up @@ -150,7 +150,7 @@ test.serial("execute module bundler and write results in evo mode", async (t) =>
dependencies: dummyReaderWriter,
options: {
projectName: "some.project.name",
namespace: "some/project/namespace"
projectNamespace: "some/project/namespace"
}
};
await generateStandaloneAppBundle(params);
Expand Down Expand Up @@ -207,7 +207,7 @@ test.serial("execute module bundler with taskUtil", async (t) => {
taskUtil,
options: {
projectName: "some.project.name",
namespace: "some/project/namespace"
projectNamespace: "some/project/namespace"
}
};
await generateStandaloneAppBundle(params);
Expand Down Expand Up @@ -355,7 +355,7 @@ test.serial("Error: Failed to resolve non-debug name", async (t) => {
taskUtil,
options: {
projectName: "some.project.name",
namespace: "some/project/namespace"
projectNamespace: "some/project/namespace"
}
};

Expand Down
12 changes: 6 additions & 6 deletions test/lib/tasks/generateThemeDesignerResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test.serial("generateThemeDesignerResources: Library", async (t) => {
options: {
projectName: "sap.ui.demo.lib",
version: "1.2.3",
namespace: "sap/ui/demo/lib"
projectNamespace: "sap/ui/demo/lib"
}
});

Expand Down Expand Up @@ -203,7 +203,7 @@ test.serial("generateThemeDesignerResources: Library sap.ui.core", async (t) =>
options: {
projectName: "sap.ui.core",
version: "1.2.3",
namespace: "sap/ui/core"
projectNamespace: "sap/ui/core"
}
});

Expand Down Expand Up @@ -268,7 +268,7 @@ test.serial("generateThemeDesignerResources: Library sap.ui.documentation is ski
options: {
projectName: "sap.ui.documentation",
version: "1.2.3",
namespace: "sap/ui/documentation"
projectNamespace: "sap/ui/documentation"
}
});

Expand Down Expand Up @@ -296,7 +296,7 @@ test.serial("generateThemeDesignerResources: Library without themes", async (t)
options: {
projectName: "sap.ui.demo.lib",
version: "1.2.3",
namespace: "sap/ui/demo/lib"
projectNamespace: "sap/ui/demo/lib"
}
});

Expand Down Expand Up @@ -521,7 +521,7 @@ test.serial("generateThemeDesignerResources: Theme-Library with CSS Variables wi
options: {
projectName: "sap.ui.demo.lib",
version: "1.2.3",
namespace: "sap/ui/demo/lib"
projectNamespace: "sap/ui/demo/lib"
}
});

Expand Down Expand Up @@ -757,7 +757,7 @@ test.serial("generateThemeDesignerResources: .theming file missing in sap.ui.cor
options: {
projectName: "sap.ui.core",
version: "1.2.3",
namespace: "sap/ui/core"
projectNamespace: "sap/ui/core"
}
}), {
message: ".theming file for theme base missing in sap.ui.core library source"
Expand Down
4 changes: 2 additions & 2 deletions test/lib/tasks/transformBootstrapHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test.serial("Transforms index.html resource", async (t) => {
workspace,
options: {
projectName: "sap.ui.demo.app",
namespace: "sap/ui/demo/app"
projectNamespace: "sap/ui/demo/app"
}
});

Expand Down Expand Up @@ -126,7 +126,7 @@ test.serial("No index.html resource exists", async (t) => {
workspace,
options: {
projectName: "sap.ui.demo.app",
namespace: "sap/ui/demo/app"
projectNamespace: "sap/ui/demo/app"
}
});

Expand Down

0 comments on commit d1f87e0

Please sign in to comment.