@owbase/cli 0.0.0-stage → 1.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 +29 -0
- package/NOTICE +1384 -0
- package/README.md +84 -2
- package/package.json +29 -4
- package/run.js +77 -0
package/README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
1
|
-
#
|
|
1
|
+
# owbase
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CLI do [Owbase](https://owbase.dev): functions, sites, banco, storage e todos os serviços do projeto pelo terminal · Owbase CLI: functions, sites, database, storage and every project service from the terminal
|
|
4
|
+
|
|
5
|
+
macOS, Linux e Windows (x64 e arm64). Node.js 18 ou mais novo, só para instalar.
|
|
6
|
+
|
|
7
|
+
## Português
|
|
8
|
+
|
|
9
|
+
### Instalação
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm i -g @owbase/cli
|
|
13
|
+
owbase --version
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
O pacote é `@owbase/cli`; o comando instalado é `owbase`. Para atualizar: `npm i -g @owbase/cli@latest` (o `owbase update` mostra se há versão nova).
|
|
17
|
+
|
|
18
|
+
### Login
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
owbase login # e-mail, senha e, se a conta tiver, o código do MFA
|
|
22
|
+
owbase whoami
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Por padrão a CLI fala com `https://cloud.owbase.dev/v1`. As sessões ficam em `~/.owbase/`.
|
|
26
|
+
|
|
27
|
+
### Projeto, function e site
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
owbase init project --project-id <ID_DO_PROJETO> # grava o owbase.json (pasta já ligada a outro projeto: pede confirmação)
|
|
31
|
+
owbase init function --name pedidos --function-id pedidos
|
|
32
|
+
owbase run function --function-id pedidos # local, com Docker
|
|
33
|
+
owbase push function --function-id pedidos
|
|
34
|
+
owbase init site --name loja --site-id loja --framework other
|
|
35
|
+
owbase push site --site-id loja
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### CI com chave de API
|
|
39
|
+
|
|
40
|
+
Na CI não há login: crie uma chave de API no console, só com os escopos da tarefa, guarde-a como segredo e passe-a por ambiente. **Nunca** ponha a chave na linha de comando.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
export OWBASE_API_KEY=... # segredo da CI
|
|
44
|
+
export OWBASE_PROJECT_ID=<ID_DO_PROJETO>
|
|
45
|
+
npm i -g @owbase/cli@1
|
|
46
|
+
owbase push function --function-id pedidos --force
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
A chave só vai para `OWBASE_ENDPOINT` ou, sem ele, para `https://cloud.owbase.dev/v1` (um `owbase.json` com outro `endpoint` é recusado; `http://` só para `localhost`).
|
|
50
|
+
|
|
51
|
+
### Guias
|
|
52
|
+
|
|
53
|
+
<https://docs.owbase.dev/cli/instalacao/>: instalação, login, functions, sites, banco e CI.
|
|
54
|
+
|
|
55
|
+
## English
|
|
56
|
+
|
|
57
|
+
### Install
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm i -g @owbase/cli
|
|
61
|
+
owbase --version
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The package is `@owbase/cli`; the installed command is `owbase`. To update: `npm i -g @owbase/cli@latest` (`owbase update` tells you when a new version is out).
|
|
65
|
+
|
|
66
|
+
### Sign in
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
owbase login # email, password and, when enabled, the MFA code
|
|
70
|
+
owbase whoami
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The CLI talks to `https://cloud.owbase.dev/v1` by default. Sessions live in `~/.owbase/`.
|
|
74
|
+
|
|
75
|
+
### CI with an API key
|
|
76
|
+
|
|
77
|
+
There is no login in CI: create an API key in the console with only the scopes the job needs, store it as a secret and pass it through the environment (`OWBASE_API_KEY`, plus `OWBASE_PROJECT_ID`). **Never** put the key on the command line. The key is sent only to `OWBASE_ENDPOINT` or, when unset, to `https://cloud.owbase.dev/v1`: an `owbase.json` pointing elsewhere is refused, and plain `http://` is accepted only for `localhost`.
|
|
78
|
+
|
|
79
|
+
### Guides
|
|
80
|
+
|
|
81
|
+
<https://docs.owbase.dev/cli/instalacao/> (Portuguese).
|
|
82
|
+
|
|
83
|
+
## Licença · License
|
|
84
|
+
|
|
85
|
+
BSD-3-Clause © Openwave. Avisos de terceiros em `NOTICE` · Third-party notices in `NOTICE`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owbase/cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Owbase CLI",
|
|
5
|
+
"homepage": "https://owbase.dev",
|
|
6
|
+
"license": "BSD-3-Clause",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/owbase/owbase.git"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"owbase": "run.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"run.js",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"NOTICE"
|
|
22
|
+
],
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"@owbase/cli-darwin-x64": "1.0.1",
|
|
25
|
+
"@owbase/cli-darwin-arm64": "1.0.1",
|
|
26
|
+
"@owbase/cli-linux-x64": "1.0.1",
|
|
27
|
+
"@owbase/cli-linux-arm64": "1.0.1",
|
|
28
|
+
"@owbase/cli-win-x64": "1.0.1",
|
|
29
|
+
"@owbase/cli-win-arm64": "1.0.1"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/run.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher for the npm distribution of the Owbase CLI.
|
|
3
|
+
//
|
|
4
|
+
// `npm i -g @owbase/cli` installs a native binary; this shim finds and executes it.
|
|
5
|
+
//
|
|
6
|
+
// Per-platform optionalDependencies rather than a postinstall download, which
|
|
7
|
+
// would break under `npm ci --ignore-scripts`, behind a proxied registry, and
|
|
8
|
+
// carries no integrity check. npm installs only the package matching `os`/`cpu`,
|
|
9
|
+
// integrity-checked and cached like any other dependency.
|
|
10
|
+
//
|
|
11
|
+
// The platform packages must be published BEFORE this one, or an install
|
|
12
|
+
// resolves optionalDependencies that do not exist yet.
|
|
13
|
+
|
|
14
|
+
const { spawnSync } = require("node:child_process");
|
|
15
|
+
|
|
16
|
+
// node's platform/arch -> suffix of the platform package (@owbase/cli-<suffix>).
|
|
17
|
+
const PLATFORMS = {
|
|
18
|
+
"darwin arm64": "darwin-arm64",
|
|
19
|
+
"darwin x64": "darwin-x64",
|
|
20
|
+
"linux arm64": "linux-arm64",
|
|
21
|
+
"linux x64": "linux-x64",
|
|
22
|
+
"win32 arm64": "win-arm64",
|
|
23
|
+
"win32 x64": "win-x64",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const suffix = PLATFORMS[`${process.platform} ${process.arch}`];
|
|
27
|
+
if (!suffix) {
|
|
28
|
+
console.error(
|
|
29
|
+
`owbase does not ship a binary for ${process.platform}/${process.arch}.`,
|
|
30
|
+
);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const packageName = `@owbase/cli-${suffix}`;
|
|
35
|
+
const binary = process.platform === "win32" ? "owbase.exe" : "owbase";
|
|
36
|
+
|
|
37
|
+
let executable;
|
|
38
|
+
try {
|
|
39
|
+
executable = require.resolve(`${packageName}/bin/${binary}`);
|
|
40
|
+
} catch {
|
|
41
|
+
// An optional dependency that fails to install is not an error to npm, so
|
|
42
|
+
// this is the first place a user hears about it. Name the package: the
|
|
43
|
+
// install looked successful, and without it there is nothing to search for.
|
|
44
|
+
console.error(
|
|
45
|
+
`${packageName} is not installed, so there is no owbase binary to run.\n` +
|
|
46
|
+
`Reinstall it with: npm i -g @owbase/cli`,
|
|
47
|
+
);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// The platform package must be the same version as this launcher; an older one found higher up
|
|
52
|
+
// (hoisting) or left by a partial upgrade would run another binary without a word.
|
|
53
|
+
try {
|
|
54
|
+
const wanted = require("./package.json").version;
|
|
55
|
+
const found = require(`${packageName}/package.json`).version;
|
|
56
|
+
if (found !== wanted) {
|
|
57
|
+
console.error(
|
|
58
|
+
`${packageName}@${found} does not match @owbase/cli@${wanted}. Reinstall it with: npm i -g @owbase/cli`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
// no package.json to compare: run the binary as before
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// stdio: "inherit" rather than piping, so the child keeps the real terminal.
|
|
66
|
+
// The CLI's prompts need a TTY, and piping would silently turn every
|
|
67
|
+
// interactive command into a hang.
|
|
68
|
+
const result = spawnSync(executable, process.argv.slice(2), { stdio: "inherit" });
|
|
69
|
+
|
|
70
|
+
if (result.error) {
|
|
71
|
+
console.error(result.error.message);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// A signalled child has a null status. Reporting 0 there would tell a CI job
|
|
76
|
+
// that a cancelled command succeeded.
|
|
77
|
+
process.exit(result.status === null ? 1 : result.status);
|