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

feat: static modules #8679

Merged
merged 11 commits into from
Mar 2, 2021
69 changes: 69 additions & 0 deletions lib/datasource/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import * as bitbucketTags from './bitbucket-tags';
import * as cdnjs from './cdnjs';
import * as clojure from './clojure';
import { DatasourceApi } from './common';
import * as crate from './crate';
import * as dart from './dart';
import * as docker from './docker';
import * as galaxy from './galaxy';
import * as gitRefs from './git-refs';
import * as gitSubmodules from './git-submodules';
import * as gitTags from './git-tags';
import * as githubReleases from './github-releases';
import * as githubTags from './github-tags';
import * as gitlabTags from './gitlab-tags';
import * as go from './go';
import * as gradleVersion from './gradle-version';
import * as helm from './helm';
import * as hex from './hex';
import * as jenkinsPlugins from './jenkins-plugins';
import * as maven from './maven';
import * as npm from './npm';
import * as nuget from './nuget';
import * as orb from './orb';
import * as packagist from './packagist';
import * as pod from './pod';
import * as pypi from './pypi';
import * as repology from './repology';
import * as rubyVersion from './ruby-version';
import * as rubygems from './rubygems';
import * as sbtPackage from './sbt-package';
import * as sbtPlugin from './sbt-plugin';
import * as terraformModule from './terraform-module';
import * as terraformProvider from './terraform-provider';

const api = new Map<string, DatasourceApi>();
export default api;

api.set('bitbucket-tags', bitbucketTags);
api.set('cdnjs', cdnjs);
api.set('clojure', clojure);
api.set('crate', crate);
api.set('dart', dart);
api.set('docker', docker);
api.set('galaxy', galaxy);
api.set('git-refs', gitRefs);
api.set('git-submodules', gitSubmodules);
api.set('git-tags', gitTags);
api.set('github-releases', githubReleases);
api.set('github-tags', githubTags);
api.set('gitlab-tags', gitlabTags);
api.set('go', go);
api.set('gradle-version', gradleVersion);
api.set('helm', helm);
api.set('hex', hex);
api.set('jenkins-plugins', jenkinsPlugins);
api.set('maven', maven);
api.set('npm', npm);
api.set('nuget', nuget);
api.set('orb', orb);
api.set('packagist', packagist);
api.set('pod', pod);
api.set('pypi', pypi);
api.set('repology', repology);
api.set('ruby-version', rubyVersion);
api.set('rubygems', rubygems);
api.set('sbt-package', sbtPackage);
api.set('sbt-plugin', sbtPlugin);
api.set('terraform-module', terraformModule);
api.set('terraform-provider', terraformProvider);
2 changes: 1 addition & 1 deletion lib/datasource/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as packageCache from '../util/cache/package';
import { clone } from '../util/clone';
import { regEx } from '../util/regex';
import * as allVersioning from '../versioning';
import datasources from './api.generated';
import datasources from './api';
import {
Datasource,
DigestConfig,
Expand Down
119 changes: 119 additions & 0 deletions lib/manager/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import * as ansible from './ansible';
import * as ansibleGalaxy from './ansible-galaxy';
import * as azurePipelines from './azure-pipelines';
import * as batect from './batect';
import * as batectWrapper from './batect-wrapper';
import * as bazel from './bazel';
import * as buildkite from './buildkite';
import * as bundler from './bundler';
import * as cargo from './cargo';
import * as cdnurl from './cdnurl';
import * as circleci from './circleci';
import * as cocoapods from './cocoapods';
import { ManagerApi } from './common';
import * as composer from './composer';
import * as depsEdn from './deps-edn';
import * as dockerCompose from './docker-compose';
import * as dockerfile from './dockerfile';
import * as droneci from './droneci';
import * as gitSubmodules from './git-submodules';
import * as githubActions from './github-actions';
import * as gitlabci from './gitlabci';
import * as gitlabciInclude from './gitlabci-include';
import * as gomod from './gomod';
import * as gradle from './gradle';
import * as gradleLite from './gradle-lite';
import * as gradleWrapper from './gradle-wrapper';
import * as helmRequirements from './helm-requirements';
import * as helmValues from './helm-values';
import * as helmfile from './helmfile';
import * as helmv3 from './helmv3';
import * as homebrew from './homebrew';
import * as html from './html';
import * as jenkins from './jenkins';
import * as kubernetes from './kubernetes';
import * as kustomize from './kustomize';
import * as leiningen from './leiningen';
import * as maven from './maven';
import * as meteor from './meteor';
import * as mix from './mix';
import * as nodenv from './nodenv';
import * as npm from './npm';
import * as nuget from './nuget';
import * as nvm from './nvm';
import * as pip_requirements from './pip_requirements';
import * as pip_setup from './pip_setup';
import * as pipenv from './pipenv';
import * as poetry from './poetry';
import * as preCommit from './pre-commit';
import * as pub from './pub';
import * as regex from './regex';
import * as rubyVersion from './ruby-version';
import * as sbt from './sbt';
import * as setupCfg from './setup-cfg';
import * as swift from './swift';
import * as terraform from './terraform';
import * as terraformVersion from './terraform-version';
import * as terragrunt from './terragrunt';
import * as travis from './travis';

const api = new Map<string, ManagerApi>();
export default api;

api.set('ansible', ansible);
api.set('ansible-galaxy', ansibleGalaxy);
api.set('azure-pipelines', azurePipelines);
api.set('batect', batect);
api.set('batect-wrapper', batectWrapper);
api.set('bazel', bazel);
api.set('buildkite', buildkite);
api.set('bundler', bundler);
api.set('cargo', cargo);
api.set('cdnurl', cdnurl);
api.set('circleci', circleci);
api.set('cocoapods', cocoapods);
api.set('composer', composer);
api.set('deps-edn', depsEdn);
api.set('docker-compose', dockerCompose);
api.set('dockerfile', dockerfile);
api.set('droneci', droneci);
api.set('git-submodules', gitSubmodules);
api.set('github-actions', githubActions);
api.set('gitlabci', gitlabci);
api.set('gitlabci-include', gitlabciInclude);
api.set('gomod', gomod);
api.set('gradle', gradle);
api.set('gradle-lite', gradleLite);
api.set('gradle-wrapper', gradleWrapper);
api.set('helm-requirements', helmRequirements);
api.set('helm-values', helmValues);
api.set('helmfile', helmfile);
api.set('helmv3', helmv3);
api.set('homebrew', homebrew);
api.set('html', html);
api.set('jenkins', jenkins);
api.set('kubernetes', kubernetes);
api.set('kustomize', kustomize);
api.set('leiningen', leiningen);
api.set('maven', maven);
api.set('meteor', meteor);
api.set('mix', mix);
api.set('nodenv', nodenv);
api.set('npm', npm);
api.set('nuget', nuget);
api.set('nvm', nvm);
api.set('pip_requirements', pip_requirements);
api.set('pip_setup', pip_setup);
api.set('pipenv', pipenv);
api.set('poetry', poetry);
api.set('pre-commit', preCommit);
api.set('pub', pub);
api.set('regex', regex);
api.set('ruby-version', rubyVersion);
api.set('sbt', sbt);
api.set('setup-cfg', setupCfg);
api.set('swift', swift);
api.set('terraform', terraform);
api.set('terraform-version', terraformVersion);
api.set('terragrunt', terragrunt);
api.set('travis', travis);
2 changes: 1 addition & 1 deletion lib/manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
LANGUAGE_RUST,
} from '../constants/languages';
import { RangeStrategy } from '../types';
import managers from './api.generated';
import managers from './api';
import {
ExtractConfig,
LookupUpdate,
Expand Down
18 changes: 18 additions & 0 deletions lib/platform/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as azure from './azure';
import * as bitbucket from './bitbucket';
import * as bitbucketServer from './bitbucket-server';
import { Platform } from './common';
import * as gitea from './gitea';
import * as github from './github';
import * as gitlab from './gitlab';

const api = new Map<string, Platform>();

export default api;

api.set('azure', azure);
api.set('bitbucket', bitbucket);
api.set('bitbucket-server', bitbucketServer);
api.set('gitea', gitea);
api.set('github', github);
api.set('gitlab', gitlab);
2 changes: 1 addition & 1 deletion lib/platform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PLATFORM_NOT_FOUND } from '../constants/error-messages';
import { logger } from '../logger';
import { setPrivateKey } from '../util/git';
import * as hostRules from '../util/host-rules';
import platforms from './api.generated';
import platforms from './api';
import { Platform } from './common';

export * from './common';
Expand Down
46 changes: 46 additions & 0 deletions lib/versioning/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import * as cargo from './cargo';
import { VersioningApi, VersioningApiConstructor } from './common';
import * as composer from './composer';
import * as docker from './docker';
import * as git from './git';
import * as gradle from './gradle';
import * as hashicorp from './hashicorp';
import * as hex from './hex';
import * as ivy from './ivy';
import * as loose from './loose';
import * as maven from './maven';
import * as node from './node';
import * as npm from './npm';
import * as nuget from './nuget';
import * as pep440 from './pep440';
import * as poetry from './poetry';
import * as regex from './regex';
import * as ruby from './ruby';
import * as semver from './semver';
import * as swift from './swift';
import * as ubuntu from './ubuntu';

const api = new Map<string, VersioningApi | VersioningApiConstructor>();

export default api;

api.set('cargo', cargo.api);
api.set('composer', composer.api);
api.set('docker', docker.api);
api.set('git', git.api);
api.set('gradle', gradle.api);
api.set('hashicorp', hashicorp.api);
api.set('hex', hex.api);
api.set('ivy', ivy.api);
api.set('loose', loose.api);
api.set('maven', maven.api);
api.set('node', node.api);
api.set('npm', npm.api);
api.set('nuget', nuget.api);
api.set('pep440', pep440.api);
api.set('poetry', poetry.api);
api.set('regex', regex.api);
api.set('ruby', ruby.api);
api.set('semver', semver.api);
api.set('swift', swift.api);
api.set('ubuntu', ubuntu.api);
2 changes: 1 addition & 1 deletion lib/versioning/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { logger } from '../logger';
import versionings from './api.generated';
import versionings from './api';
import {
VersioningApi,
VersioningApiConstructor,
Expand Down
28 changes: 14 additions & 14 deletions tools/generate-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,24 @@ async function generateData(): Promise<void> {
await generateData();

// datasources
await generate({ path: 'datasource', types: ['DatasourceApi'] });
// await generate({ path: 'datasource', types: ['DatasourceApi'] });
viceice marked this conversation as resolved.
Show resolved Hide resolved
viceice marked this conversation as resolved.
Show resolved Hide resolved

// managers
await generate({ path: 'manager', types: ['ManagerApi'] });

// platform
await generate({
path: 'platform',
types: ['Platform'],
excludes: ['utils', 'git'],
});

// versioning
await generate({
path: 'versioning',
types: ['VersioningApi', 'VersioningApiConstructor'],
map: '.api',
});
// // platform
// await generate({
// path: 'platform',
// types: ['Platform'],
// excludes: ['utils', 'git'],
// });

// // versioning
// await generate({
// path: 'versioning',
// types: ['VersioningApi', 'VersioningApiConstructor'],
// map: '.api',
// });
viceice marked this conversation as resolved.
Show resolved Hide resolved
viceice marked this conversation as resolved.
Show resolved Hide resolved

await Promise.all(
shell
Expand Down