Skip to content

Commit

Permalink
feat(workspace-builders): create a script to extract deprecated items
Browse files Browse the repository at this point in the history
feat: split workspace helpers and build helpers
  • Loading branch information
kpanot committed Oct 18, 2024
1 parent c0ac34d commit 13e3d42
Show file tree
Hide file tree
Showing 34 changed files with 496 additions and 108 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = {
],
'rules': {
'@o3r/json-dependency-versions-harmonize': ['error', {
ignoredPackages: ['@o3r/build-helpers'],
ignoredPackages: ['@o3r/build-helpers', '@o3r/workspace-helpers'],
alignPeerDependencies: false,
alignEngines: true
}],
Expand All @@ -81,7 +81,7 @@ module.exports = {
],
'rules': {
'@o3r/json-dependency-versions-harmonize': ['error', {
ignoredPackages: ['@o3r/build-helpers'],
ignoredPackages: ['@o3r/build-helpers', '@o3r/workspace-helpers'],
ignoredDependencies: ['npm'],
alignPeerDependencies: false,
alignEngines: true
Expand Down
2 changes: 1 addition & 1 deletion .github/.pr-labelrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../tools/@o3r/build-helpers/schemas/pr-labels.configuration.schema.json",
"$schema": "../tools/@o3r/workspace-helpers/schemas/pr-labels.configuration.schema.json",
"projectLabelPrefix": "project:",
"ignoredProjects": [],
"ignoreProjectForLabels": ["cascading"]
Expand Down
1 change: 1 addition & 0 deletions apps/showcase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"@angular/cli": "~18.2.0",
"@angular/compiler-cli": "~18.2.0",
"@nx/eslint-plugin": "~19.5.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/design": "workspace:^",
"@o3r/eslint-config-otter": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
Expand Down
15 changes: 6 additions & 9 deletions docs/components/PLACEHOLDERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ The component only has 1 input and supports a *content value*.

## Supported features

* HTML limited to behaviour supported by Angular sanitizer
* URLs (relative ones will be processed to add the `dynamic-media-path`)
* Facts references
* Dynamic translation
- HTML limited to behavior supported by Angular sanitizer
- URLs (relative ones will be processed to add the `dynamic-media-path`)
- Facts references
- Dynamic translation

## How it works

Based on the `id` provided to the placeholder component, it will register itself to the event coming from `placeholderTemplate`
and will display the template corresponding to its ID in the store.

> [!IMPORTANT]
>
> It is **strongly encouraged** to use the placeholder mechanism in concert with the [Rules Engine](../rules-engine/README.md).
## How to define a placeholder template
Expand Down Expand Up @@ -89,6 +88,7 @@ export class MyComponentModule {
export class MyComponent {
}
```

The loading message is provided by projection. Feel free to provide a spinner if you need.

### How to generate placeholder metadata
Expand Down Expand Up @@ -204,7 +204,7 @@ Then, let's create a new localization key for each of your supported languages:

```json
{
"o3r-increment-key": "Cela fait {increment, plural, =1 {1 seconde}} other {{{increment} secondes} que tu as ouvert cette page"
"o3r-increment-key": "Cela fait {increment, plural, =1 {1 seconde} other {{{increment}} secondes}} que tu as ouvert cette page"
}
```

Expand Down Expand Up @@ -298,7 +298,6 @@ Thanks to the parameters map you can use fact variables with JSONPath in localiz

#### Variable support for localization variables (DEPRECATED)


Before, localization variables could reference facts via variables instead of parameters. This feature is currently deprecated and will be removed from Otter v12 as it is replaced by the parameters explained above.

``en-GB.json``
Expand Down Expand Up @@ -408,7 +407,6 @@ displayed in descending order of priority.
The placeholder component waits for all the calls to be resolved (not pending) to display the content.
The placeholder component ignores a template if the application failed to retrieve it.


## Reference CSS classes from an external styling file

You need to reference one or several CSS files from your application in the `cms.json` file:
Expand Down Expand Up @@ -438,7 +436,6 @@ You can include this file in your application using the style loader service in
this.styleLoader.asyncLoadStyleFromDynamicContent({id: 'placeholders-styling', href: 'assets/rules/placeholders.css'});
```


## Investigate issues

If the placeholder is not rendered properly, you can perform several checks to find out the root cause, simply looking
Expand Down
93 changes: 89 additions & 4 deletions migration-guides/11.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

- `NodePackageNgAddTask` has been removed. `setupDependencies` should be used instead

- The [`stringifyDate` CLI option](https://www.npmjs.com/package/@ama-sdk/schematics#dates) is now enabled by default. If
- The [`stringifyDate` CLI option](https://www.npmjs.com/package/@ama-sdk/schematics#dates) is now enabled by default. If
you want to use the `Date` format, you will need to set it to `false` via the command line:

```shell
Expand All @@ -29,7 +29,7 @@ or by disabling it for your generator in your `openapitools.json` file:
{
"$schema": "https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/master/apps/generator-cli/src/config.schema.json",
"generator-cli": {
"version": "7.4.0", // Version of the Codegen downloaded by the cli - updated via the
"version": "7.4.0", // Version of the Codegen downloaded by the cli - updated via the
"storageDir": ".openapi-generator",
"generators": {
"my-generator": {
Expand All @@ -46,16 +46,101 @@ or by disabling it for your generator in your `openapitools.json` file:
```

- Prior to version 11, the default types for date and date-time objects were respectively `utils.Date` and `utils.DateTime`.
Those two types take the date from the API response and remove their timezone to consider the date as if it were in the
Those two types take the date from the API response and remove their timezone to consider the date as if it were in the
timezone of the user's machine (on a computer on UTC, the 01/01/2000 12:00 in UTC+3 would become 01/01/2000 12:00 UTC+0).
If a date had to be expressed in its original timezone, the date specification required an extra `x-date-timezone` vendor.
As of version 11, the default behavior is now to keep the timezone of the API response for date-time objects. They
would be revived as `Date` or kept as `string` depending on the value of the `stringifyDate` option.
The removal the timezone is now an 'opt-in' mechanism triggered by the `x-local-timezone` vendor.

> [!NOTE]
> This change only impacts `date-time` format. `Date` format will still be revived as `utils.Date` objects as the timezone
> This change only impacts `date-time` format. `Date` format will still be revived as `utils.Date` objects as the timezone
> should always be ignored for date object (since there is no concept of time).
> [!NOTE]
> You can revert to the previous behavior thanks to the global property `useLegacyDateExtension`
<!-- generated deprecated - start -->
## Deprecated this version

The following items are **deprecated** and **will be removed** in the version **12**:

### From [@o3r/components](https://npmjs.com/package/@o3r/components)

- `CapitalizePipe` is deprecated.</br>Note: *please use O3rCapitalizePipe*
- `CapitalizePipeModule` is deprecated.</br>Note: *please use O3rCapitalizePipe*
- `DurationPipe` is deprecated.</br>Note: *please use O3rDurationPipe*
- `DurationPipeModule` is deprecated.</br>Note: *please use O3rDurationPipe*
- `KeepWhiteSpacePipe` is deprecated.</br>Note: *please use O3rKeepWhiteSpacePipe*
- `KeepWhiteSpacePipeModule` is deprecated.</br>Note: *please use O3rKeepWhiteSpacePipe*
- `ReplaceWithBoldPipe` is deprecated.</br>Note: *please use O3rReplaceWithBoldPipe*
- `ReplaceWithBoldPipeModule` is deprecated.</br>Note: *please use O3rReplaceWithBoldPipe*

### From [@o3r/configuration](https://npmjs.com/package/@o3r/configuration)

- `computeConfigurationName` is deprecated.</br>Note: *use `computeItemIdentifier` from [@o3r/core](https://npmjs.com/package/@o3r/core).*
- `ConfigObserver` is deprecated.</br>Note: *please use O3rConfig*
- `configSignal` is deprecated.</br>Note: *please do not provide `configurationService`*
- `loadConfiguration` is deprecated.</br>Note: *please use `updateConfigurations` instead*

### From [@o3r/dev-tools](https://npmjs.com/package/@o3r/dev-tools)

- `checkoutBranch` is deprecated.
- `checkoutCrtRcBranch` is deprecated.
- `checkoutCurrentAlphaOrNextBranch` is deprecated.
- `commitChangeLogs` is deprecated.
- `createNextAlphaBranch` is deprecated.
- `createNextMajorBranch` is deprecated.
- `createRcBranch` is deprecated.
- `createReleaseBranch` is deprecated.
- `deleteBranch` is deprecated.
- `deleteCrtRcBranch` is deprecated.
- `deleteCurrentAlphaOrNextBranch` is deprecated.
- `deletePreviousReleaseBranch` is deprecated.
- `GavcResponse` is deprecated.
- `getCrtRcBranch` is deprecated.
- `getCurrentAlphaOrNextBranch` is deprecated.
- `getJestModuleNameMapper` is deprecated.</br>Note: *Please use `pathsToModuleNameMapper` from `ts-jest`*
- `getJestProjects` is deprecated.</br>Note: *Please use the one exposed in [@o3r/workspace](https://npmjs.com/package/@o3r/workspace)*
- `getPackageManager` is deprecated.
- `getPackagesToInstallOrUpdate` is deprecated.</br>Note: *You can use the one exposed in [@o3r/schematics](https://npmjs.com/package/@o3r/schematics)*
- `isPackageInstalled` is deprecated.</br>Note: *You can use the one exposed in [@o3r/schematics](https://npmjs.com/package/@o3r/schematics)*
- `PackageVersion` is deprecated.</br>Note: *You can use the one exposed in [@o3r/schematics](https://npmjs.com/package/@o3r/schematics)*
- `pad` is deprecated.</br>Note: *You can use the one exposed in [@ama-sdk/core](https://npmjs.com/package/@ama-sdk/core)*
- `PullRequestService` is deprecated.</br>Note: *Please use `PullRequestService` from [@o3r/azure-tools](https://npmjs.com/package/@o3r/azure-tools)*
- `updatePeerDependencies` is deprecated.
- `updateRenovateBaseBranch` is deprecated.

### From [@o3r/dynamic-content](https://npmjs.com/package/@o3r/dynamic-content)

- `DynamicContentPipe` is deprecated.</br>Note: *please use O3rDynamicContentPipe*

### From [@o3r/localization](https://npmjs.com/package/@o3r/localization)

- `LocalizationTranslatePipe` is deprecated.</br>Note: *please use O3rLocalizationTranslatePipe*

### From [@o3r/rules-engine](https://npmjs.com/package/@o3r/rules-engine)

- `ActionOverrideBlock` is deprecated.
- `ActionUpdateAssetBlock` is deprecated.</br>Note: *use the one exposed by [@o3r/dynamic-content](https://npmjs.com/package/@o3r/dynamic-content) module.*
- `ActionUpdateConfigBlock` is deprecated.</br>Note: *use the one exposed by [@o3r/configuration](https://npmjs.com/package/@o3r/configuration) module.*
- `ActionUpdateLocalisationBlock` is deprecated.</br>Note: *use the one exposed by [@o3r/localization](https://npmjs.com/package/@o3r/localization) module.*
- `ActionUpdatePlaceholderBlock` is deprecated.</br>Note: *use the one exposed by [@o3r/components](https://npmjs.com/package/@o3r/components) module.*
- `FallbackToPipe` is deprecated.</br>Note: *please use O3rFallbackToPipe*
- `inputFacts` is deprecated.</br>Note: *Facts that are needed for the rule execution (sent by the CMS)*
- `linkedComponent` is deprecated.</br>Note: *use `linkedComponents` instead*
- `linkedComponent` is deprecated.</br>Note: *use `linkedComponents` instead*
- `linkRulesetToComponent` is deprecated.</br>Note: *It will be replaced by the selector using it*
- `selectRuleSetLinkComponents` is deprecated.</br>Note: *use `selectComponentsLinkedToRuleset` instead.*

### From [@o3r/schematics](https://npmjs.com/package/@o3r/schematics)

- `isStandaloneRepository` is deprecated.</br>Note: *no longer in use.*
- `setupSchematicsDefaultParams` is deprecated.</br>Note: *Use `setupSchematicsParamsForProject`*

### From [@o3r/styling](https://npmjs.com/package/@o3r/styling)

- `deviceBreakpoints` is deprecated.</br>Note: *use Breakpoints exported by [@angular/cdk](https://npmjs.com/package/@angular/cdk) instead*
- `StyleLazyLoader` is deprecated.</br>Note: *use StyleLazyLoader exported by [@o3r/dynamic-content](https://npmjs.com/package/@o3r/dynamic-content) instead*
- `StyleLazyLoaderModule` is deprecated.</br>Note: *use StyleLazyLoaderModule exported by [@o3r/dynamic-content](https://npmjs.com/package/@o3r/dynamic-content) instead*
- `StyleURL` is deprecated.</br>Note: *use StyleURL exported by [@o3r/dynamic-content](https://npmjs.com/package/@o3r/dynamic-content) instead*
<!-- generated deprecated - end -->
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
"@o3r/eslint-plugin": "workspace:^",
"@o3r/telemetry": "workspace:^",
"@o3r/workspace": "workspace:^",
"@o3r/workspace-helpers": "workspace:^",
"@playwright/test": "~1.48.0",
"@popperjs/core": "^2.11.5",
"@schematics/angular": "~18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@ama-sdk/create/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
'files': ['package.json'],
'rules': {
'@o3r/json-dependency-versions-harmonize': ['error', {
'ignoredPackages': ['@o3r/build-helpers'],
'ignoredPackages': ['@o3r/build-helpers', '@o3r/workspace-helpers'],
ignoredDependencies: ['yarn'],
'alignPeerDependencies': false
}]
Expand Down
2 changes: 1 addition & 1 deletion packages/@o3r/create/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
'files': ['package.json'],
'rules': {
'@o3r/json-dependency-versions-harmonize': ['error', {
'ignoredPackages': ['@o3r/build-helpers'],
'ignoredPackages': ['@o3r/build-helpers', '@o3r/workspace-helpers'],
ignoredDependencies: ['yarn'],
'alignPeerDependencies': false
}]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import { type Rule } from '@angular-devkit/schematics';
import { AddDevInstall } from '@o3r/schematics';
import { setupDependencies } from '@o3r/schematics';
import { NodeDependencyType } from '@schematics/angular/utility/dependencies';
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';

/**
* Add Stylistic package in the dependencies
* @param _tree
* @param context
*/
export const addStylistic: Rule = (_tree, context) => {
context.addTask(new AddDevInstall({
packageName: '@stylistic/eslint-plugin-ts'
}));
export const addStylistic: Rule = () => {
const packageName = '@stylistic/eslint-plugin-ts';
const packageJson = JSON.parse(readFileSync(resolve(__dirname, '..', '..', '..', 'package.json'), { encoding: 'utf-8' }));
return setupDependencies({
dependencies: {
[packageName]: {
inManifest: [{
range: packageJson.peerDependencies[packageName],
types: [NodeDependencyType.Dev]
}]
}
}
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ActionBlock } from '../engine/index';

/**
* Content of action that updates the configuration
* @deprecated use the one exposer by `@o3r/configuration` module. Will be removed in Otter v12.
* @deprecated use the one exposed by `@o3r/configuration` module. Will be removed in Otter v12.
*/
export interface ActionUpdateConfigBlock extends ActionBlock {
actionType: 'UPDATE_CONFIG';
Expand All @@ -13,7 +13,7 @@ export interface ActionUpdateConfigBlock extends ActionBlock {

/**
* Content of action that updates an asset
* @deprecated use the one exposer by `@o3r/dynamic-content` module. Will be removed in Otter v12.
* @deprecated use the one exposed by `@o3r/dynamic-content` module. Will be removed in Otter v12.
*/
export interface ActionUpdateAssetBlock extends ActionBlock {
actionType: 'UPDATE_ASSET';
Expand All @@ -23,7 +23,7 @@ export interface ActionUpdateAssetBlock extends ActionBlock {

/**
* Content of action that updates localization
* @deprecated use the one exposer by `@o3r/localization` module. Will be removed in Otter v12.
* @deprecated use the one exposed by `@o3r/localization` module. Will be removed in Otter v12.
*/
export interface ActionUpdateLocalisationBlock extends ActionBlock {
actionType: 'UPDATE_LOCALISATION';
Expand All @@ -33,7 +33,7 @@ export interface ActionUpdateLocalisationBlock extends ActionBlock {

/**
* Content of action that updates a placeholder
* @deprecated use the one exposer by `@o3r/components` module. Will be removed in Otter v12.
* @deprecated use the one exposed by `@o3r/components` module. Will be removed in Otter v12.
*/
export interface ActionUpdatePlaceholderBlock extends ActionBlock {
actionType: 'UPDATE_PLACEHOLDER';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,27 @@ export const selectActiveRuleSets = createSelector(
return to && to.getTime() >= time;
}).map((ruleSet: Ruleset) => ruleSet.id));

/*
/**
* Assign rulesetId to a component
* @deprecated; It will be rmeoved in v12 with the selector using it
* @param compName
* @param library
* @param ruleSetId
* @param acc
* @deprecated It will be replaced by the selector using it, will be removed in v12.
*/
function linkRulesetToComponent(compName: string, library: string, ruleSetId: string, acc: Record<string, string[]> = {}) {
const configName = computeItemIdentifier(compName, library);
acc[configName] ||= [];
acc[configName].push(ruleSetId);
}

/* Assign component to RulesetIds Map */
/**
* Assign component to RulesetIds Map
* @param compName
* @param library
* @param ruleSetId
* @param acc
*/
function linkComponentToRuleset(compName: string, library: string, ruleSetId: string, acc: Record<string, string[]> = {}) {
const configName = computeItemIdentifier(compName, library);
acc[ruleSetId] ||= [];
Expand Down
1 change: 0 additions & 1 deletion packages/@o3r/schematics/src/public_api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './interfaces/index';
export * from './rule-factories/index';
export * from './rules/index';
export * from './tasks/index';
export * from './utility/index';
export * from './modules/index';
1 change: 0 additions & 1 deletion packages/@o3r/schematics/src/rules/index.ts

This file was deleted.

19 changes: 0 additions & 19 deletions packages/@o3r/schematics/src/rules/install.ts

This file was deleted.

Loading

0 comments on commit 13e3d42

Please sign in to comment.