@e2b/cli 0.0.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/LICENSE +92 -0
- package/README.md +172 -0
- package/dist/index.js +116 -0
- package/package.json +83 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: FoundryLabs, Inc.
|
|
6
|
+
Licensed Work: Devbook CLI
|
|
7
|
+
The Licensed Work is (c) 2022 FoundryLabs, Inc.
|
|
8
|
+
Additional Use Grant:
|
|
9
|
+
|
|
10
|
+
Change Date: 2026-01-19
|
|
11
|
+
|
|
12
|
+
Change License: Apache License, Version 2.0
|
|
13
|
+
|
|
14
|
+
Notice
|
|
15
|
+
|
|
16
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
17
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
18
|
+
under an Open Source License, as stated in this License.
|
|
19
|
+
|
|
20
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
21
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
22
|
+
|
|
23
|
+
-----------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
Business Source License 1.1
|
|
26
|
+
|
|
27
|
+
Terms
|
|
28
|
+
|
|
29
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
30
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
31
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
32
|
+
production use.
|
|
33
|
+
|
|
34
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
35
|
+
available distribution of a specific version of the Licensed Work under this
|
|
36
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
37
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
38
|
+
above terminate.
|
|
39
|
+
|
|
40
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
41
|
+
currently in effect as described in this License, you must purchase a
|
|
42
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
43
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
44
|
+
|
|
45
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
46
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
47
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
48
|
+
for each version of the Licensed Work released by Licensor.
|
|
49
|
+
|
|
50
|
+
You must conspicuously display this License on each original or modified copy
|
|
51
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
52
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
53
|
+
License apply to your use of that work.
|
|
54
|
+
|
|
55
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
56
|
+
terminate your rights under this License for the current and all other
|
|
57
|
+
versions of the Licensed Work.
|
|
58
|
+
|
|
59
|
+
This License does not grant you any right in any trademark or logo of
|
|
60
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
61
|
+
Licensor as expressly required by this License).
|
|
62
|
+
|
|
63
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
64
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
65
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
66
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
67
|
+
TITLE.
|
|
68
|
+
|
|
69
|
+
MariaDB hereby grants you permission to use this License’s text to license
|
|
70
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
71
|
+
as long as you comply with the Covenants of Licensor below.
|
|
72
|
+
|
|
73
|
+
Covenants of Licensor
|
|
74
|
+
|
|
75
|
+
In consideration of the right to use this License’s text and the "Business
|
|
76
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
77
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
78
|
+
|
|
79
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
80
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
81
|
+
where "compatible" means that software provided under the Change License can
|
|
82
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
83
|
+
later version. Licensor may specify additional Change Licenses without
|
|
84
|
+
limitation.
|
|
85
|
+
|
|
86
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
87
|
+
impose any additional restriction on the right granted in this License, as
|
|
88
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
89
|
+
|
|
90
|
+
3. To specify a Change Date.
|
|
91
|
+
|
|
92
|
+
4. Not to modify this License in any other way.
|
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Devbook CLI
|
|
2
|
+
CLI for managing Devbook environments.
|
|
3
|
+
|
|
4
|
+
An environment is a virtual machine image that you can customize through our CLI. You can add files, install dependencies, and set env vars in the environment. Then with Devbook, every user visiting your website will get a new copy of the environment they can use.
|
|
5
|
+
|
|
6
|
+
* [Installation](#installation)
|
|
7
|
+
* [Quickstart](#quickstart)
|
|
8
|
+
* [Commands](#commands)
|
|
9
|
+
+ [`devbook env create`](#devbook-env-create)
|
|
10
|
+
+ [`devbook env push`](#devbook-env-push)
|
|
11
|
+
+ [`devbook env publish`](#devbook-env-publish)
|
|
12
|
+
+ [`devbook env delete`](#devbook-env-delete)
|
|
13
|
+
+ [`devbook env use`](#devbook-env-use)
|
|
14
|
+
+ [`devbook env set`](#devbook-env-set)
|
|
15
|
+
+ [`devbook env connect`](#devbook-env-connect)
|
|
16
|
+
+ [`devbook env list`](#devbook-env-list)
|
|
17
|
+
* [`dbk.toml` config](#dbktoml-config)
|
|
18
|
+
+ [`id`](#id)
|
|
19
|
+
+ [`template`](#template)
|
|
20
|
+
+ [`title`](#title)
|
|
21
|
+
+ [`filesystem.local_root`](#filesystemlocal_root)
|
|
22
|
+
* [FAQ](#faq)
|
|
23
|
+
+ [Inspect how a published environment looks like](#inspect-how-a-published-environment-looks-like)
|
|
24
|
+
+ [Delete files from an environment](#delete-files-from-an-environment)
|
|
25
|
+
+ [Inspect files in an environment](#inspect-files-in-an-environment)
|
|
26
|
+
+ [Install dependencies in an environment](#install-dependencies-in-an-environment)
|
|
27
|
+
+ [Upload local files to an environment](#upload-local-files-to-an-environment)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
```sh
|
|
32
|
+
npm install -g @devbookhq/cli
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then you can use the CLI with
|
|
36
|
+
```sh
|
|
37
|
+
devbook env --help
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
You will need an API key to use the Devbook CLI — you can get it [here](https://dash.usedevbook.com/settings) after signing up.
|
|
41
|
+
After you get the API key set the `DEVBOOK_KEY` env var in your terminal, or call the CLI with the env var directly
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
DEVBOOK_KEY=<your-api-key> devbook env ...
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quickstart
|
|
48
|
+
```sh
|
|
49
|
+
# Create an environment and a dbk.toml config for the environment
|
|
50
|
+
devbook env create
|
|
51
|
+
|
|
52
|
+
# Create a directory for files you want to be in the environment
|
|
53
|
+
mkdir ./files
|
|
54
|
+
|
|
55
|
+
# Upload files from the ./files directory to the environment
|
|
56
|
+
devbook env push
|
|
57
|
+
|
|
58
|
+
# Connect terminal to the environment so you can install dependencies.
|
|
59
|
+
# You quit this terminal with Ctrl+D or by `exit` command
|
|
60
|
+
devbook env connect
|
|
61
|
+
|
|
62
|
+
# All changes you made to the environment so far are not published —
|
|
63
|
+
# users that use this environment on your website cannot see the changes.
|
|
64
|
+
# To make all the changes you just made published, call the following command
|
|
65
|
+
devbook env publish
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Commands
|
|
69
|
+
By default, commands are referring to an environment defined by a `dbk.toml` in a directory where you called the commands.
|
|
70
|
+
|
|
71
|
+
All commands can be called with a `--path <path-to-dir>` flag that changes the directory where the command will be called, without the need to call `cd`.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
The Devbook CLI has following commands
|
|
75
|
+
|
|
76
|
+
### `devbook env create`
|
|
77
|
+
Create a new environment and `dbk.toml` config.
|
|
78
|
+
|
|
79
|
+
You can specify another environment as a template with `--template <existing-environment-id>` flag. This existing environment will be a base of the new environment — all files, env vars and dependencies from the existing environment will be present in the new environment.
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### `devbook env push`
|
|
83
|
+
Upload files from a local directory to an environment. The local directory to upload from is defined by the `filesystem.local_root` field in the `dbk.toml` config (`./files` by default).
|
|
84
|
+
Path of uploaded files in the environment will reflect their paths in the `./files` directory — file `./files/index.ts` will become `/index.ts` in the environment.
|
|
85
|
+
|
|
86
|
+
> Use `devbook env publish --all` to push all environments in subdirectories.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### `devbook env publish`
|
|
90
|
+
Publish changes you made in an environment (uploaded files, installed depedencies, set env vars).
|
|
91
|
+
Users on your website that use the environment cannot see the new changes you made to the environment until you run `devbook env publish` command.
|
|
92
|
+
|
|
93
|
+
> Use `devbook env publish --all` to publish all environments in subdirectories.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### `devbook env delete`
|
|
97
|
+
Delete an environment and a `dbk.toml` config for the environment.
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### `devbook env use`
|
|
101
|
+
Create a `dbk.toml` for an existing environment. You can use this to start version tracking environments created through Devbook dashboard.
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### `devbook env set`
|
|
105
|
+
Set env vars inside of an environment.
|
|
106
|
+
For example, to set `FOO` and `BAR` call `devbook env set FOO=1 BAR=2`.
|
|
107
|
+
|
|
108
|
+
> You must set all env vars in one `devbook env set --env-vars <KEY=VALUE...>` call — variables from the previous `devbook env set` calls will be overwritten.
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### `devbook env connect`
|
|
112
|
+
Open a terminal connected to an environment that you can use to configure and inspect the environment.
|
|
113
|
+
|
|
114
|
+
> The environments are based on Alpine Linux that uses `apk add` and `apk del` for managing packages.
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### `devbook env list`
|
|
118
|
+
List all environments and paths to their `dbk.toml` configs (if the configs are in subdirectories of the current directory).
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## `dbk.toml` config
|
|
122
|
+
The `dbk.toml` config is used for tracking an environment in version control. It is created automatically by `devbook env create` command.
|
|
123
|
+
|
|
124
|
+
The following fields are in each `dbk.toml` config
|
|
125
|
+
|
|
126
|
+
### `id`
|
|
127
|
+
You **should not edit this field** manually.
|
|
128
|
+
The id of this environment.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### `template`
|
|
132
|
+
You **should not edit this field** manually.
|
|
133
|
+
The id of the environment that was used as a template for this environment.
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### `title`
|
|
137
|
+
Title of the environment. The title is used for easier navigation and to distinguish between environments.
|
|
138
|
+
|
|
139
|
+
By default the title is the name of the directory where you called `devbook env create` command.
|
|
140
|
+
You can change this field and use `devbook env push` to save the changes.
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
### `filesystem.local_root`
|
|
144
|
+
A directory containing files that will be uploaded with `devbook env push` command.
|
|
145
|
+
By default it is `./files` — that means that the `./files` directory next to this `dbk.toml` will be uploaded to the environment when you use `devbook env push`.
|
|
146
|
+
|
|
147
|
+
For example, if you have a `./files/index.ts` file locally and run `devbook env push` the file `/index.ts` will be created and saved in the environment.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## FAQ
|
|
151
|
+
|
|
152
|
+
### Inspect how a published environment looks like
|
|
153
|
+
Use `devbook env connect --published` to open a terminal connected to a new instace of the environment.
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### Delete files from an environment
|
|
157
|
+
Use `devbook env connect` to open a terminal connected to the environment. Then you can delete the files from the environment with `rm` shell command.
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Inspect files in an environment
|
|
161
|
+
Use `devbook env connect` to connect your terminal with the environment then use terminal commands like `ls`, `cd`, `cat`, etc. to inspect files.
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
### Install dependencies in an environment
|
|
165
|
+
Use `devbook env connect` to open a terminal connected to the environment. Then you can install dependencies as you would on any other Linux machine.
|
|
166
|
+
|
|
167
|
+
> The environments are running on Alpine Linux that uses `apk add` and `apk del` for managing packages.
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
### Upload local files to an environment
|
|
171
|
+
Create `./files` directory next to the `dbk.toml` and put the files you want in the environment there.
|
|
172
|
+
After you call `devbook env push` files from the `./files` directory will be uploaded to the environment. Their path in the environment will reflect the path in the `./files` directory — file `./files/index.ts` will become `/index.ts` in the environment.
|