Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor shared logic for generating package.json scripts for FF and FE #2386

Merged
merged 23 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/eighty-ways-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@sap-ux/fiori-freestyle-writer': minor
'@sap-ux/fiori-generator-shared': minor
'@sap-ux/fiori-elements-writer': minor
---

Refactor shared logic for generating package.json scripts for FF and FE
5 changes: 2 additions & 3 deletions packages/fiori-elements-writer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { App, Package } from '@sap-ux/ui5-application-writer';
import { generate as generateUi5Project } from '@sap-ux/ui5-application-writer';
import { generate as addOdataService, OdataVersion, ServiceType } from '@sap-ux/odata-service-writer';
import { generateOPAFiles } from '@sap-ux/ui5-test-writer';
import { getPackageJsonTasks } from './packageConfig';
import cloneDeep from 'lodash/cloneDeep';
import type { FioriElementsApp } from './types';
import { TemplateType } from './types';
Expand All @@ -20,7 +19,7 @@ import {
import { extendManifestJson } from './data/manifestSettings';
import semVer from 'semver';
import { initI18n } from './i18n';
import { getBootstrapResourceUrls } from '@sap-ux/fiori-generator-shared';
import { getBootstrapResourceUrls, getPackageScripts } from '@sap-ux/fiori-generator-shared';
import { generateFpmConfig } from './fpmConfig';

export const V2_FE_TYPES_AVAILABLE = '1.108.0';
Expand Down Expand Up @@ -177,7 +176,7 @@ async function generate<T extends {}>(basePath: string, data: FioriElementsApp<T
if (isEdmxProjectType) {
// Add scripts to package.json only for non-CAP projects
packageJson.scripts = Object.assign(packageJson.scripts ?? {}, {
...getPackageJsonTasks({
...getPackageScripts({
localOnly: !feApp.service?.url,
addMock: !!feApp.service?.metadata,
addTest,
Expand Down
84 changes: 0 additions & 84 deletions packages/fiori-elements-writer/src/packageConfig.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/fiori-elements-writer/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,3 @@ export interface FioriElementsApp<T> extends Ui5App {

// We need this for the service version
export { OdataVersion } from '@sap-ux/odata-service-writer';

/**
Represents a set of scripts defined in a package.json file.
*/
export interface PackageJsonScripts {
start: string;
'start-local': string;
'start-noflp'?: string;
'start-mock'?: string;
'int-test'?: string;
'start-variants-management'?: string;
}
5 changes: 2 additions & 3 deletions packages/fiori-freestyle-writer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import { render } from 'ejs';
import type { Package } from '@sap-ux/ui5-application-writer';
import { generate as generateUi5Project } from '@sap-ux/ui5-application-writer';
import { generate as addOdataService } from '@sap-ux/odata-service-writer';
import { getPackageJsonTasks } from './packageConfig';
import cloneDeep from 'lodash/cloneDeep';
import type { BasicAppSettings } from './types';
import { FreestyleApp, TemplateType } from './types';
import { setDefaults, escapeFLPText } from './defaults';
import { UI5Config } from '@sap-ux/ui5-config';
import { initI18n } from './i18n';
import { getBootstrapResourceUrls } from '@sap-ux/fiori-generator-shared';
import { getBootstrapResourceUrls, getPackageScripts } from '@sap-ux/fiori-generator-shared';

/**
* Generate a UI5 application based on the specified Fiori Freestyle floorplan template.
Expand Down Expand Up @@ -98,7 +97,7 @@ async function generate<T>(basePath: string, data: FreestyleApp<T>, fs?: Editor)
// Add scripts for non-CAP applications
packageJson.scripts = {
...packageJson.scripts,
...getPackageJsonTasks({
...getPackageScripts({
localOnly: !!ffApp.service && !ffApp.service?.url,
addMock: !!ffApp.service?.metadata,
sapClient: ffApp.service?.client,
Expand Down
77 changes: 0 additions & 77 deletions packages/fiori-freestyle-writer/src/packageConfig.ts

This file was deleted.

11 changes: 0 additions & 11 deletions packages/fiori-freestyle-writer/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,3 @@ export interface FreestyleApp<T> extends Ui5App {

// We need this for the service version
export { OdataVersion } from '@sap-ux/odata-service-writer';

/**
Represents a set of scripts defined in a package.json file.
*/
export interface PackageJsonScripts {
start: string;
'start-local': string;
'start-noflp'?: string;
'start-mock'?: string;
'start-variants-management'?: string;
}
54 changes: 0 additions & 54 deletions packages/fiori-freestyle-writer/test/packageConfig.test.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/fiori-generator-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"@sap-ux/btp-utils": "workspace:*",
"@sap-ux/project-access": "workspace:*",
"i18next": "20.6.1",
"mem-fs": "2.1.0",
"mem-fs-editor": "9.4.0"
},
Expand Down
Loading
Loading