support hide dependency and codeOnly dependency (#20)

* add custom doc

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* add custom doc

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* add custom doc

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* add custom doc

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* refactor docs

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* allow hidden dependency

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* support sample code write to project root

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* spell fix

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* spell fix

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* allow hidden dependency

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* support sample code write to project root

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* add codeOnly depencencies proeprty of dependency

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* support codeonly dependency

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* hide group

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* support dependency of dependency

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* bugfix && page label update

Signed-off-by: theonefx <chenxilzx1@gmail.com>

* misspelling

Signed-off-by: theonefx <chenxilzx1@gmail.com>

Signed-off-by: theonefx <chenxilzx1@gmail.com>
This commit is contained in:
TheoneFx 2022-12-15 20:09:05 +08:00 committed by GitHub
parent 5545232a02
commit e2be410267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 417 additions and 318 deletions

View File

@ -62,14 +62,18 @@ dependencies:
- name 分组名称;
- bom对应引入的 bom可选如果配置了 bom 则版本依赖全部由 bom 控制;
- compatibilityRange版本范围可选。如果配置该值代表支持的 Spring Boot 版本范围如果不配置则不关注Spring Boot 版本;
- hide: 是否在 metadata api 中显示这个分组;
- content具体组件依赖
- 组件依赖
- name依赖名称展示用
- id依赖的唯一标识需要全局唯一
- name依赖名称展示用
- description依赖描述展示用
- groupId、artifactId依赖坐标
- starter是否是 Spring Boot 的 starter
- links用于生成 help 文档中放置的关联连接
- hide: 是否在 metadata api 中显示这个依赖
- codeOnly: 如果为 true那么在选择这个组件时不会增加任何 maven 或者是 gradle 依赖,而只会添加对应的示例代码
- dependencies: 当前组件依赖的次级组件id当前选择该组件时这个属性设置的次级组件也会被同步选择上
### 架构配置
```yaml
architecture:

View File

@ -16,17 +16,6 @@
package com.alibaba.initializer.configure;
import java.util.Enumeration;
import java.util.Map;
import javax.cache.configuration.MutableConfiguration;
import javax.cache.expiry.CreatedExpiryPolicy;
import javax.cache.expiry.Duration;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import com.alibaba.initializer.controller.InitializerProjectMetadataController;
import com.alibaba.initializer.controller.InitializerProjectRequestToDescriptionConverter;
import com.alibaba.initializer.core.template.CodeTemplateRepoRenderer;
@ -37,6 +26,7 @@ import com.alibaba.initializer.core.template.loader.LocalRepoTemplateLoader;
import com.alibaba.initializer.core.template.loader.RootRepoTemplateLoader;
import com.alibaba.initializer.generation.BootstrapProjectGenerator;
import com.alibaba.initializer.generation.InitializerProjectGenerationInvoker;
import com.alibaba.initializer.generation.extension.dependency.DependencyOfDependencyDescriptionCustomizer;
import com.alibaba.initializer.protocol.CodeGenerationProtocolFilter;
import com.alibaba.initializer.protocol.archive.ProjectArchiveHandler;
import com.alibaba.initializer.protocol.git.ProjectGenerationResolver;
@ -48,9 +38,9 @@ import io.spring.initializr.generator.io.SimpleIndentStrategy;
import io.spring.initializr.metadata.DependencyMetadataProvider;
import io.spring.initializr.metadata.InitializrMetadataProvider;
import io.spring.start.site.project.JavaVersionProjectDescriptionCustomizer;
import static java.util.concurrent.TimeUnit.SECONDS;
import org.eclipse.jgit.http.server.GitFilter;
import org.eclipse.jgit.transport.resolver.RepositoryResolver;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
@ -59,7 +49,15 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import static java.util.concurrent.TimeUnit.SECONDS;
import javax.cache.configuration.MutableConfiguration;
import javax.cache.expiry.CreatedExpiryPolicy;
import javax.cache.expiry.Duration;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.Map;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
@ -223,4 +221,9 @@ public class BootstrapProjectGenerationConfigure {
.setStatisticsEnabled(true)
.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(duration)));
}
@Bean
public DependencyOfDependencyDescriptionCustomizer dependencyOfDependencyDescriptionCustomizer(InitializrMetadataProvider metadataProvider) {
return new DependencyOfDependencyDescriptionCustomizer(metadataProvider);
}
}

View File

@ -16,20 +16,25 @@
package com.alibaba.initializer.controller;
import java.lang.reflect.Field;
import java.util.stream.Collectors;
import com.alibaba.initializer.metadata.ArchitectureCapability;
import com.alibaba.initializer.metadata.EnhancedDependency;
import com.alibaba.initializer.metadata.EnhancedDependencyGroup;
import com.alibaba.initializer.metadata.InitializerMetadata;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.spring.initializr.metadata.DefaultMetadataElement;
import io.spring.initializr.metadata.DependenciesCapability;
import io.spring.initializr.metadata.DependencyGroup;
import io.spring.initializr.metadata.Describable;
import io.spring.initializr.metadata.InitializrMetadata;
import io.spring.initializr.web.mapper.InitializrMetadataV2JsonMapper;
import org.springframework.hateoas.TemplateVariable;
import org.springframework.hateoas.TemplateVariables;
import java.lang.reflect.Field;
import java.util.stream.Collectors;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
@ -59,7 +64,6 @@ public class InitializerMetadataV2JsonMapper extends InitializrMetadataV2JsonMap
}
}
@Override
public String write(InitializrMetadata metadata, String appUrl) {
InitializerMetadata initializerMetadata = (InitializerMetadata) metadata;
@ -89,10 +93,51 @@ public class InitializerMetadataV2JsonMapper extends InitializrMetadataV2JsonMap
single.put("default", defaultType.getId());
}
ArrayNode values = nodeFactory().arrayNode();
values.addAll(capability.getContent().stream().map(this::mapValue)
.collect(Collectors.toList()));
values.addAll(capability.getContent().stream().map(this::mapValue).collect(Collectors.toList()));
single.set("values", values);
parent.set(capability.getId(), single);
}
@Override
protected void dependencies(ObjectNode parent, DependenciesCapability capability) {
ObjectNode dependencies = nodeFactory().objectNode();
dependencies.put("type", capability.getType().getName());
ArrayNode values = nodeFactory().arrayNode();
values.addAll(capability.getContent().stream().filter(group -> {
if (group instanceof EnhancedDependencyGroup) {
if (((EnhancedDependencyGroup) group).isHide()) {
// do not add hidden dependency group to json meta
return false;
}
}
return true;
}).map(this::mapDependencyGroup).collect(Collectors.toList()));
dependencies.set("values", values);
parent.set(capability.getId(), dependencies);
}
@Override
protected ObjectNode mapDependencyGroup(DependencyGroup group) {
ObjectNode result = nodeFactory().objectNode();
result.put("name", group.getName());
if ((group instanceof Describable) && ((Describable) group).getDescription() != null) {
result.put("description", ((Describable) group).getDescription());
}
ArrayNode items = nodeFactory().arrayNode();
group.getContent().forEach((it) -> {
if (it instanceof EnhancedDependency) {
if (((EnhancedDependency) it).isHide()) {
// do not add hidden dependency to json metadata
return;
}
}
JsonNode dependency = mapDependency(it);
if (dependency != null) {
items.add(dependency);
}
});
result.set("values", items);
return result;
}
}

View File

@ -24,7 +24,7 @@ public interface BootstrapTemplateRenderConstants {
String KEY_BASE_VERSION = "version";
String KEY_SPRINGBOOT_VERSION = "spring-boot.version";
String KEY_JAVA_VERSION = "java.version";
String KEY_TARGET_MODULE = "targetModule";
String KEY_MODULE = "module";
String KEY_ARTIFACT_ID = "artifactId";
String KEY_GROUP_ID = "groupId";

View File

@ -38,7 +38,7 @@ import com.alibaba.initializer.core.template.CodeTemplateRepoRenderer;
import com.alibaba.initializer.core.template.RepoRenderResult;
import com.alibaba.initializer.core.template.loader.RootRepoTemplateLoader;
import com.alibaba.initializer.generation.constants.BootstrapTemplateRenderConstants;
import com.alibaba.initializer.metadata.ArchedDependency;
import com.alibaba.initializer.metadata.EnhancedDependency;
import com.alibaba.initializer.metadata.Architecture;
import com.alibaba.initializer.metadata.DependencyArchConfig;
import com.alibaba.initializer.metadata.InitializerMetadata;
@ -113,7 +113,11 @@ public class SampleCodeContributor implements ProjectContributor {
List<RepoRenderResult.TemplateRenderResult> resources = result.getResults("resources");
resources.forEach(res -> writeResources(res, language, projectRoot, structure));
// TODO write root, how to separate root resource from code & resource ?
// write root
if (module.isRoot()) {
List<RepoRenderResult.TemplateRenderResult> roots = result.getResults("root");
roots.forEach(res -> writeRoot(res, language, projectRoot, structure));
}
});
}
@ -148,7 +152,7 @@ public class SampleCodeContributor implements ProjectContributor {
private boolean filterByModule(Map.Entry<String, Dependency> entry, Architecture arch) {
String id = entry.getKey();
ArchedDependency dep = getMetaDependency(id);
EnhancedDependency dep = getMetaDependency(id);
if (dep == null) {
return true;
@ -181,12 +185,12 @@ public class SampleCodeContributor implements ProjectContributor {
}
}
private ArchedDependency getMetaDependency(String id) {
private EnhancedDependency getMetaDependency(String id) {
for (DependencyGroup group : meta.getDependencies().getContent()) {
for (io.spring.initializr.metadata.Dependency dependency : group.getContent()) {
if (StringUtils.equalsIgnoreCase(dependency.getId(), id)) {
return (ArchedDependency) dependency;
return (EnhancedDependency) dependency;
}
}
}
@ -219,6 +223,17 @@ public class SampleCodeContributor implements ProjectContributor {
}
}
protected void writeRoot(RepoRenderResult.TemplateRenderResult result, Language language, Path projectRoot, SourceStructure structure) {
Path path = projectRoot.resolve(result.getPath().subpath(1, result.getPath().getNameCount()));
String content = result.getContent();
try {
doWirte(path, content, true);
} catch (IOException e) {
throw new BizRuntimeException(ErrorCodeEnum.SYSTEM_ERROR, "write code error", e);
}
}
protected Path reslovePackagePath(Path sourceRoot, String content) {
Path path = sourceRoot;
Matcher matcher = Pattern.compile(PACKAGE_PATTEN).matcher(content);

View File

@ -81,16 +81,9 @@ public class ArchedMavenProjectGenerationConfiguration {
}
@Bean
@ConditionalOnArchitectured
public MulitModuleMavenBuildProjectContributor mulitModuleavenBuildProjectContributor(
MavenBuild build, IndentingWriterFactory indentingWriterFactory) {
return new MulitModuleMavenBuildProjectContributor(build, indentingWriterFactory);
MavenBuild build, IndentingWriterFactory indentingWriterFactory,InitializrMetadata metadata) {
return new MulitModuleMavenBuildProjectContributor(build, indentingWriterFactory, metadata);
}
@Bean
@ConditionalOnMissingBean
public MavenBuildProjectContributor mavenBuildProjectContributor(
MavenBuild build, IndentingWriterFactory indentingWriterFactory) {
return new MavenBuildProjectContributor(build, indentingWriterFactory);
}
}

View File

@ -37,9 +37,11 @@ import io.spring.initializr.generator.io.IndentingWriterFactory;
import io.spring.initializr.generator.spring.build.maven.MavenBuildProjectContributor;
import io.spring.initializr.generator.version.VersionProperty;
import io.spring.initializr.generator.version.VersionReference;
import io.spring.initializr.metadata.InitializrMetadata;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
@ -53,11 +55,14 @@ public class MulitModuleMavenBuildProjectContributor extends MavenBuildProjectCo
private final MulitModuleMavenBuildWriter buildWriter;
public MulitModuleMavenBuildProjectContributor(MavenBuild build, IndentingWriterFactory indentingWriterFactory) {
private final InitializrMetadata metadata;
public MulitModuleMavenBuildProjectContributor(MavenBuild build, IndentingWriterFactory indentingWriterFactory, InitializrMetadata metadata) {
super(build, indentingWriterFactory);
this.build = build;
this.indentingWriterFactory = indentingWriterFactory;
this.buildWriter = new MulitModuleMavenBuildWriter();
this.metadata = metadata;
this.buildWriter = new MulitModuleMavenBuildWriter(metadata);
// use reflext to replace MavenBuildWriter
try {
@ -90,58 +95,63 @@ public class MulitModuleMavenBuildProjectContributor extends MavenBuildProjectCo
builder.configuration(conf -> conf.add("mainClass", description.getPackageName() + "." + description.getApplicationName()).add("skip", "true"));
});
// add submodule in root dependencymanager
for (Module subModule : arch.getSubModules()) {
this.build.boms().add(subModule.getName(),
DependencyBillOfMaterials
.withCoordinates(description.getGroupId(), subModule.getName())
.type(null)
.scope(null)
.version(VersionReference.ofValue(description.getVersion()))
);
}
if (arch == null || CollectionUtils.isEmpty(arch.getSubModules())) {
super.contribute(projectRoot);
} else {
List<Module> modules = arch.getSubModules();
// create new pom.xml file
super.contribute(projectRoot);
// insert <modules /> to pom.xml
List<Module> modules = description.getArchitecture().getSubModules();
Path pomFile = projectRoot.resolve("pom.xml");
try (RandomAccessFile rw = new RandomAccessFile(pomFile.toFile(), "rw")) {
StringBuffer rewrited = new StringBuffer();
//not utf-8 but ISO-8859-1 encodng
String rawLine;
int index = -1;
int insetIndex = findModulesInsertLine(pomFile);
while ((rawLine = rw.readLine()) != null) {
index++;
//trans encoding style
String line = new String(rawLine.getBytes("ISO-8859-1"), "UTF-8");
rewrited.append(line).append("\n");
if (index == insetIndex) {
StringWriter sw = new StringWriter();
IndentingWriter writer = indentingWriterFactory
.createIndentingWriter("maven", sw);
writer.println();
writer.indented(() -> {
writer.println("<modules>");
writer.indented(() -> modules.stream()
.map(name -> "<module>" + name.getName() + "</module>")
.forEach(writer::println));
writer.println("</modules>\n");
});
rewrited.append(sw);
}
// add submodule in root dependencymanager
for (Module subModule : arch.getSubModules()) {
this.build.boms().add(subModule.getName(),
DependencyBillOfMaterials
.withCoordinates(description.getGroupId(), subModule.getName())
.type(null)
.scope(null)
.version(VersionReference.ofValue(description.getVersion()))
);
}
rw.seek(0);
rw.write(rewrited.toString().getBytes());
}
} else {
// create new pom.xml file
super.contribute(projectRoot);
// insert <modules /> to pom.xml
Path pomFile = projectRoot.resolve("pom.xml");
try (RandomAccessFile rw = new RandomAccessFile(pomFile.toFile(), "rw")) {
StringBuffer rewrited = new StringBuffer();
//not utf-8 but ISO-8859-1 encodng
String rawLine;
int index = -1;
int insetIndex = findModulesInsertLine(pomFile);
while ((rawLine = rw.readLine()) != null) {
index++;
//trans encoding style
String line = new String(rawLine.getBytes("ISO-8859-1"), "UTF-8");
rewrited.append(line).append("\n");
if (index == insetIndex) {
StringWriter sw = new StringWriter();
IndentingWriter writer = indentingWriterFactory
.createIndentingWriter("maven", sw);
writer.println();
writer.indented(() -> {
writer.println("<modules>");
writer.indented(() -> modules.stream()
.map(name -> "<module>" + name.getName() + "</module>")
.forEach(writer::println));
writer.println("</modules>\n");
});
rewrited.append(sw);
}
}
rw.seek(0);
rw.write(rewrited.toString().getBytes());
}
}
} else {
if (module.isMain()) {
// main module depend all other submodules
List<Module> subModules = arch.getSubModules();

View File

@ -16,19 +16,8 @@
package com.alibaba.initializer.generation.extension.build.maven;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.alibaba.initializer.generation.extension.build.DependencyBillOfMaterials;
import com.alibaba.initializer.metadata.EnhancedDependency;
import io.spring.initializr.generator.buildsystem.BillOfMaterials;
import io.spring.initializr.generator.buildsystem.BomContainer;
import io.spring.initializr.generator.buildsystem.Dependency;
@ -56,10 +45,23 @@ import io.spring.initializr.generator.buildsystem.maven.MavenScm;
import io.spring.initializr.generator.io.IndentingWriter;
import io.spring.initializr.generator.version.VersionProperty;
import io.spring.initializr.generator.version.VersionReference;
import io.spring.initializr.metadata.InitializrMetadata;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* copy from MavenBuildWriter to rewrite prvate methods
*
@ -67,6 +69,12 @@ import org.springframework.util.StringUtils;
*/
public class MulitModuleMavenBuildWriter extends MavenBuildWriter {
private final InitializrMetadata metadata;
public MulitModuleMavenBuildWriter(InitializrMetadata metadata) {
this.metadata = metadata;
}
/**
* Write a {@linkplain MavenBuild pom.xml} using the specified
* {@linkplain IndentingWriter writer}.
@ -94,15 +102,6 @@ public class MulitModuleMavenBuildWriter extends MavenBuildWriter {
});
}
/**
* Return the {@link Comparator} to use to sort dependencies.
*
* @return a dependency comparator
*/
protected Comparator<Dependency> getDependencyComparator() {
return DependencyComparator.INSTANCE;
}
private void writeProject(IndentingWriter writer, Runnable whenWritten) {
writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
writer.println(
@ -213,21 +212,24 @@ public class MulitModuleMavenBuildWriter extends MavenBuildWriter {
}
private void writeDependencies(IndentingWriter writer, DependencyContainer dependencies) {
if (dependencies.isEmpty()) {
List<Dependency> items = dependencies.ids()
.filter(this::isNotCodeOnly)
.map(dependencies::get)
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(items)) {
return;
}
writeElement(writer, "dependencies", () -> {
Collection<Dependency> compiledDependencies = writeDependencies(writer, dependencies,
Collection<Dependency> compiledDependencies = writeDependencies(writer, items,
(scope) -> scope == null || scope == DependencyScope.COMPILE);
if (!compiledDependencies.isEmpty()) {
writer.println();
}
writeDependencies(writer, dependencies, hasScope(DependencyScope.RUNTIME));
writeDependencies(writer, dependencies, hasScope(DependencyScope.COMPILE_ONLY));
writeDependencies(writer, dependencies, hasScope(DependencyScope.ANNOTATION_PROCESSOR));
writeDependencies(writer, dependencies, hasScope(DependencyScope.PROVIDED_RUNTIME));
writeDependencies(writer, dependencies,
hasScope(DependencyScope.TEST_COMPILE, DependencyScope.TEST_RUNTIME));
writeDependencies(writer, items, hasScope(DependencyScope.RUNTIME));
writeDependencies(writer, items, hasScope(DependencyScope.COMPILE_ONLY));
writeDependencies(writer, items, hasScope(DependencyScope.ANNOTATION_PROCESSOR));
writeDependencies(writer, items, hasScope(DependencyScope.PROVIDED_RUNTIME));
writeDependencies(writer, items, hasScope(DependencyScope.TEST_COMPILE, DependencyScope.TEST_RUNTIME));
});
}
@ -235,14 +237,27 @@ public class MulitModuleMavenBuildWriter extends MavenBuildWriter {
return (scope) -> Arrays.asList(validScopes).contains(scope);
}
private Collection<Dependency> writeDependencies(IndentingWriter writer, DependencyContainer dependencies,
private Collection<Dependency> writeDependencies(IndentingWriter writer, List<Dependency> items,
Predicate<DependencyScope> filter) {
Collection<Dependency> candidates = dependencies.items().filter((dep) -> filter.test(dep.getScope()))
.sorted(getDependencyComparator()).collect(Collectors.toList());
Collection<Dependency> candidates = items.stream()
.filter((dep) -> filter.test(dep.getScope()))
.sorted(getDependencyComparator())
.collect(Collectors.toList());
writeCollection(writer, candidates, this::writeDependency);
return candidates;
}
private boolean isNotCodeOnly(String id) {
io.spring.initializr.metadata.Dependency dep = metadata.getDependencies().get(id);
if (dep == null) {
return true;
}
if (dep instanceof EnhancedDependency edep) {
return !edep.isCodeOnly();
}
return true;
}
private void writeDependency(IndentingWriter writer, Dependency dependency) {
writeElement(writer, "dependency", () -> {
writeSingleElement(writer, "groupId", dependency.getGroupId());

View File

@ -0,0 +1,75 @@
/*
* Copyright 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.initializer.generation.extension.dependency;
import com.alibaba.initializer.metadata.EnhancedDependency;
import io.spring.initializr.generator.project.MutableProjectDescription;
import io.spring.initializr.generator.project.ProjectDescriptionCustomizer;
import io.spring.initializr.metadata.DependenciesCapability;
import io.spring.initializr.metadata.Dependency;
import io.spring.initializr.metadata.InitializrMetadata;
import io.spring.initializr.metadata.InitializrMetadataProvider;
import io.spring.initializr.metadata.support.MetadataBuildItemMapper;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Set;
/**
* auto add dependency of dependency
*
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
public class DependencyOfDependencyDescriptionCustomizer implements ProjectDescriptionCustomizer {
private final InitializrMetadataProvider provider;
public DependencyOfDependencyDescriptionCustomizer(InitializrMetadataProvider dependencyMetadataProvider) {
this.provider = dependencyMetadataProvider;
}
@Override
public void customize(MutableProjectDescription description) {
InitializrMetadata metadata = provider.get();
DependenciesCapability allDependency = metadata.getDependencies();
Set<String> ids = description.getRequestedDependencies().keySet();
ids.stream().map(allDependency::get).forEach(dep -> this.appendSubDep(dep, description, allDependency));
}
private void appendSubDep(Dependency dependency, MutableProjectDescription description, DependenciesCapability allDependency) {
if (!description.getRequestedDependencies().containsKey(dependency.getId())) {
description.addDependency(dependency.getId(), MetadataBuildItemMapper.toDependency(dependency));
}
if (!(dependency instanceof EnhancedDependency edep)) {
return;
}
List<String> subDeps = edep.getDependencies();
if (CollectionUtils.isEmpty(subDeps)) {
return;
}
subDeps.stream().map(allDependency::get).forEach(dep -> this.appendSubDep(dep, description, allDependency));
}
}

View File

@ -1,52 +0,0 @@
/*
* Copyright 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.initializer.generation.extension.dependency;
import java.util.Set;
import com.alibaba.initializer.metadata.InitializerMetadata;
import com.alibaba.initializer.metadata.Module;
import io.spring.initializr.generator.project.MutableProjectDescription;
import io.spring.initializr.generator.project.ProjectDescriptionCustomizer;
import org.springframework.beans.factory.annotation.Autowired;
/**
* filter dependency for multi-arch module
*
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
public class MultiArchModuleDependencyFilterDescriptionCustomizer implements ProjectDescriptionCustomizer {
@Autowired
private Module module;
@Autowired
private InitializerMetadata metadata;
@Override
public void customize(MutableProjectDescription description) {
Set<String> ids = description.getRequestedDependencies().keySet();
if (!module.isMain()) {
ids.forEach(id -> description.getRequestedDependencies().remove(id));
}
}
}

View File

@ -16,16 +16,37 @@
package com.alibaba.initializer.metadata;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.spring.initializr.metadata.Dependency;
import java.util.List;
import java.util.Map;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ArchedDependency extends Dependency {
public class EnhancedDependency extends Dependency {
/**
* whether display on web page or idea plugin
* if true, this dependency will hide from web page or idea plugin.
* default false.
*/
private boolean hide = false;
/**
* If true, this dependency will not add any gradle | maven dependency,
* but only attach corresponding sample code to generated project.
* default false.
*/
private boolean codeOnly = false;
/**
* The sub dependencies of current dependency is selected.
* default null.
*/
private List<String> dependencies;
private Map<String, DependencyArchConfig> archCfg;
@ -36,4 +57,28 @@ public class ArchedDependency extends Dependency {
public void setArchCfg(Map<String, DependencyArchConfig> archCfg) {
this.archCfg = archCfg;
}
public boolean isHide() {
return hide;
}
public void setHide(boolean hide) {
this.hide = hide;
}
public boolean isCodeOnly() {
return codeOnly;
}
public void setCodeOnly(boolean codeOnly) {
this.codeOnly = codeOnly;
}
public List<String> getDependencies() {
return dependencies;
}
public void setDependencies(List<String> dependencies) {
this.dependencies = dependencies;
}
}

View File

@ -0,0 +1,70 @@
/*
* Copyright 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.initializer.metadata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.spring.initializr.metadata.Dependency;
import io.spring.initializr.metadata.DependencyGroup;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
public class EnhancedDependencyGroup extends DependencyGroup {
private List<EnhancedDependency> content;
/**
* wheather display on web page or idea plugin
* if true, this dependency group will hide from web page or idea plugin
*/
@JsonIgnore
private boolean hide = false;
/**
* Return the {@link EnhancedDependency dependencies} of this group.
*
* @return the content
*/
public List<Dependency> getContent() {
return new ArrayList<>(this.content);
}
public void setContent(List<EnhancedDependency> content) {
this.content = content;
try {
// use reflect to set parent final field
Field parentContentField = DependencyGroup.class.getDeclaredField("content");
parentContentField.setAccessible(true);
parentContentField.set(this, this.content);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public boolean isHide() {
return hide;
}
public void setHide(boolean hide) {
this.hide = hide;
}
}

View File

@ -1,128 +0,0 @@
/*
* Copyright 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.initializer.metadata;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.spring.initializr.metadata.DependencyGroup;
/**
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/
public class InitializerDependencyGroup {
private String name;
@JsonIgnore
private String compatibilityRange;
@JsonIgnore
private String bom;
@JsonIgnore
private String repository;
final List<ArchedDependency> content = new ArrayList<>();
/**
* Return the name of this group.
*
* @return the name of the group
*/
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
/**
* Return the default compatibility range to apply to all dependencies of this group
* unless specified otherwise.
*
* @return the compatibility range
*/
public String getCompatibilityRange() {
return this.compatibilityRange;
}
public void setCompatibilityRange(String compatibilityRange) {
this.compatibilityRange = compatibilityRange;
}
/**
* Return the default bom to associate to all dependencies of this group unless
* specified otherwise.
*
* @return the BOM
*/
public String getBom() {
return this.bom;
}
public void setBom(String bom) {
this.bom = bom;
}
/**
* Return the default repository to associate to all dependencies of this group unless
* specified otherwise.
*
* @return the repository
*/
public String getRepository() {
return this.repository;
}
public void setRepository(String repository) {
this.repository = repository;
}
/**
* Return the {@link ArchedDependency dependencies} of this group.
*
* @return the content
*/
public List<ArchedDependency> getContent() {
return this.content;
}
/**
* Create a new {@link DependencyGroup} instance with the given name.
*
* @param name the name of the group
* @return a new {@link DependencyGroup} instance
*/
public static DependencyGroup create(String name) {
DependencyGroup group = new DependencyGroup();
group.setName(name);
return group;
}
public DependencyGroup toDependencyGroup() {
DependencyGroup group = new DependencyGroup();
group.setName(name);
group.setBom(bom);
group.setRepository(repository);
group.setCompatibilityRange(compatibilityRange);
group.getContent().addAll(content);
return group;
}
}

View File

@ -106,7 +106,7 @@ public class InitializerMetadataBuilder {
public void customize(InitializrMetadata metadata) {
InitializerMetadata initializerMetadata = (InitializerMetadata) metadata;
initializerMetadata.getArchitecture().merge(this.properties.getArchitecture());
initializerMetadata.getDependencies().merge(toDepGroup(this.properties.getDependencies()));
initializerMetadata.getDependencies().merge(new ArrayList<>(this.properties.getDependencies()));
metadata.getTypes().merge(this.properties.getTypes());
metadata.getBootVersions().merge(this.properties.getBootVersions());
metadata.getPackagings().merge(this.properties.getPackagings());
@ -120,8 +120,5 @@ public class InitializerMetadataBuilder {
this.properties.getPackageName().apply(metadata.getPackageName());
}
private List<DependencyGroup> toDepGroup(List<InitializerDependencyGroup> adepg) {
return adepg.stream().map(InitializerDependencyGroup::toDependencyGroup).collect(Collectors.toList());
}
}
}

View File

@ -44,7 +44,7 @@ public class InitializerProperties extends InitializrConfiguration {
* Dependencies, organized in groups (i.e. themes).
*/
@JsonIgnore
private final List<InitializerDependencyGroup> dependencies = new ArrayList<>();
private final List<EnhancedDependencyGroup> dependencies = new ArrayList<>();
/**
* Available project types.
@ -116,11 +116,10 @@ public class InitializerProperties extends InitializrConfiguration {
return architecture;
}
public List<InitializerDependencyGroup> getDependencies() {
public List<EnhancedDependencyGroup> getDependencies() {
return dependencies;
}
public List<Type> getTypes() {
return this.types;
}

View File

@ -1707,6 +1707,14 @@ initializr:
href: https://googlecloudplatform.github.io/spring-cloud-gcp/reference/html/index.html#cloud-storage
- rel: guide
href: https://github.com/GoogleCloudPlatform/spring-cloud-gcp/tree/main/spring-cloud-gcp-samples/spring-cloud-gcp-storage-resource-sample
- name: Hidden Group
id: hidden-group
hide: true
description: this is a hidden dependency group
content:
- name: cloudshell
id: cloudshell
codeOnly: true
types:
- name: Maven Project
id: maven-project

View File

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="data-spm" content="a2ck6"><meta name="aes-config" content="pid=5tYCpT&user_type=6&uid=&username="><title>Cloud Native App Initializer</title><link rel="shortcut icon" href="/images/aliyun-icon.png"><meta http-equiv="x-ua-compatible" content="ie=edge"><link rel="canonical" href="https://github.com/alibaba/cloud-native-app-initializer"><meta name="description" content="Initializr generates spring boot project with just what you need to start quickly!"><meta property="og:site_name" content="Cloud Native App Initializer"><meta property="og:type" content="website"><meta property="og:title" content="Cloud Native App Initializer"><meta property="og:description" content="Initializr generates spring boot project with just what you need to start quickly!"><meta property="og:url" content="https://github.com/alibaba/cloud-native-app-initializer"><meta name="twitter:title" content="Cloud Native App Initializer"><meta name="twitter:description" content="Initializr generates spring boot project with just what you need to start quickly!"><meta name="twitter:url" content="https://github.com/alibaba/cloud-native-app-initializer"><meta name="twitter:site" content="@springboot"><meta name="twitter:creator" content="@springboot"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content=""><meta property="og:image" content=""><meta property="og:image:width" content="1000"><meta property="og:image:height" content="523"><meta name="theme-color" content="#6db33f"><style>body,html{text-rendering:optimizeLegibility}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}html{font-family:sans-serif}body{margin:0}.noscript{padding:2rem}.noscript a{color:#3d96f7}</style><script src="//g.alicdn.com/aes/tracker/1.0.20/index.js"></script><script src="//g.alicdn.com/aes/??tracker/1.0.20/index.js,tracker-plugin-event/1.0.20/event.js"></script><meta name="apple-mobile-web-app-title" content="alibaba-initializr"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><link rel="manifest" href="/manifest.9e69419f57edbe2b5427a726852c0451.json"></head><body data-spm="14145464" class="light"><noscript><div class="noscript"><strong><a href="https://start.aliyun.com">start.aliyun.com</a> can't work!</strong><br>This app needs JavaScript enabled.</div></noscript><div id="app"></div><script type="text/javascript" src="/main-ee71f57dba17c8a7353e.js"></script><script type="text/javascript" src="/chunk-62d6eb49d4dc9c5bced1.js"></script><script type="text/javascript" src="/chunk-f3bb105d5a9ddab8967c.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="data-spm" content="a2ck6"><meta name="aes-config" content="pid=5tYCpT&user_type=6&uid=&username="><title>Cloud Native App Initializer</title><link rel="shortcut icon" href="/images/aliyun-icon.png"><meta http-equiv="x-ua-compatible" content="ie=edge"><link rel="canonical" href="https://github.com/alibaba/cloud-native-app-initializer"><meta name="description" content="Initializr generates spring boot project with just what you need to start quickly!"><meta property="og:site_name" content="Cloud Native App Initializer"><meta property="og:type" content="website"><meta property="og:title" content="Cloud Native App Initializer"><meta property="og:description" content="Initializr generates spring boot project with just what you need to start quickly!"><meta property="og:url" content="https://github.com/alibaba/cloud-native-app-initializer"><meta name="twitter:title" content="Cloud Native App Initializer"><meta name="twitter:description" content="Initializr generates spring boot project with just what you need to start quickly!"><meta name="twitter:url" content="https://github.com/alibaba/cloud-native-app-initializer"><meta name="twitter:site" content="@springboot"><meta name="twitter:creator" content="@springboot"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content=""><meta property="og:image" content=""><meta property="og:image:width" content="1000"><meta property="og:image:height" content="523"><meta name="theme-color" content="#6db33f"><style>body,html{text-rendering:optimizeLegibility}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}html{font-family:sans-serif}body{margin:0}.noscript{padding:2rem}.noscript a{color:#3d96f7}</style><script src="//g.alicdn.com/aes/tracker/1.0.20/index.js"></script><script src="//g.alicdn.com/aes/??tracker/1.0.20/index.js,tracker-plugin-event/1.0.20/event.js"></script><meta name="apple-mobile-web-app-title" content="alibaba-initializr"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><link rel="manifest" href="/manifest.9e69419f57edbe2b5427a726852c0451.json"></head><body data-spm="14145464" class="light"><noscript><div class="noscript"><strong><a href="https://start.aliyun.com">start.aliyun.com</a> can't work!</strong><br>This app needs JavaScript enabled.</div></noscript><div id="app"></div><script type="text/javascript" src="/main-1df39ec353bff77cf889.js"></script><script type="text/javascript" src="/chunk-62d6eb49d4dc9c5bced1.js"></script><script type="text/javascript" src="/chunk-bb4f568ad8459aeeffda.js"></script></body></html>

View File

@ -1,2 +1,2 @@
!function(e){function r(r){for(var n,u,c=r[0],i=r[1],f=r[2],p=0,d=[];p<c.length;p++)u=c[p],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&d.push(o[u][0]),o[u]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(l&&l(r);d.length;)d.shift()();return a.push.apply(a,f||[]),t()}function t(){for(var e,r=0;r<a.length;r++){for(var t=a[r],n=!0,c=1;c<t.length;c++){var i=t[c];0!==o[i]&&(n=!1)}n&&(a.splice(r--,1),e=u(u.s=t[0]))}return e}var n={},o={2:0},a=[];function u(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,u),t.l=!0,t.exports}u.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var a,c=document.createElement("script");c.charset="utf-8",c.timeout=120,u.nc&&c.setAttribute("nonce",u.nc),c.src=function(e){return u.p+"chunk-"+{0:"1796b09a042cad55c924",4:"bcfbda10055c7eb17577",5:"76e49424f16054f8a4a0",6:"18870b914509cad972e2",7:"9441d43ec76a401e7ca7",8:"75467681fad20cdfd7e8",9:"f1206adaef854dab9902"}[e]+".js"}(e);var i=new Error;a=function(r){c.onerror=c.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;i.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",i.name="ChunkLoadError",i.type=n,i.request=a,t[1](i)}o[e]=void 0}};var f=setTimeout((function(){a({type:"timeout",target:c})}),12e4);c.onerror=c.onload=a,document.head.appendChild(c)}return Promise.all(r)},u.m=e,u.c=n,u.d=function(e,r,t){u.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,r){if(1&r&&(e=u(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)u.d(t,n,function(r){return e[r]}.bind(null,n));return t},u.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(r,"a",r),r},u.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},u.p="/",u.oe=function(e){throw console.error(e),e};var c=window.webpackJsonp=window.webpackJsonp||[],i=c.push.bind(c);c.push=r,c=c.slice();for(var f=0;f<c.length;f++)r(c[f]);var l=i;t()}([]);
//# sourceMappingURL=main-ee71f57dba17c8a7353e.js.map
//# sourceMappingURL=main-1df39ec353bff77cf889.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///main-ee71f57dba17c8a7353e.js"],"names":["modules","webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","2","exports","module","l","e","promises","installedChunkData","promise","Promise","resolve","reject","onScriptComplete","script","document","createElement","charset","timeout","nc","setAttribute","src","p","0","4","5","6","7","8","9","jsonpScriptSrc","error","Error","event","onerror","onload","clearTimeout","chunk","errorType","type","realSrc","target","message","name","request","undefined","setTimeout","head","appendChild","all","m","c","d","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","oe","err","console","jsonpArray","window","oldJsonpFunction","slice"],"mappings":"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","file":"main-1df39ec353bff77cf889.js","sourceRoot":""}

File diff suppressed because one or more lines are too long

View File

@ -276,7 +276,7 @@ export default function Application() {
}}
/>
</Control>
<Control text='组件依赖' variant={tab === 'quicksearch' ? 'xl' : 'xxl'}>
<Control text='组件与示例' variant={tab === 'quicksearch' ? 'xl' : 'xxl'}>
<Tabs
changeTab={newTab => {
if (

View File

@ -29,7 +29,7 @@ export default function Loading() {
</div>
</div>
</Control>
<Control text='组件依赖'>
<Control text='组件与示例'>
<Placeholder type='tabs' count={2} />
</Control>
<Footer>