Skip to content

Commit

Permalink
fix:sls projectName
Browse files Browse the repository at this point in the history
  • Loading branch information
mozhou52 committed Oct 23, 2024
1 parent 5e4e464 commit 01c5767
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 14 deletions.
2 changes: 1 addition & 1 deletion __tests__/ut/resources_acr_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('Sls', () => {
const uid = 'uid';

const result = Sls.generateProjectName(region, uid);
expect(result).toEqual(`aliyun-serverless-uid-cn-hangzhou`);
expect(result).toEqual(`serverless-cn-hangzhou-e2577dd7-8b54-5e28-865e-e56ffbc8bb73`);
});
});

Expand Down
61 changes: 51 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@alicloud/pop-core": "^1.7.13",
"@serverless-cd/srm-aliyun-pop-core": "^0.0.7-beta.16",
"@serverless-cd/srm-aliyun-ram20150501": "^0.0.2-beta.9",
"@serverless-cd/srm-aliyun-sls20201230": "0.0.4",
"@serverless-cd/srm-aliyun-sls20201230": "0.0.4-beta.1",
"@serverless-devs/diff": "^0.0.3-beta.6",
"@serverless-devs/downloads": "^0.0.6",
"@serverless-devs/load-component": "^0.0.8",
Expand All @@ -51,7 +51,8 @@
"string-random": "^0.1.3",
"temp-dir": "^2.0.0",
"tty-table": "^4.2.3",
"uuid": "^9.0.1"
"uuid": "^9.0.1",
"uuid-by-string": "^4.0.0"
},
"devDependencies": {
"@serverless-devs/component-interface": "^0.0.6",
Expand Down
3 changes: 2 additions & 1 deletion src/resources/sls/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { Config } from '@alicloud/openapi-client';
import { IRegion } from '../../interface';
import { PROJECT, LOG_STORE } from '../../default/resources';
import logger from '../../logger';
import getUuid from 'uuid-by-string';

export default class Sls {
static generateProjectName = (region: IRegion, accountID: string): string =>
PROJECT || `aliyun-serverless-${accountID}-${region}`;
PROJECT || `serverless-${region}-${getUuid(accountID)}`;
static generateLogstoreName = (): string => {
return LOG_STORE;
};
Expand Down

0 comments on commit 01c5767

Please sign in to comment.