Skip to content

Commit

Permalink
[cascading] from release/9.6.0-rc to main (#1248)
Browse files Browse the repository at this point in the history
<!--
{"currentBranch":"release/9.6.0-rc","targetBranch":"main","bypassReviewers":true,"isConflicting":false}
-->

## Cascading from release/9.6.0-rc to main

The configuration requests the cascading to bypass reviewer in case of
CI success.
To not bypass the reviewing process, please check the following
checkbox:

- [ ] <!-- !cancel bypass! --> 🚫 stop reviewing process
bypass for this Pull Request

---

<small>This Pull Request has been generated with ❤️ by the
[Otter](https://github.com/AmadeusITGroup/otter) cascading tool.</small>
  • Loading branch information
kpanot authored Jan 19, 2024
2 parents 591622f + 7bdc738 commit af85b44
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Typescript Core Generator', () => {
name: 'test-sdk',
package: 'sdk'
}, tree);
});
}, 15000);

it('should update readme', async () => {
const runner = new SchematicTestRunner('@ama-sdk/schematics', collectionPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ public ModelsMap postProcessModels(ModelsMap objs) {
}
boolean containsExtensions = false;
ArrayList<List<CodegenProperty>> group = new ArrayList<List<CodegenProperty>>();
group.add(model.allVars);
group.add(model.vars);
group.add(model.requiredVars);
group.add(model.optionalVars);
Expand Down Expand Up @@ -632,6 +633,7 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
}
boolean nonObjectDefinition = false;
ArrayList<List<CodegenProperty>> group = new ArrayList<List<CodegenProperty>>();
group.add(model.allVars);
group.add(model.vars);
group.add(model.requiredVars);
group.add(model.optionalVars);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,32 +426,33 @@ public RemoveUnusedImports() {
@Override public String formatFragment(String fragment) {
//Retrieve all the imported classes
List<String> allMatches = new ArrayList<String>();
Matcher m = Pattern.compile("import\\s\\{\\s?([A-z]+)\\s?\\}").matcher(fragment);
while (m.find()) {
allMatches.add(m.group(1));
Matcher importLinesMatcher = Pattern.compile("import\\s\\{(.*)}.*;").matcher(fragment);
while (importLinesMatcher.find()) {
Matcher importsMatcher = Pattern.compile("(\\w+)").matcher(importLinesMatcher.group(1));
while (importsMatcher.find()) {
allMatches.add(importsMatcher.group(1));
}
}
//For each class check if the import is used
ListIterator<String> litr = allMatches.listIterator();
while (litr.hasNext()) {
String importedClass = litr.next();
int count =0;
//Looking if the import is used in the fragment
Matcher m2 = Pattern.compile("^((?!\\s*import|\\s*\\*|\\/\\*))(.*[^\\w\\/]"+importedClass+"[^\\w\\/])",
Matcher m2 = Pattern.compile("^(?!(?:\\s*import\\s?\\{))(?:.*\\W)?"+ importedClass + "[^\\w\\/]",
Pattern
.MULTILINE)
.matcher
(fragment);
while (m2.find()) {
count++;
}
if (count == 0) {
if (!m2.find()) {
//Import unused found, removing it
fragment = Pattern.compile("^(\\s*import\\s\\{\\s?"+importedClass+"\\s*}[^;]*;?\\r?\\n?)",
Pattern.MULTILINE)
.matcher(fragment).replaceAll("");
fragment = Pattern.compile("(.*import\\s\\{(?:.*\\W)?)" + importedClass +",?\\s*(\\W.*)")
.matcher(fragment)
.replaceAll("$1$2");
}
}
return fragment;
//If an import is empty, remove it
return Pattern.compile("import\\s\\{(\\s,?)*}\\sfrom\\s.*;\n").matcher(fragment).replaceAll("");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ export function revive{{classname}}<T extends {{classname}} = {{classname}}>(dat
{{#allVars}}
{{^isPrimitiveType}}
{{#complexType}}
{{^isEnum}}
{{^isEnumRef}}
{{#isMap}}
{{#vendorExtensions}}
{{^nonObjectDefinition}}
Expand All @@ -145,8 +143,6 @@ export function revive{{classname}}<T extends {{classname}} = {{classname}}>(dat
{{/vendorExtensions}}
{{/isArray}}
{{/isMap}}
{{/isEnumRef}}
{{/isEnum}}
{{/complexType}}
{{^complexType}}
{{^isEnum}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
},
"scripts": {
"clean": "rimraf test/ test-dev/ dist/ dist-dev/ dist-test/ build/",
"lint:ci": "eslint '**/*[jt]s' --quiet --format junit --output-file ./dist-lint/result.xml",
"lint": "eslint '**/*[jt]s' --cache",
"lint:ci": "eslint \"**/*[jt]s\" --quiet --format junit --output-file ./dist-lint/result.xml",
"lint": "eslint \"**/*[jt]s\" --cache",
"start": "tsc-watch -b tsconfigs/esm2020 --noClear --onFirstSuccess \"<%=packageManager%> run files:pack --watch\"",
"build": "<%=packageManager%> run build:cjs && <%=packageManager%> run build:esm2015 && <%=packageManager%> run build:esm2020 && <%=packageManager%> run files:pack",
"build:cjs": "swc src -d dist/cjs -C module.type=commonjs -q",
Expand Down

0 comments on commit af85b44

Please sign in to comment.