Skip to content

Commit

Permalink
Merge pull request #173 from yandex-cloud/package-files
Browse files Browse the repository at this point in the history
Package files
  • Loading branch information
DavyJohnes authored Nov 20, 2024
2 parents 78a2199 + 356afc7 commit 3024996
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 4 deletions.
77 changes: 76 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,82 @@
"url": "https://github.com/yandex-cloud/nodejs-sdk/issues"
},
"files": [
"dist"
"dist",
"ai-assistants-v1",
"ai-files-v1",
"ai-foundation_models-v1",
"ai-llm-v1alpha",
"ai-ocr-v1",
"ai-stt-v2",
"ai-stt-v3",
"ai-translate-v2",
"ai-tts-v3",
"ai-vision-v1",
"ai-vision-v2",
"airflow-v1",
"apploadbalancer-v1",
"audittrails-v1",
"backup-v1",
"billing-v1",
"cdn-v1",
"certificatemanager-v1",
"cic-v1",
"cloudapps-workload-v1",
"cloudrouter-v1",
"compute-v1",
"containerregistry-v1",
"dataproc-manager-v1",
"dataproc-v1",
"datasphere-v1",
"datasphere-v2",
"datatransfer-v1",
"dns-v1",
"endpoint",
"iam-v1",
"iot-broker-v1",
"iot-devices-v1",
"k8s-marketplace-v1",
"k8s-v1",
"kms-v1",
"loadbalancer-v1",
"loadtesting-agent-v1",
"loadtesting-api-v1",
"lockbox-v1",
"logging-v1",
"marketplace-licensemanager-saas-v1",
"marketplace-licensemanager-v1",
"marketplace-metering-v1",
"marketplace-v1",
"mdb-clickhouse-v1",
"mdb-elasticsearch-v1",
"mdb-greenplum-v1",
"mdb-kafka-v1",
"mdb-mongodb-v1",
"mdb-mysql-v1",
"mdb-mysql-v1alpha",
"mdb-opensearch-v1",
"mdb-postgresql-v1",
"mdb-redis-v1",
"mdb-sqlserver-v1",
"monitoring-v3",
"operation",
"organizationmanager-v1",
"resourcemanager-v1",
"serverless-apigateway-v1",
"serverless-apigateway-websocket-v1",
"serverless-containers-v1",
"serverless-eventrouter-v1",
"serverless-functions-v1",
"serverless-mdbproxy-v1",
"serverless-triggers-v1",
"serverless-workflows-v1",
"smartcaptcha-v1",
"smartwebsecurity-v1",
"speechsense-v1",
"storage-v1",
"video-v1",
"vpc-v1",
"ydb-v1"
],
"homepage": "https://github.com/yandex-cloud/nodejs-sdk#readme",
"dependencies": {
Expand Down
17 changes: 14 additions & 3 deletions scripts/generate_services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const generateService = async (dir: string) => {

const START_SIGN = '# generate_services start';

const modidyGitignore = async (serviceList: string[]) => {
const modifyGitignore = async (serviceList: string[]) => {
const path = PATH.resolve('.gitignore');
const content = fs.readFileSync(path, 'utf8');

Expand All @@ -126,7 +126,7 @@ const modidyGitignore = async (serviceList: string[]) => {

let newContent = content.substring(0, startIdx + START_SIGN.length + 1);

serviceList.sort().forEach((service) => {
serviceList.forEach((service) => {
newContent += `/${service}\n`;
});

Expand All @@ -135,14 +135,25 @@ const modidyGitignore = async (serviceList: string[]) => {
fs.writeFileSync(path, newContent, 'utf8');
};

const modifyPackageJSON = async (serviceList: string[]) => {
const path = PATH.resolve('package.json');
const data = fs.readFileSync(path, 'utf8');
const jsonData = JSON.parse(data);

jsonData.files = ['dist', ...serviceList];

fs.writeFileSync(path, JSON.stringify(jsonData, null, 2) + '\n', 'utf8');
};

const main = async () => {
const serviceMap = await detectRootServices(YANDEX_CLOUD_DIR);

writeToFile(serviceMap);

const serviceList = await Promise.all(Object.keys(serviceMap).map(generateService));
serviceList.sort();

await modidyGitignore(serviceList);
await Promise.all([modifyGitignore(serviceList), modifyPackageJSON(serviceList)]);
};

if (require.main === module) {
Expand Down

0 comments on commit 3024996

Please sign in to comment.