Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit cc0bd0b

Browse files
committed
feat(shared-utils):env support get def_publish_env
1 parent 293e110 commit cc0bd0b

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

‎packages/shared-utils/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alicloud/console-toolkit-shared-utils",
3-
"version": "1.2.30",
3+
"version": "1.3.0",
44
"description": "console toolkit shared utils functions",
55
"scripts": {
66
"ci": "npm run lint && npm run compile && npm run cov",
@@ -18,6 +18,7 @@
1818
"@types/jest": "^24.0.18",
1919
"@types/lodash": "^4.14.116",
2020
"@types/node": "^12.7.5",
21+
"@types/yargs-parser": "^21.0.3",
2122
"chai": "^4.2.0",
2223
"jest": "^24.2.0-alpha.0",
2324
"ts-jest": "^24.0.0",
@@ -33,7 +34,8 @@
3334
"chokidar": "^3.0.2",
3435
"debug": "^4.0.1",
3536
"fs-extra": "^8.1.0",
36-
"lodash": "^4.17.11"
37+
"lodash": "^4.17.11",
38+
"yargs-parser": "^21.1.1"
3739
},
3840
"main": "lib/index.js",
3941
"author": "boelroy <boelroy@live.com>",

‎packages/shared-utils/src/env.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import parser from 'yargs-parser';
12
import { Evnrioment, BuildType } from "./type";
23

34
export function getEnv(): Evnrioment {
@@ -91,6 +92,9 @@ export function getEnv(): Evnrioment {
9192
default:
9293
}
9394

95+
const buildArgvParsed = parser(process.env.BUILD_ARGV_STR || '');
96+
const publishEnv = buildArgvParsed['def_publish_env'];
97+
9498
return {
9599
gitGroup,
96100
gitProject,
@@ -105,6 +109,7 @@ export function getEnv(): Evnrioment {
105109
workingDir,
106110
buildEnv,
107111
buildType,
112+
publishEnv,
108113
isProd () {
109114
return (buildType & BuildType.Prod) > 0;
110115
},

‎packages/shared-utils/src/type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface Evnrioment {
3232
workingDir?: string;
3333
buildEnv?: string;
3434
buildType: BuildType;
35+
publishEnv?: string; // daily or prod
3536
isProd: () => boolean;
3637
isDev: () => boolean;
3738
isCloudBuild: () => boolean;

‎packages/shared-utils/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
/* Strict Type-Checking Option */
1515
"strict": true, /* enable all strict type-checking options */
1616
/* Additional Checks */
17-
"noUnusedLocals": true /* Report errors on unused locals. */
17+
"noUnusedLocals": true, /* Report errors on unused locals. */
1818
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
1919
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
2020
// "noUnusedParameters": true, /* Report errors on unused parameters. */
21+
"esModuleInterop": true,
2122
},
2223
"exclude": [
2324
"test",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /