@takeshape/cli 8.251.2 → 8.255.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/branch/commands/tag-version.d.ts +2 -0
- package/dist/commands/branch/commands/tag-version.d.ts.map +1 -0
- package/dist/commands/branch/commands/tag-version.js +59 -0
- package/dist/commands/branch/commands/url.d.ts +1 -1
- package/dist/commands/branch/commands/url.d.ts.map +1 -1
- package/dist/commands/branch/commands/url.js +57 -17
- package/dist/commands/branch/index.d.ts.map +1 -1
- package/dist/commands/branch/index.js +5 -2
- package/dist/commands/import/schema-import.d.ts.map +1 -1
- package/dist/commands/import/schema-import.js +14 -1
- package/dist/files.d.ts +1 -2
- package/dist/files.d.ts.map +1 -1
- package/dist/index.js +19 -8
- package/dist/options.d.ts +6 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +6 -0
- package/package.json +8 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-version.d.ts","sourceRoot":"","sources":["../../../../../src/commands/branch/commands/tag-version.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,gBAAgB,kCAsB3B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tagBranchVersion = void 0;
|
|
7
|
+
|
|
8
|
+
var _linkedCommand = require("../../../util/linked-command");
|
|
9
|
+
|
|
10
|
+
var _graphql = require("../../../graphql");
|
|
11
|
+
|
|
12
|
+
var _branches = require("../../../util/branches");
|
|
13
|
+
|
|
14
|
+
var _fatalError = require("../../../util/fatal-error");
|
|
15
|
+
|
|
16
|
+
const createBranchTag = (0, _graphql.graphQLQuery)(
|
|
17
|
+
/* GraphQL */
|
|
18
|
+
`
|
|
19
|
+
mutation ($input: TSCreateSchemaBranchTagInput!) {
|
|
20
|
+
result: tsCreateSchemaBranchTag(input: $input) {
|
|
21
|
+
branchVersion {
|
|
22
|
+
graphqlUrl
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`);
|
|
27
|
+
const tagBranchVersion = (0, _linkedCommand.loggedInAndLinkedCommand)(async (cli, params) => {
|
|
28
|
+
const {
|
|
29
|
+
branch,
|
|
30
|
+
environment
|
|
31
|
+
} = (0, _branches.getBranchParams)(cli, 'name');
|
|
32
|
+
const {
|
|
33
|
+
flags
|
|
34
|
+
} = cli;
|
|
35
|
+
const {
|
|
36
|
+
tag,
|
|
37
|
+
hash
|
|
38
|
+
} = flags;
|
|
39
|
+
|
|
40
|
+
if (!tag) {
|
|
41
|
+
return (0, _fatalError.fatalError)('--tag flag is required');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const client = (0, _graphql.createAdminConnector)(params, params.authToken, params.projectId);
|
|
45
|
+
const {
|
|
46
|
+
branchVersion: {
|
|
47
|
+
graphqlUrl
|
|
48
|
+
}
|
|
49
|
+
} = await createBranchTag(client, {
|
|
50
|
+
input: {
|
|
51
|
+
environment,
|
|
52
|
+
branchName: branch,
|
|
53
|
+
tagName: tag,
|
|
54
|
+
schemaHash: hash
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
process.stdout.write(graphqlUrl);
|
|
58
|
+
});
|
|
59
|
+
exports.tagBranchVersion = tagBranchVersion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../../src/commands/branch/commands/url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../../src/commands/branch/commands/url.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,aAAa,kCAqBxB,CAAC;AAEH,eAAO,MAAM,MAAM,kCAcjB,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getVersionUrl = exports.getUrl = void 0;
|
|
7
7
|
|
|
8
8
|
var _linkedCommand = require("../../../util/linked-command");
|
|
9
9
|
|
|
@@ -11,34 +11,74 @@ var _graphql = require("../../../graphql");
|
|
|
11
11
|
|
|
12
12
|
var _branches = require("../../../util/branches");
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
var _fatalError = require("../../../util/fatal-error");
|
|
15
|
+
|
|
16
|
+
const getBranchVersionQuery = (0, _graphql.graphQLQuery)(
|
|
17
|
+
/* GraphQL */
|
|
18
|
+
`
|
|
19
|
+
query ($environment: TSSchemaBranchEnvironment!, $branchName: String, $tagName: String, $schemaHash: String) {
|
|
20
|
+
result: tsGetSchemaBranchVersion(
|
|
21
|
+
environment: $environment
|
|
22
|
+
branchName: $branchName
|
|
23
|
+
tagName: $tagName
|
|
24
|
+
schemaHash: $schemaHash
|
|
25
|
+
) {
|
|
18
26
|
graphqlUrl
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
|
-
}
|
|
22
29
|
`);
|
|
23
|
-
const
|
|
30
|
+
const getBranchQuery = (0, _graphql.graphQLQuery)(
|
|
31
|
+
/* GraphQL */
|
|
32
|
+
`
|
|
33
|
+
query ($environment: TSSchemaBranchEnvironment!, $branchName: String) {
|
|
34
|
+
result: tsGetSchemaBranch(environment: $environment, branchName: $branchName) {
|
|
35
|
+
graphqlUrl
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`);
|
|
39
|
+
const getVersionUrl = (0, _linkedCommand.loggedInAndLinkedCommand)(async (cli, params) => {
|
|
24
40
|
const {
|
|
25
41
|
branch,
|
|
26
42
|
environment
|
|
27
43
|
} = (0, _branches.getBranchParams)(cli, 'name');
|
|
28
|
-
const client = (0, _graphql.createAdminConnector)(params, params.authToken, params.projectId);
|
|
29
44
|
const {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
flags
|
|
46
|
+
} = cli;
|
|
47
|
+
|
|
48
|
+
if (flags.tag && flags.hash) {
|
|
49
|
+
return (0, _fatalError.fatalError)('Can only provide one of: --tag OR --hash');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const client = (0, _graphql.createAdminConnector)(params, params.authToken, params.projectId);
|
|
53
|
+
const result = await getBranchVersionQuery(client, {
|
|
34
54
|
environment,
|
|
35
|
-
branchName: branch
|
|
55
|
+
branchName: branch,
|
|
56
|
+
tagName: flags.tag,
|
|
57
|
+
schemaHash: flags.hash
|
|
36
58
|
});
|
|
37
|
-
|
|
59
|
+
|
|
60
|
+
if (!result) {
|
|
61
|
+
return (0, _fatalError.fatalError)('Branch does not exist');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
process.stdout.write(result.graphqlUrl);
|
|
38
65
|
});
|
|
39
|
-
exports.
|
|
66
|
+
exports.getVersionUrl = getVersionUrl;
|
|
40
67
|
const getUrl = (0, _linkedCommand.loggedInAndLinkedCommand)(async (cli, params) => {
|
|
41
|
-
const
|
|
42
|
-
|
|
68
|
+
const {
|
|
69
|
+
branch,
|
|
70
|
+
environment
|
|
71
|
+
} = (0, _branches.getBranchParams)(cli, 'name');
|
|
72
|
+
const client = (0, _graphql.createAdminConnector)(params, params.authToken, params.projectId);
|
|
73
|
+
const result = await getBranchQuery(client, {
|
|
74
|
+
environment,
|
|
75
|
+
branchName: branch
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (!result) {
|
|
79
|
+
return (0, _fatalError.fatalError)('Branch does not exist');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
process.stdout.write(result.graphqlUrl);
|
|
43
83
|
});
|
|
44
84
|
exports.getUrl = getUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/branch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/branch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AAmBpC,QAAA,MAAM,cAAc,EAAE,OAQrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -17,13 +17,16 @@ var _url = require("./commands/url");
|
|
|
17
17
|
|
|
18
18
|
var _list = require("./commands/list");
|
|
19
19
|
|
|
20
|
+
var _tagVersion = require("./commands/tag-version");
|
|
21
|
+
|
|
20
22
|
const subcommands = {
|
|
21
23
|
delete: _delete.deleteBranch,
|
|
22
24
|
create: _create.createBranch,
|
|
23
25
|
promote: _promote.promoteBranch,
|
|
24
26
|
url: _url.getUrl,
|
|
25
|
-
|
|
26
|
-
list: _list.listBranches
|
|
27
|
+
versionUrl: _url.getVersionUrl,
|
|
28
|
+
list: _list.listBranches,
|
|
29
|
+
tagVersion: _tagVersion.tagBranchVersion
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
const commandHandler = async (cli, params) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-import.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/schema-import.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"schema-import.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/schema-import.ts"],"names":[],"mappings":";AAsBA,wBAyCG"}
|
|
@@ -25,6 +25,8 @@ var _fs = require("../../util/fs");
|
|
|
25
25
|
|
|
26
26
|
var _branches = require("../../util/branches");
|
|
27
27
|
|
|
28
|
+
var _url = require("url");
|
|
29
|
+
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
31
|
|
|
30
32
|
/*
|
|
@@ -58,6 +60,17 @@ var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
const branchParams = (0, _branches.getBranchParams)(cli);
|
|
63
|
+
const queryParams = {
|
|
64
|
+
force: 'true'
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
if (flags.preserveAuth) {
|
|
68
|
+
queryParams.preserveAuth = 'true';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (flags.tag) {
|
|
72
|
+
queryParams.tag = flags.tag;
|
|
73
|
+
}
|
|
61
74
|
|
|
62
75
|
try {
|
|
63
76
|
const newSchema = JSON.parse(_fsExtra.default.readFileSync(file).toString());
|
|
@@ -70,7 +83,7 @@ var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
|
|
|
70
83
|
}
|
|
71
84
|
|
|
72
85
|
(0, _log.default)(`Uploading schema from ${file}…\n`);
|
|
73
|
-
const schemaImportPath = `${(0, _branches.getBranchBasePath)(branchParams, projectId)}/schema
|
|
86
|
+
const schemaImportPath = `${(0, _branches.getBranchBasePath)(branchParams, projectId)}/schema?${new _url.URLSearchParams(queryParams)}`;
|
|
74
87
|
const uploaded = await (0, _api.default)(params, 'POST', schemaImportPath, newSchema);
|
|
75
88
|
(0, _log.default)(_chalk.default.green('Success!'), `Schema updated to version ${uploaded.version}.`);
|
|
76
89
|
process.exit(0);
|
package/dist/files.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export function copyStatic(config: any): Promise<void>;
|
|
2
2
|
export function syncStatic(config: any): (event: any, sourcePath: any) => void;
|
|
3
|
-
export function writePages(outputPath: any): (generated: any) =>
|
|
4
|
-
import BbPromise from "bluebird";
|
|
3
|
+
export function writePages(outputPath: any): (generated: any) => any;
|
|
5
4
|
//# sourceMappingURL=files.d.ts.map
|
package/dist/files.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/files.js"],"names":[],"mappings":"AAKA,uDAIC;AAED,+EAgBC;AAED,
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/files.js"],"names":[],"mappings":"AAKA,uDAIC;AAED,+EAgBC;AAED,qEAOC"}
|
package/dist/index.js
CHANGED
|
@@ -33,12 +33,17 @@ const help = `
|
|
|
33
33
|
validate
|
|
34
34
|
|
|
35
35
|
branch Subcommands
|
|
36
|
-
list
|
|
37
|
-
create
|
|
38
|
-
delete
|
|
39
|
-
promote
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
list list all branches
|
|
37
|
+
create create a branch
|
|
38
|
+
delete delete a branch
|
|
39
|
+
promote promote a branch to production and delete that branch
|
|
40
|
+
versionUrl get the hashed url pinned to a version the GraphQL API
|
|
41
|
+
url get the url to the GraphQL API
|
|
42
|
+
tagVersion tag a schema version — if no --hash is provided it will tag
|
|
43
|
+
the latest version this command is idempotent — if you run
|
|
44
|
+
it multiple time with the same tag and no hash specified it
|
|
45
|
+
will return the versioned API URL for the existing tag and
|
|
46
|
+
will not create a new one
|
|
42
47
|
|
|
43
48
|
Examples
|
|
44
49
|
$ takeshape build --file path/to/tsg.yml
|
|
@@ -47,6 +52,7 @@ const help = `
|
|
|
47
52
|
$ takeshape branch delete --name my-feature
|
|
48
53
|
$ takeshape branch promote --name my-feature
|
|
49
54
|
$ takeshape branch url --production
|
|
55
|
+
$ takeshape branch tagVersion --name my-feature --tag my-tag
|
|
50
56
|
|
|
51
57
|
Options
|
|
52
58
|
--token, -t TakeShape API auth token
|
|
@@ -65,8 +71,12 @@ const help = `
|
|
|
65
71
|
--development specify the development environment, this is the default when --branch is specified
|
|
66
72
|
--scratch specify the scratch environment
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
Only for the tagVersion and url commands
|
|
75
|
+
--tag tag to apply to a branch version
|
|
76
|
+
--hash (optional) which version to hash — if not specified will tag the latest
|
|
77
|
+
|
|
78
|
+
--branch use with non-branch commands to specify the branch name, required when using --development
|
|
79
|
+
--name use with branch commands to specify the branch name, required when using --development
|
|
70
80
|
|
|
71
81
|
import Options
|
|
72
82
|
One of
|
|
@@ -78,6 +88,7 @@ const help = `
|
|
|
78
88
|
--to either "new-project" or "current-project" (default "new-project")
|
|
79
89
|
--name for use with --project specifies a new name for the imported project
|
|
80
90
|
--preserveAuth do not overwrite service authentication
|
|
91
|
+
--tag apply a tag to the imported version
|
|
81
92
|
|
|
82
93
|
export Options
|
|
83
94
|
One of
|
package/dist/options.d.ts
CHANGED
|
@@ -72,6 +72,12 @@ export declare const options: {
|
|
|
72
72
|
readonly preserveAuth: {
|
|
73
73
|
readonly type: "boolean";
|
|
74
74
|
};
|
|
75
|
+
readonly tag: {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
};
|
|
78
|
+
readonly hash: {
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
};
|
|
75
81
|
};
|
|
76
82
|
};
|
|
77
83
|
export declare type Flags = typeof options.flags;
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,MAAM,CAAC;AAE5B,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,MAAM,CAAC;AAE5B,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFV,CAAC;AAEX,oBAAY,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,CAAC;AACzC,oBAAY,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,GAAG;IAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;CAAC,CAAC"}
|
package/dist/options.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.255.8",
|
|
4
4
|
"description": "TakeShape CLI",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -25,10 +25,6 @@
|
|
|
25
25
|
"@graphql-codegen/typescript": "^2.4.5",
|
|
26
26
|
"@graphql-tools/graphql-file-loader": "^7.3.3",
|
|
27
27
|
"@graphql-tools/load": "^7.5.1",
|
|
28
|
-
"@takeshape/schema": "8.251.2",
|
|
29
|
-
"@takeshape/ssg": "8.251.2",
|
|
30
|
-
"@takeshape/streams": "8.251.2",
|
|
31
|
-
"@takeshape/util": "8.251.2",
|
|
32
28
|
"archiver": "^1.3.0",
|
|
33
29
|
"async-retry": "^1.2.1",
|
|
34
30
|
"bluebird": "^3.4.6",
|
|
@@ -60,7 +56,11 @@
|
|
|
60
56
|
"request": "^2.88.0",
|
|
61
57
|
"semver": "^6.3.0",
|
|
62
58
|
"stream-to-promise": "^2.2.0",
|
|
63
|
-
"tmp": "^0.0.33"
|
|
59
|
+
"tmp": "^0.0.33",
|
|
60
|
+
"@takeshape/schema": "8.255.8",
|
|
61
|
+
"@takeshape/ssg": "8.255.8",
|
|
62
|
+
"@takeshape/streams": "8.255.8",
|
|
63
|
+
"@takeshape/util": "8.255.8"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/archiver": "^3.1.0",
|
|
@@ -94,8 +94,7 @@
|
|
|
94
94
|
"build:types": "tsc --emitDeclarationOnly --project tsconfig.build.json",
|
|
95
95
|
"build:js": "cross-env BABEL_MODULES=commonjs babel src --out-dir dist --extensions \".js,.ts\" --ignore '**/__tests__'",
|
|
96
96
|
"build:copy": "cp -rf build/src/* dist/",
|
|
97
|
-
"will-it-blend": "pnpm typecheck && pnpm lint --
|
|
97
|
+
"will-it-blend": "pnpm typecheck && pnpm lint --quiet && pnpm test --silent --coverage false",
|
|
98
98
|
"todo": "leasot 'src/**/*.{js,jsx,ts,tsx}'"
|
|
99
|
-
}
|
|
100
|
-
"readme": "# TakeShape CLI\n\n## Summary\n\nThis is the command-line interface for [TakeShape](https://takeshape.io).\n\n## Documentation\n\nhttps://app.takeshape.io/docs/\n"
|
|
99
|
+
}
|
|
101
100
|
}
|