neonctl 1.28.0 → 1.29.1
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/.bump +1 -0
- package/.editorconfig +7 -0
- package/.eslintrc.cjs +15 -0
- package/.github/workflows/commitlint.yml +46 -0
- package/.github/workflows/pr.yml +25 -0
- package/.github/workflows/release.yml +30 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.nvmrc +1 -0
- package/.prettierignore +3 -0
- package/.prettierrc.json +3 -0
- package/.releaserc.json +47 -0
- package/LICENSE +202 -0
- package/commitlint.config.cjs +7 -0
- package/generateOptionsFromSpec.ts +68 -0
- package/jest/setup.js +5 -0
- package/jest.config.ts +199 -0
- package/mocks/bin/psql.cjs +9 -0
- package/mocks/main/projects/GET.js +27 -0
- package/mocks/main/projects/POST.js +22 -0
- package/mocks/main/projects/shared/GET.js +16 -0
- package/mocks/main/projects/test/DELETE.json +7 -0
- package/mocks/main/projects/test/GET.json +13 -0
- package/mocks/main/projects/test/PATCH.js +18 -0
- package/mocks/main/projects/test/branches/GET.json +25 -0
- package/mocks/main/projects/test/branches/POST.js +83 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/DELETE.json +7 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/GET.json +9 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/PATCH.js +14 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/databases/GET.json +6 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/databases/POST.js +13 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/databases/test_db/DELETE.json +6 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/endpoints/GET.json +26 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/endpoints/POST.json +6 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/roles/GET.json +3 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/roles/POST.js +14 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/roles/test_role/DELETE.json +6 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/roles/test_role/reveal_password/GET.json +3 -0
- package/mocks/main/projects/test/branches/br-cloudy-branch-12345678/set_as_primary/POST.json +9 -0
- package/mocks/main/projects/test/branches/br-numbered-branch-123456/GET.json +10 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/DELETE.json +7 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/GET.json +10 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/PATCH.js +14 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/databases/GET.json +6 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/databases/POST.js +13 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/databases/test_db/DELETE.json +6 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/endpoints/GET.json +26 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/endpoints/POST.json +6 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/restore/POST.js +16 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/roles/GET.json +3 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/roles/POST.js +14 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/roles/test_role/DELETE.json +6 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/roles/test_role/reveal_password/GET.json +3 -0
- package/mocks/main/projects/test/branches/br-sunny-branch-123456/set_as_primary/POST.json +9 -0
- package/mocks/main/projects/test/endpoints/GET.json +9 -0
- package/mocks/main/projects/test/endpoints/POST.js +32 -0
- package/mocks/main/projects/test/endpoints/test_endpoint_id/DELETE.json +7 -0
- package/mocks/main/projects/test/endpoints/test_endpoint_id/GET.json +9 -0
- package/mocks/main/projects/test/endpoints/test_endpoint_id/PATCH.js +17 -0
- package/mocks/main/projects/test/operations/GET.json +22 -0
- package/mocks/main/users/me/GET.json +5 -0
- package/mocks/restore/projects/test/branches/GET.json +21 -0
- package/mocks/restore/projects/test/branches/br-another-branch-123456/GET.json +6 -0
- package/mocks/restore/projects/test/branches/br-another-branch-123456/restore/POST.js +13 -0
- package/mocks/restore/projects/test/branches/br-any-branch-123456/GET.json +6 -0
- package/mocks/restore/projects/test/branches/br-parent-tots-123456/GET.json +7 -0
- package/mocks/restore/projects/test/branches/br-parent-tots-123456/restore/POST.js +14 -0
- package/mocks/restore/projects/test/branches/br-self-tolsn-123456/GET.json +6 -0
- package/mocks/restore/projects/test/branches/br-self-tolsn-123456/restore/POST.js +15 -0
- package/mocks/single_project/projects/GET.json +10 -0
- package/mocks/single_project/projects/test-project-123456/GET.json +14 -0
- package/mocks/single_project/projects/test-project-123456/branches/GET.json +11 -0
- package/mocks/single_project/projects/test-project-123456/branches/br-main-branch-123456/databases/GET.json +3 -0
- package/mocks/single_project/projects/test-project-123456/branches/br-main-branch-123456/endpoints/GET.json +10 -0
- package/mocks/single_project/projects/test-project-123456/branches/br-main-branch-123456/roles/GET.json +3 -0
- package/mocks/single_project/projects/test-project-123456/branches/br-main-branch-123456/roles/test_role/reveal_password/GET.json +3 -0
- package/package.json +6 -5
- package/pkg.js +45 -3
- package/rollup.config.js +20 -0
- package/snapshots/commands/branches.test.snap +221 -0
- package/snapshots/commands/connection_string.test.snap +70 -0
- package/snapshots/commands/databases.test.snap +20 -0
- package/snapshots/commands/ip_allow.test.snap +55 -0
- package/snapshots/commands/operations.test.snap +17 -0
- package/snapshots/commands/projects.test.snap +141 -0
- package/snapshots/commands/roles.test.snap +19 -0
- package/snapshots/commands/set_context.test.snap +30 -0
- package/snapshots/writer.test.snap +60 -0
- package/snapshotsResolver.cjs +32 -0
- package/src/analytics.ts +95 -0
- package/src/api.ts +44 -0
- package/src/auth.ts +137 -0
- package/{cli.js → src/cli.ts} +1 -0
- package/src/commands/auth.test.ts +62 -0
- package/src/commands/auth.ts +148 -0
- package/src/commands/branches.test.ts +354 -0
- package/src/commands/branches.ts +451 -0
- package/src/commands/connection_string.test.ts +250 -0
- package/src/commands/connection_string.ts +210 -0
- package/src/commands/databases.test.ts +55 -0
- package/src/commands/databases.ts +129 -0
- package/src/commands/help.test.ts +13 -0
- package/{commands/index.js → src/commands/index.ts} +11 -10
- package/src/commands/ip_allow.test.ts +86 -0
- package/src/commands/ip_allow.ts +202 -0
- package/src/commands/operations.test.ts +13 -0
- package/src/commands/operations.ts +41 -0
- package/src/commands/projects.test.ts +147 -0
- package/src/commands/projects.ts +275 -0
- package/src/commands/roles.test.ts +46 -0
- package/src/commands/roles.ts +100 -0
- package/src/commands/set_context.test.ts +64 -0
- package/src/commands/set_context.ts +27 -0
- package/src/commands/user.ts +21 -0
- package/src/config.ts +22 -0
- package/src/context.ts +61 -0
- package/src/env.ts +7 -0
- package/src/errors.ts +24 -0
- package/src/help.ts +185 -0
- package/src/index.ts +180 -0
- package/src/log.ts +16 -0
- package/src/parameters.gen.ts +332 -0
- package/src/pkg.ts +9 -0
- package/src/test_utils/mock_server.ts +27 -0
- package/src/test_utils/oauth_server.ts +10 -0
- package/src/test_utils/test_cli_command.ts +117 -0
- package/src/types.ts +25 -0
- package/src/utils/enrichers.ts +73 -0
- package/src/utils/formats.test.ts +41 -0
- package/src/utils/formats.ts +11 -0
- package/src/utils/middlewares.ts +23 -0
- package/src/utils/point_in_time.ts +86 -0
- package/src/utils/psql.ts +29 -0
- package/src/utils/string.ts +8 -0
- package/src/utils/ui.ts +64 -0
- package/src/writer.test.ts +98 -0
- package/src/writer.ts +131 -0
- package/tsconfig.json +17 -0
- package/analytics.js +0 -78
- package/api.js +0 -35
- package/auth.js +0 -101
- package/commands/auth.js +0 -102
- package/commands/auth.test.js +0 -42
- package/commands/branches.js +0 -303
- package/commands/branches.test.js +0 -321
- package/commands/connection_string.js +0 -137
- package/commands/connection_string.test.js +0 -204
- package/commands/databases.js +0 -79
- package/commands/databases.test.js +0 -51
- package/commands/help.test.js +0 -11
- package/commands/ip_allow.js +0 -135
- package/commands/ip_allow.test.js +0 -78
- package/commands/operations.js +0 -28
- package/commands/operations.test.js +0 -11
- package/commands/projects.js +0 -170
- package/commands/projects.test.js +0 -132
- package/commands/roles.js +0 -57
- package/commands/roles.test.js +0 -42
- package/commands/set_context.js +0 -22
- package/commands/set_context.test.js +0 -53
- package/commands/user.js +0 -15
- package/config.js +0 -11
- package/context.js +0 -48
- package/env.js +0 -6
- package/errors.js +0 -16
- package/help.js +0 -146
- package/index.js +0 -168
- package/log.js +0 -15
- package/parameters.gen.js +0 -322
- package/test_utils/mock_server.js +0 -16
- package/test_utils/oauth_server.js +0 -9
- package/test_utils/test_cli_command.js +0 -80
- package/types.js +0 -1
- package/utils/enrichers.js +0 -49
- package/utils/formats.js +0 -5
- package/utils/formats.test.js +0 -32
- package/utils/middlewares.js +0 -20
- package/utils/point_in_time.js +0 -44
- package/utils/psql.js +0 -24
- package/utils/string.js +0 -5
- package/utils/ui.js +0 -59
- package/writer.js +0 -87
- package/writer.test.js +0 -86
- /package/{callback.html → src/callback.html} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"endpoints": [
|
|
3
|
+
{
|
|
4
|
+
"host": "ep-cool-king-930914.us-east-2.aws.neon.tech",
|
|
5
|
+
"id": "ep-cool-king-930914",
|
|
6
|
+
"project_id": "test",
|
|
7
|
+
"branch_id": "br-sunny-branch-123456",
|
|
8
|
+
"type": "read_write",
|
|
9
|
+
"created_at": "2023-06-22T14:26:33Z",
|
|
10
|
+
"updated_at": "2023-06-30T04:07:32Z",
|
|
11
|
+
"proxy_host": "us-east-2.aws.neon.tech",
|
|
12
|
+
"provisioner": "k8s-pod"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"host": "ep-cool-king-933333.us-east-2.aws.neon.tech",
|
|
16
|
+
"id": "ep-cool-king-933333",
|
|
17
|
+
"project_id": "test",
|
|
18
|
+
"branch_id": "br-sunny-branch-123456",
|
|
19
|
+
"type": "read_only",
|
|
20
|
+
"created_at": "2023-06-22T14:26:33Z",
|
|
21
|
+
"updated_at": "2023-06-30T04:07:32Z",
|
|
22
|
+
"proxy_host": "us-east-2.aws.neon.tech",
|
|
23
|
+
"provisioner": "k8s-pod"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default function (req, res) {
|
|
2
|
+
expect(req.body).toEqual({
|
|
3
|
+
source_branch_id: 'br-parent-branch-123456',
|
|
4
|
+
});
|
|
5
|
+
res.status(200).json({
|
|
6
|
+
branch: {
|
|
7
|
+
id: 'br-branch-123456',
|
|
8
|
+
name: 'test-branch',
|
|
9
|
+
source_branch_id: 'br-parent-branch-123456',
|
|
10
|
+
project_id: 'pr-project-123456',
|
|
11
|
+
created_at: '2020-01-01T00:00:00.000Z',
|
|
12
|
+
updated_at: '2020-01-01T00:00:00.000Z',
|
|
13
|
+
last_reset_at: '2020-01-01T00:00:00.000Z',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
let retries = 1;
|
|
2
|
+
|
|
3
|
+
export default function (req, res) {
|
|
4
|
+
if (!req.body) {
|
|
5
|
+
res.status(400).send('Missing body');
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (req.body.endpoint.branch_id === 'test_branch_with_retry') {
|
|
9
|
+
if (retries > 0) {
|
|
10
|
+
retries -= 1;
|
|
11
|
+
res.status(423).send({ error: 'locked' });
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (req.body.endpoint.branch_id === 'test_branch_id') {
|
|
17
|
+
expect(req.body).toMatchObject({
|
|
18
|
+
endpoint: {
|
|
19
|
+
type: 'read_only',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
res.send({
|
|
25
|
+
endpoint: {
|
|
26
|
+
id: 'test_endpoint_id',
|
|
27
|
+
branch_id: req.body.endpoint.branch_id,
|
|
28
|
+
created_at: '2019-01-01T00:00:00Z',
|
|
29
|
+
type: req.body.endpoint.type,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default function (req, res) {
|
|
2
|
+
expect(req.body).toMatchObject({
|
|
3
|
+
endpoint: {
|
|
4
|
+
id: 'test_endpoint_id',
|
|
5
|
+
branch_id: 'test_branch_id',
|
|
6
|
+
},
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
res.send({
|
|
10
|
+
endpoint: {
|
|
11
|
+
id: 'test_endpoint_id',
|
|
12
|
+
branch_id: 'test_branch_id',
|
|
13
|
+
created_at: '2019-01-01T00:00:00Z',
|
|
14
|
+
type: 'read_only',
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"operations": [
|
|
3
|
+
{
|
|
4
|
+
"id": "1",
|
|
5
|
+
"action": "suspend",
|
|
6
|
+
"status": "finished",
|
|
7
|
+
"created_at": "2016-01-01T00:00:00Z"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "2",
|
|
11
|
+
"action": "suspend",
|
|
12
|
+
"status": "finished",
|
|
13
|
+
"created_at": "2016-01-01T00:00:00Z"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "3",
|
|
17
|
+
"action": "start",
|
|
18
|
+
"status": "finished",
|
|
19
|
+
"created_at": "2016-01-01T00:00:00Z"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": [
|
|
3
|
+
{
|
|
4
|
+
"id": "br-self-tolsn-123456",
|
|
5
|
+
"name": "self-tolsn-123456"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"id": "br-any-branch-123456",
|
|
9
|
+
"name": "any-branch"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": "br-parent-tots-123456",
|
|
13
|
+
"name": "parent-tots",
|
|
14
|
+
"parent_id": "br-any-branch-123456"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "br-another-branch-123456",
|
|
18
|
+
"name": "another-branch"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default function (req, res) {
|
|
2
|
+
expect(req.body).toMatchObject({
|
|
3
|
+
source_branch_id: 'br-any-branch-123456',
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
res.status(200).send({
|
|
7
|
+
branch: {
|
|
8
|
+
id: 'br-another-branch-123456',
|
|
9
|
+
name: 'another-branch',
|
|
10
|
+
last_reset_at: '2021-01-01T00:00:00Z',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default function (req, res) {
|
|
2
|
+
expect(req.body).toMatchObject({
|
|
3
|
+
source_branch_id: 'br-any-branch-123456',
|
|
4
|
+
source_timestamp: '2021-01-01T00:00:00.000Z',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
res.status(200).send({
|
|
8
|
+
branch: {
|
|
9
|
+
id: 'br-parent-tots-123456',
|
|
10
|
+
name: 'parent-tots',
|
|
11
|
+
last_reset_at: '2021-01-01T00:00:00Z',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default function (req, res) {
|
|
2
|
+
expect(req.body).toMatchObject({
|
|
3
|
+
source_branch_id: 'br-self-tolsn-123456',
|
|
4
|
+
source_lsn: '0/123ABC',
|
|
5
|
+
preserve_under_name: 'backup',
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
res.status(200).send({
|
|
9
|
+
branch: {
|
|
10
|
+
id: 'br-self-tolsn-123456',
|
|
11
|
+
name: 'self-tolsn',
|
|
12
|
+
last_reset_at: '2021-01-01T00:00:00Z',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"project": {
|
|
3
|
+
"id": "test-project-123456",
|
|
4
|
+
"name": "",
|
|
5
|
+
"created_at": "2019-01-01T00:00:00.000Z",
|
|
6
|
+
"updated_at": "2019-01-01T00:00:00.000Z",
|
|
7
|
+
"settings": {
|
|
8
|
+
"allowed_ips": {
|
|
9
|
+
"ips": ["192.168.1.1"],
|
|
10
|
+
"primary_branch_only": false
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"name": "neonctl",
|
|
3
3
|
"repository": {
|
|
4
4
|
"type": "git",
|
|
5
|
-
"url": "git@github.com
|
|
5
|
+
"url": "git+ssh://git@github.com/neondatabase/neonctl.git"
|
|
6
6
|
},
|
|
7
7
|
"type": "module",
|
|
8
|
-
"version": "1.
|
|
8
|
+
"version": "1.29.1",
|
|
9
9
|
"description": "CLI tool for NeonDB Cloud management",
|
|
10
10
|
"main": "index.js",
|
|
11
11
|
"author": "NeonDB",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"pkg": "^5.8.1",
|
|
47
47
|
"prettier": "^3.1.0",
|
|
48
48
|
"rollup": "^3.26.2",
|
|
49
|
-
"semantic-release": "^
|
|
49
|
+
"semantic-release": "^23.0.8",
|
|
50
50
|
"strip-ansi": "^7.1.0",
|
|
51
51
|
"ts-jest": "^29.1.0",
|
|
52
52
|
"ts-node": "^10.9.1",
|
|
@@ -72,7 +72,8 @@
|
|
|
72
72
|
},
|
|
73
73
|
"pkg": {
|
|
74
74
|
"assets": [
|
|
75
|
-
"callback.html"
|
|
75
|
+
"callback.html",
|
|
76
|
+
"package.json"
|
|
76
77
|
],
|
|
77
78
|
"scripts": [
|
|
78
79
|
"bundle/*.js"
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
"build": "npm run generateParams && npm run clean && tsc && cp src/*.html package*.json README.md ./dist",
|
|
92
93
|
"clean": "rm -rf dist",
|
|
93
94
|
"generateParams": "node --loader ts-node/esm ./generateOptionsFromSpec.ts",
|
|
94
|
-
"start": "node
|
|
95
|
+
"start": "node dist/index.js",
|
|
95
96
|
"pretest": "npm run build",
|
|
96
97
|
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
|
97
98
|
"prepare": "test -d .git && husky install || true"
|
package/pkg.js
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { readFileSync, writeFileSync, cpSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { rollup } from 'rollup';
|
|
5
|
+
import { exec } from 'pkg';
|
|
6
|
+
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
7
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
8
|
+
import json from '@rollup/plugin-json';
|
|
9
|
+
|
|
10
|
+
const bundle = await rollup({
|
|
11
|
+
input: 'dist/cli.js',
|
|
12
|
+
plugins: [
|
|
13
|
+
nodeResolve({
|
|
14
|
+
exportConditions: ['node'],
|
|
15
|
+
}),
|
|
16
|
+
commonjs(),
|
|
17
|
+
json(),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
await bundle.write({
|
|
22
|
+
dir: 'bundle',
|
|
23
|
+
format: 'cjs',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
await bundle.close();
|
|
27
|
+
|
|
28
|
+
const pkgJson = JSON.parse(readFileSync('package.json', 'utf8'));
|
|
29
|
+
delete pkgJson.type;
|
|
30
|
+
|
|
31
|
+
pkgJson.pkg.assets.forEach((asset) => {
|
|
32
|
+
cpSync(join('dist', asset), join('bundle', asset));
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
writeFileSync('bundle/package.json', JSON.stringify(pkgJson, null, 2));
|
|
36
|
+
|
|
37
|
+
await exec([
|
|
38
|
+
'bundle',
|
|
39
|
+
'--out-path',
|
|
40
|
+
'bundle',
|
|
41
|
+
'--compress',
|
|
42
|
+
'brotli',
|
|
43
|
+
'--options',
|
|
44
|
+
'no-warnings',
|
|
45
|
+
]);
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
import json from '@rollup/plugin-json';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
input: 'dist/cli.js',
|
|
7
|
+
output: {
|
|
8
|
+
dir: 'bundle',
|
|
9
|
+
format: 'cjs',
|
|
10
|
+
entryFileNames: '[name].cjs',
|
|
11
|
+
chunkFileNames: '[name]-[hash].cjs',
|
|
12
|
+
},
|
|
13
|
+
plugins: [
|
|
14
|
+
nodeResolve({
|
|
15
|
+
exportConditions: ['node'],
|
|
16
|
+
}),
|
|
17
|
+
commonjs(),
|
|
18
|
+
json(),
|
|
19
|
+
],
|
|
20
|
+
};
|