Skip to content

Commit

Permalink
fix(js-toolkit-core): remove experimental support for building fdsCel…
Browse files Browse the repository at this point in the history
…lRenderer and themeSpritemap
  • Loading branch information
bryceosterhaus committed Oct 2, 2023
1 parent 83fb717 commit eaedc33
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 146 deletions.
4 changes: 0 additions & 4 deletions projects/js-toolkit/packages/js-toolkit-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ export {default as Project} from './project/liferayCli/Project';
export {
Bundler2BuildOptions,
CustomElementBuildOptions,
FDSCellRendererBuildOptions,
MinifiableBuildOptions,
ThemeSpritemapBuildOptions,
WebpackBuildOptions,
} from './project/liferayCli/Build';

Expand Down Expand Up @@ -73,8 +71,6 @@ export type {
AnyTypedBuildConfig,
Bundler2BuildConfig,
CustomElementBuildConfig,
FDSCellRendererBuildConfig,
ThemeSpritemapBuildConfig,
TypedBuildConfig,
} from './schema/LiferayJson';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,13 @@ import FilePath from '../../file/FilePath';
import LiferayJson, {
Bundler2BuildConfig,
CustomElementBuildConfig,
FDSCellRendererBuildConfig,
ThemeSpritemapBuildConfig,
} from '../../schema/LiferayJson';
import Project from './Project';
import persist, {Location} from './persist';

type BuildType =
| 'bundler2'
| 'customElement'
| 'fdsCellRenderer'
| 'themeSpritemap';
type BuildType = 'bundler2' | 'customElement';

type BuildOptions =
| Bundler2BuildOptions
| CustomElementBuildOptions
| FDSCellRendererBuildOptions
| ThemeSpritemapBuildOptions;
type BuildOptions = Bundler2BuildOptions | CustomElementBuildOptions;

export type Bundler2BuildOptions = MinifiableBuildOptions;

Expand All @@ -34,13 +24,6 @@ export interface CustomElementBuildOptions extends WebpackBuildOptions {
portletCategoryName: string;
}

export type FDSCellRendererBuildOptions = WebpackBuildOptions;

export interface ThemeSpritemapBuildOptions {
enableSVG4Everybody: boolean;
extendClay: boolean;
}

export interface MinifiableBuildOptions {
minify: boolean;
}
Expand Down Expand Up @@ -69,22 +52,6 @@ export default class Build {
);
break;

case 'fdsCellRenderer':
this.type = 'fdsCellRenderer';
this.dir = project.dir.join('build');
this.options = this._toFDSCellRendererBuildOptions(
liferayJson.build?.options
);
break;

case 'themeSpritemap':
this.type = 'themeSpritemap';
this.dir = project.dir.join('build');
this.options = this._toThemeSpriteMapBuildOptions(
liferayJson.build?.options
);
break;

case 'bundler2': {
const {
default: bundler2Project,
Expand Down Expand Up @@ -179,26 +146,6 @@ export default class Build {
};
}

private _toFDSCellRendererBuildOptions(
config: FDSCellRendererBuildConfig
): FDSCellRendererBuildOptions {
const webpackOptions = this._toWebpackBuildOptions(config);

return {
externals: webpackOptions.externals,
minify: webpackOptions.minify,
};
}

private _toThemeSpriteMapBuildOptions(
config: ThemeSpritemapBuildConfig
): ThemeSpritemapBuildOptions {
return {
enableSVG4Everybody: !!config.enableSVG4Everybody,
extendClay: !!config.extendClay,
};
}

private _toBundler2BuildOptions(
_config: Bundler2BuildConfig
): Bundler2BuildOptions {
Expand All @@ -208,7 +155,7 @@ export default class Build {
}

private _toWebpackBuildOptions(
config: CustomElementBuildConfig | FDSCellRendererBuildConfig
config: CustomElementBuildConfig
): WebpackBuildOptions {
const options: WebpackBuildOptions = {
externals: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export default class Dist {
}

case 'customElement':
case 'fdsCellRenderer':
case 'themeSpritemap':
this.dir = project.dir.join('dist');
this.file = this.dir.join(`${project.dir.basename()}.zip`);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/

export type ClientExtensionConfigJsonType =
| 'customElement'
| 'fdsCellRenderer'
| 'themeSpritemap';
export type ClientExtensionConfigJsonType = 'customElement';

export default interface ClientExtensionConfigJson {
[configurationPid: string]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
import type {
Bundler2BuildConfig,
CustomElementBuildConfig,
ThemeSpritemapBuildConfig,
} from './LiferayJson';

export default interface ClientExtensionYaml
extends Bundler2BuildConfig,
CustomElementBuildConfig,
ThemeSpritemapBuildConfig {
CustomElementBuildConfig {
baseURL: string;
description: string;
name: string;
sourceCodeURL: string;
type: 'bundler2' | 'customElement' | 'themeSpritemap';
type: 'bundler2' | 'customElement';
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export default interface LiferayJson {

export type AnyTypedBuildConfig =
| TypedBundler2BuildConfig
| TypedCustomElementBuildConfig
| TypedFDSCellRendererBuildConfig
| TypedThemeSpritemapBuildConfig;
| TypedCustomElementBuildConfig;

export interface TypedBuildConfig {
options: unknown;
Expand All @@ -41,22 +39,3 @@ export interface CustomElementBuildConfig {
htmlElementName?: string;
portletCategoryName?: string;
}

interface TypedFDSCellRendererBuildConfig extends TypedBuildConfig {
options: FDSCellRendererBuildConfig;
type: 'fdsCellRenderer';
}

export interface FDSCellRendererBuildConfig {
externals?: {[bareIdentifier: string]: string} | string[];
}

interface TypedThemeSpritemapBuildConfig extends TypedBuildConfig {
options: ThemeSpritemapBuildConfig;
type: 'themeSpritemap';
}

export interface ThemeSpritemapBuildConfig {
enableSVG4Everybody?: boolean;
extendClay?: boolean;
}
6 changes: 0 additions & 6 deletions projects/js-toolkit/scripts/qa/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const {
generateCreateReactApp,
generatePortlet,
generateRemoteApp,
generateThemeSpritemapClientExtension,
generateVueCli,
logStep,
spawn,
Expand Down Expand Up @@ -125,11 +124,6 @@ async function main() {
generateAngularCli('angular-cli-portlet');
generateCreateReactApp('create-react-app-portlet');
generateVueCli('vue-cli-portlet');
generateThemeSpritemapClientExtension('theme-spritemap-cet');
generateThemeSpritemapClientExtension(
'theme-spritemap-cet-extend-clay',
true
);
}

if (argv['build']) {
Expand Down
48 changes: 0 additions & 48 deletions projects/js-toolkit/scripts/qa/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,53 +101,6 @@ function generateRemoteApp(projectDirName, platform) {
writeLiferayJsonFile(projectDirName);
}

function generateThemeSpritemapClientExtension(
projectDirName,
extendClay = false
) {
logStep(`GENERATE: ${projectDirName}`);

zapProjectDir(projectDirName);

fs.mkdirSync(path.join(testDir, projectDirName));

fs.mkdirSync(path.join(testDir, projectDirName, 'src'));

fs.writeFileSync(
path.join(testDir, projectDirName, 'src', 'cog.svg'),
'<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path class="lexicon-icon-outline" d="M451.1,280.9c2.3-15.5-0.5-39.3-1.9-50.1l48.5-32.2c13.4-9.3,17.6-27.1,9.9-41.4l-35.7-63c-7.9-14.7-25.7-20.8-41-14.2l-51.2,23.5c-12.9-10.4-34.3-21.9-49.9-28l-6.7-47.9C320.9,11.8,307.3,0,291.3,0l-70,0c-16.1,0-29.6,11.9-31.8,27.7l-6.5,46.9c-18.5,7.7-36.9,19.1-50.3,29.1L82.7,79.5c-14.7-5.8-30.4-4.5-38.4,9.2l-39.8,61c-7.9,13.4-4.9,30.5,7,40.6l50.3,40.2c-1.6,11.7-3,35.2-0.6,50.9l-47.4,32.6c-13.5,9.5-17.6,27.7-9.5,42l38.9,64.5c8.2,14.3,26,20.1,41.1,13.4l48.4-25.7c13.2,10.2,34.5,23.2,50.2,29.3l5.7,46.2c1.9,16.1,15.5,28.2,31.8,28.3l72.1,0.2c16.3,0,30-12.1,31.9-28.2l5.3-46.9c18.7-7.5,37.2-17.4,50.4-27.8l52.7,21.7c15.4,7.2,33.8,1.2,41.9-13.7l33.6-60.1c7.6-14.1,3.7-31.6-9.3-41L451.1,280.9z M256.4,343.4c-103.7,0-110.4-160,0-160C365.1,183.4,360.1,343.4,256.4,343.4z M504.1,318.2 M83.7,75.1" /></svg>'
);

fs.writeFileSync(
path.join(testDir, projectDirName, 'package.json'),
JSON.stringify({
dependencies: {
'@liferay/dxp-7.4': '*',
},
description: 'Sample Theme Spritemap',
name: projectDirName,
scripts: {
build: 'liferay build',
clean: 'liferay clean',
deploy: 'liferay deploy',
},
version: '1.0.0',
})
);

fs.writeFileSync(
path.join(testDir, projectDirName, 'liferay.json'),
JSON.stringify({
build: {
options: {
extendClay,
},
type: 'themeSpritemap',
},
})
);
}

function generateVueCli(projectDirName) {
logStep(`GENERATE: ${projectDirName}`);

Expand Down Expand Up @@ -291,7 +244,6 @@ module.exports = {
generateCreateReactApp,
generatePortlet,
generateRemoteApp,
generateThemeSpritemapClientExtension,
generateVueCli,
logStep,
spawn,
Expand Down

0 comments on commit eaedc33

Please sign in to comment.