-
Notifications
You must be signed in to change notification settings - Fork 8
feat(chore): export alias for bc #2048
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
/* Auto-generated. Do not edit manually. */ | ||
|
||
import { Accountv3 } from '@scaleway/sdk-account' | ||
import { Applesiliconv1alpha1 } from '@scaleway/sdk-applesilicon' | ||
import { AuditTrailv1alpha1 } from '@scaleway/sdk-audit-trail' | ||
import { Baremetalv1 , Baremetalv3 } from '@scaleway/sdk-baremetal' | ||
import { Billingv2beta1 } from '@scaleway/sdk-billing' | ||
import { Blockv1 , Blockv1alpha1 } from '@scaleway/sdk-block' | ||
import { Cockpitv1 } from '@scaleway/sdk-cockpit' | ||
import { Containerv1beta1 } from '@scaleway/sdk-container' | ||
import { Dediboxv1 } from '@scaleway/sdk-dedibox' | ||
import { Domainv2beta1 } from '@scaleway/sdk-domain' | ||
import { EdgeServicesv1beta1 } from '@scaleway/sdk-edge-services' | ||
import { Filev1alpha1 } from '@scaleway/sdk-file' | ||
import { Flexibleipv1alpha1 } from '@scaleway/sdk-flexibleip' | ||
import { Functionv1beta1 } from '@scaleway/sdk-function' | ||
import { Iamv1alpha1 } from '@scaleway/sdk-iam' | ||
import { Inferencev1 , Inferencev1beta1 } from '@scaleway/sdk-inference' | ||
import { Instancev1 } from '@scaleway/sdk-instance' | ||
import { Interlinkv1beta1 } from '@scaleway/sdk-interlink' | ||
import { Iotv1 } from '@scaleway/sdk-iot' | ||
import { Ipamv1 } from '@scaleway/sdk-ipam' | ||
import { Jobsv1alpha1 } from '@scaleway/sdk-jobs' | ||
import { K8sv1 } from '@scaleway/sdk-k8s' | ||
import { KeyManagerv1alpha1 } from '@scaleway/sdk-key-manager' | ||
import { Lbv1 } from '@scaleway/sdk-lb' | ||
import { Marketplacev2 } from '@scaleway/sdk-marketplace' | ||
import { Mnqv1beta1 } from '@scaleway/sdk-mnq' | ||
import { Mongodbv1alpha1 } from '@scaleway/sdk-mongodb' | ||
import { ProductCatalogv2alpha1 } from '@scaleway/sdk-product-catalog' | ||
import { Qaasv1alpha1 } from '@scaleway/sdk-qaas' | ||
import { Rdbv1 } from '@scaleway/sdk-rdb' | ||
import { Redisv1 } from '@scaleway/sdk-redis' | ||
import { Registryv1 } from '@scaleway/sdk-registry' | ||
import { Secretv1beta1 } from '@scaleway/sdk-secret' | ||
import { ServerlessSqldbv1alpha1 } from '@scaleway/sdk-serverless-sqldb' | ||
import { Temv1alpha1 } from '@scaleway/sdk-tem' | ||
import { Testv1 } from '@scaleway/sdk-test' | ||
import { Vpcv2 } from '@scaleway/sdk-vpc' | ||
import { Vpcgwv1 , Vpcgwv2 } from '@scaleway/sdk-vpcgw' | ||
import { Webhostingv1 } from '@scaleway/sdk-webhosting' | ||
|
||
export { Accountv3 } | ||
export const Account = { | ||
v3: Accountv3, | ||
} | ||
|
||
export { Applesiliconv1alpha1 } | ||
export const Applesilicon = { | ||
v1alpha1: Applesiliconv1alpha1, | ||
} | ||
|
||
export { AuditTrailv1alpha1 } | ||
export const AuditTrail = { | ||
v1alpha1: AuditTrailv1alpha1, | ||
} | ||
|
||
export { Baremetalv1, Baremetalv3 } | ||
export const Baremetal = { | ||
v1: Baremetalv1, | ||
v3: Baremetalv3, | ||
} | ||
|
||
export { Billingv2beta1 } | ||
export const Billing = { | ||
v2beta1: Billingv2beta1, | ||
} | ||
|
||
export { Blockv1, Blockv1alpha1 } | ||
export const Block = { | ||
v1: Blockv1, | ||
v1alpha1: Blockv1alpha1, | ||
} | ||
|
||
export { Cockpitv1 } | ||
export const Cockpit = { | ||
v1: Cockpitv1, | ||
} | ||
|
||
export { Containerv1beta1 } | ||
export const Container = { | ||
v1beta1: Containerv1beta1, | ||
} | ||
|
||
export { Dediboxv1 } | ||
export const Dedibox = { | ||
v1: Dediboxv1, | ||
} | ||
|
||
export { Domainv2beta1 } | ||
export const Domain = { | ||
v2beta1: Domainv2beta1, | ||
} | ||
|
||
export { EdgeServicesv1beta1 } | ||
export const EdgeServices = { | ||
v1beta1: EdgeServicesv1beta1, | ||
} | ||
|
||
export { Filev1alpha1 } | ||
export const File = { | ||
v1alpha1: Filev1alpha1, | ||
} | ||
|
||
export { Flexibleipv1alpha1 } | ||
export const Flexibleip = { | ||
v1alpha1: Flexibleipv1alpha1, | ||
} | ||
|
||
export { Functionv1beta1 } | ||
export const Function = { | ||
v1beta1: Functionv1beta1, | ||
} | ||
|
||
export { Iamv1alpha1 } | ||
export const Iam = { | ||
v1alpha1: Iamv1alpha1, | ||
} | ||
|
||
export { Inferencev1, Inferencev1beta1 } | ||
export const Inference = { | ||
v1: Inferencev1, | ||
v1beta1: Inferencev1beta1, | ||
} | ||
|
||
export { Instancev1 } | ||
export const Instance = { | ||
v1: Instancev1, | ||
} | ||
|
||
export { Interlinkv1beta1 } | ||
export const Interlink = { | ||
v1beta1: Interlinkv1beta1, | ||
} | ||
|
||
export { Iotv1 } | ||
export const Iot = { | ||
v1: Iotv1, | ||
} | ||
|
||
export { Ipamv1 } | ||
export const Ipam = { | ||
v1: Ipamv1, | ||
} | ||
|
||
export { Jobsv1alpha1 } | ||
export const Jobs = { | ||
v1alpha1: Jobsv1alpha1, | ||
} | ||
|
||
export { K8sv1 } | ||
export const K8s = { | ||
v1: K8sv1, | ||
} | ||
|
||
export { KeyManagerv1alpha1 } | ||
export const KeyManager = { | ||
v1alpha1: KeyManagerv1alpha1, | ||
} | ||
|
||
export { Lbv1 } | ||
export const Lb = { | ||
v1: Lbv1, | ||
} | ||
|
||
export { Marketplacev2 } | ||
export const Marketplace = { | ||
v2: Marketplacev2, | ||
} | ||
|
||
export { Mnqv1beta1 } | ||
export const Mnq = { | ||
v1beta1: Mnqv1beta1, | ||
} | ||
|
||
export { Mongodbv1alpha1 } | ||
export const Mongodb = { | ||
v1alpha1: Mongodbv1alpha1, | ||
} | ||
|
||
export { ProductCatalogv2alpha1 } | ||
export const ProductCatalog = { | ||
v2alpha1: ProductCatalogv2alpha1, | ||
} | ||
|
||
export { Qaasv1alpha1 } | ||
export const Qaas = { | ||
v1alpha1: Qaasv1alpha1, | ||
} | ||
|
||
export { Rdbv1 } | ||
export const Rdb = { | ||
v1: Rdbv1, | ||
} | ||
|
||
export { Redisv1 } | ||
export const Redis = { | ||
v1: Redisv1, | ||
} | ||
|
||
export { Registryv1 } | ||
export const Registry = { | ||
v1: Registryv1, | ||
} | ||
|
||
export { Secretv1beta1 } | ||
export const Secret = { | ||
v1beta1: Secretv1beta1, | ||
} | ||
|
||
export { ServerlessSqldbv1alpha1 } | ||
export const ServerlessSqldb = { | ||
v1alpha1: ServerlessSqldbv1alpha1, | ||
} | ||
|
||
export { Temv1alpha1 } | ||
export const Tem = { | ||
v1alpha1: Temv1alpha1, | ||
} | ||
|
||
export { Testv1 } | ||
export const Test = { | ||
v1: Testv1, | ||
} | ||
|
||
export { Vpcv2 } | ||
export const Vpc = { | ||
v2: Vpcv2, | ||
} | ||
|
||
export { Vpcgwv1, Vpcgwv2 } | ||
export const Vpcgw = { | ||
v1: Vpcgwv1, | ||
v2: Vpcgwv2, | ||
} | ||
|
||
export { Webhostingv1 } | ||
export const Webhosting = { | ||
v1: Webhostingv1, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { readdirSync, statSync, writeFileSync } from 'fs' | ||
import { join } from 'path' | ||
philibea marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const GENERATED_PATH = 'packages_generated' | ||
const OUTPUT_PATH = 'packages/sdk/src/index.ts' | ||
|
||
const toPascal = (s: string) => | ||
s | ||
.split(/[_-]/) | ||
.map(part => part.charAt(0).toUpperCase() + part.slice(1)) | ||
.join('') | ||
|
||
const toSlug = (s: string) => s.replace(/_/g, '-') | ||
|
||
const services = readdirSync(GENERATED_PATH).filter(folder => { | ||
const fullPath = join(GENERATED_PATH, folder) | ||
|
||
return statSync(fullPath).isDirectory() | ||
}) | ||
|
||
let output = `/* Auto-generated. Do not edit manually. */\n\n` | ||
|
||
for (const service of services) { | ||
const slug = toSlug(service) // ex. "audit-trail" | ||
const pascal = toPascal(service) // ex. "AuditTrail" | ||
const srcPath = join(GENERATED_PATH, service, 'src') | ||
|
||
let versions: string[] = [] | ||
try { | ||
versions = readdirSync(srcPath).filter(vFolder => { | ||
const vPath = join(srcPath, vFolder) | ||
|
||
return statSync(vPath).isDirectory() && /^v[0-9a-z]+$/i.test(vFolder) | ||
}) | ||
} catch { | ||
console.warn(`⚠️ Pas de dossier 'src' pour ${service}, ignoré.`) | ||
// eslint-disable-next-line no-continue | ||
continue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think we should throw an error instead |
||
} | ||
// eslint-disable-next-line no-continue | ||
if (versions.length === 0) continue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not usefull ? |
||
|
||
const imports: string[] = [] | ||
const mappings: string[] = [] | ||
|
||
for (const version of versions) { | ||
const importName = `${pascal}${version}` // ex. AuditTrailv1alpha1 | ||
imports.push(`import { ${importName} } from '@scaleway/sdk-${slug}'`) | ||
mappings.push(` ${version}: ${importName},`) | ||
} | ||
|
||
output += `${imports.join('\n')}\n\n` | ||
const importedNames = imports | ||
.map(line => /{ (.*?) }/.exec(line)![1]) | ||
.join(', ') | ||
output += `export { ${importedNames} }\n` | ||
output += `export const ${pascal} = {\n${mappings.join('\n')}\n}\n\n` | ||
philibea marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
writeFileSync(OUTPUT_PATH, output) | ||
console.log(`✅ Fichier généré : ${OUTPUT_PATH}`) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.