@rebasepro/cli 0.0.1-canary.0
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 +201 -0
- package/README.md +54 -0
- package/bin/rebase.js +4 -0
- package/dist/auth.d.ts +5 -0
- package/dist/cli.d.ts +1 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/index.cjs +277 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +265 -0
- package/dist/index.es.js.map +1 -0
- package/package.json +59 -0
- package/templates/template/.env.template +31 -0
- package/templates/template/README.md +59 -0
- package/templates/template/backend/Dockerfile +25 -0
- package/templates/template/backend/drizzle.config.ts +22 -0
- package/templates/template/backend/package.json +36 -0
- package/templates/template/backend/scripts/db-generate.ts +60 -0
- package/templates/template/backend/src/index.ts +134 -0
- package/templates/template/backend/src/schema.generated.ts +8 -0
- package/templates/template/backend/tsconfig.json +19 -0
- package/templates/template/docker-compose.yml +48 -0
- package/templates/template/frontend/Dockerfile +28 -0
- package/templates/template/frontend/index.html +13 -0
- package/templates/template/frontend/package.json +52 -0
- package/templates/template/frontend/src/App.tsx +132 -0
- package/templates/template/frontend/src/index.css +2 -0
- package/templates/template/frontend/src/main.tsx +18 -0
- package/templates/template/frontend/tsconfig.json +20 -0
- package/templates/template/frontend/vite.config.ts +26 -0
- package/templates/template/package.json +32 -0
- package/templates/template/shared/collections/index.ts +3 -0
- package/templates/template/shared/collections/posts.ts +53 -0
- package/templates/template/shared/index.ts +6 -0
- package/templates/template/shared/package.json +28 -0
- package/templates/template/shared/tsconfig.json +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
## Rebase CLI
|
|
2
|
+
|
|
3
|
+
This CLI tool allows you to create new Rebase projects and to deploy them to Rebase Cloud.
|
|
4
|
+
**IMPORTANT**: You should not be using this tool directly, but `rebase` instead.
|
|
5
|
+
|
|
6
|
+
### CLI
|
|
7
|
+
|
|
8
|
+
You can use the following commands:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
rebase login
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
rebase init
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
rebase deploy
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Using different templates
|
|
23
|
+
|
|
24
|
+
You can initialize a new project using different templates. Please not that these templates can't
|
|
25
|
+
be deployed to Rebase Cloud. For example:
|
|
26
|
+
|
|
27
|
+
For Rebase Cloud
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
rebase init
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For Rebase PRO:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
rebase init --pro
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### To run locally
|
|
40
|
+
|
|
41
|
+
For development purposes, you can link the package locally.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm link rebase
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Development only
|
|
48
|
+
|
|
49
|
+
You can change the environment when deploying to Rebase Cloud by defining the --env variable.
|
|
50
|
+
Possible values are `prod` (default) and `dev`.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
rebase deploy --env dev
|
|
54
|
+
```
|
package/bin/rebase.js
ADDED
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getTokens(env: "prod" | "dev", _debug?: boolean): Promise<object | null>;
|
|
2
|
+
export declare function parseJwt(token: string): object;
|
|
3
|
+
export declare function refreshCredentials(env: "dev" | "prod", credentials?: object | null, _onErr?: (e: unknown) => void): Promise<object | null>;
|
|
4
|
+
export declare function login(env: "prod" | "dev", _debug?: boolean): Promise<void>;
|
|
5
|
+
export declare function logout(env: "prod" | "dev", _debug?: boolean): Promise<void>;
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function entry(args: string[]): Promise<void>;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("chalk"), require("arg"), require("inquirer"), require("path"), require("fs"), require("util"), require("execa"), require("ncp"), require("url"), require("os")) : typeof define === "function" && define.amd ? define(["exports", "chalk", "arg", "inquirer", "path", "fs", "util", "execa", "ncp", "url", "os"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["Rebase CLI"] = {}, global.chalk, global.arg, global.inquirer, global.path, global.fs, global.util, global.execa, global.ncp, global.url, global.os));
|
|
3
|
+
})(this, (function(exports2, chalk, arg, inquirer, path, fs, util, execa, ncp, url, os) {
|
|
4
|
+
"use strict";
|
|
5
|
+
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default") {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e[k]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
const os__namespace = /* @__PURE__ */ _interopNamespaceDefault(os);
|
|
23
|
+
const access = util.promisify(fs.access);
|
|
24
|
+
const copy = util.promisify(ncp);
|
|
25
|
+
const __filename$2 = url.fileURLToPath(typeof document === "undefined" && typeof location === "undefined" ? require("url").pathToFileURL(__filename).href : typeof document === "undefined" ? location.href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href);
|
|
26
|
+
const __dirname$2 = path.dirname(__filename$2);
|
|
27
|
+
function findParentDir(currentDir, targetName) {
|
|
28
|
+
const root = path.parse(currentDir).root;
|
|
29
|
+
while (currentDir && currentDir !== root) {
|
|
30
|
+
if (path.basename(currentDir) === targetName) {
|
|
31
|
+
return currentDir;
|
|
32
|
+
}
|
|
33
|
+
currentDir = path.dirname(currentDir);
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const cliRoot = findParentDir(__dirname$2, "cli");
|
|
38
|
+
async function createRebaseApp(rawArgs) {
|
|
39
|
+
console.log(`
|
|
40
|
+
${chalk.bold("Rebase")} — Create a new project 🚀
|
|
41
|
+
`);
|
|
42
|
+
const options = await promptForOptions(rawArgs);
|
|
43
|
+
await createProject(options);
|
|
44
|
+
}
|
|
45
|
+
async function promptForOptions(rawArgs) {
|
|
46
|
+
const args = arg(
|
|
47
|
+
{
|
|
48
|
+
"--git": Boolean,
|
|
49
|
+
"-g": "--git"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
argv: rawArgs.slice(3),
|
|
53
|
+
// skip "node", "rebase", "init"
|
|
54
|
+
permissive: true
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
const nameArg = args._[0];
|
|
58
|
+
const questions = [];
|
|
59
|
+
if (!nameArg) {
|
|
60
|
+
questions.push({
|
|
61
|
+
type: "input",
|
|
62
|
+
name: "projectName",
|
|
63
|
+
message: "Project name:",
|
|
64
|
+
default: "my-rebase-app",
|
|
65
|
+
validate: (input) => {
|
|
66
|
+
if (!input.trim()) return "Project name is required";
|
|
67
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/.test(input)) {
|
|
68
|
+
return "Project name must start with a lowercase letter or number and contain only lowercase letters, numbers, hyphens, dots, or underscores";
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (!args["--git"]) {
|
|
75
|
+
questions.push({
|
|
76
|
+
type: "confirm",
|
|
77
|
+
name: "git",
|
|
78
|
+
message: "Initialize a git repository?",
|
|
79
|
+
default: true
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const answers = await inquirer.prompt(questions);
|
|
83
|
+
const projectName = nameArg || answers.projectName;
|
|
84
|
+
const targetDirectory = path.resolve(process.cwd(), projectName);
|
|
85
|
+
const templateDirectory = path.resolve(cliRoot, "templates", "template");
|
|
86
|
+
return {
|
|
87
|
+
projectName,
|
|
88
|
+
git: args["--git"] || answers.git || false,
|
|
89
|
+
targetDirectory,
|
|
90
|
+
templateDirectory
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
async function createProject(options) {
|
|
94
|
+
if (fs.existsSync(options.targetDirectory)) {
|
|
95
|
+
if (fs.readdirSync(options.targetDirectory).length !== 0) {
|
|
96
|
+
console.error(`${chalk.red.bold("ERROR")} Directory "${options.projectName}" already exists and is not empty`);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
fs.mkdirSync(options.targetDirectory, { recursive: true });
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
await access(options.templateDirectory, fs.constants.R_OK);
|
|
104
|
+
} catch {
|
|
105
|
+
console.error(`${chalk.red.bold("ERROR")} Template not found at ${options.templateDirectory}`);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
console.log(chalk.gray(" Copying project files..."));
|
|
109
|
+
await copy(options.templateDirectory, options.targetDirectory, {
|
|
110
|
+
clobber: false,
|
|
111
|
+
dot: true,
|
|
112
|
+
filter: (source) => {
|
|
113
|
+
const basename = path.basename(source);
|
|
114
|
+
return basename !== "node_modules" && basename !== ".DS_Store";
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
await replacePlaceholders(options);
|
|
118
|
+
const envTemplatePath = path.join(options.targetDirectory, ".env.template");
|
|
119
|
+
const envPath = path.join(options.targetDirectory, ".env");
|
|
120
|
+
if (fs.existsSync(envTemplatePath) && !fs.existsSync(envPath)) {
|
|
121
|
+
fs.renameSync(envTemplatePath, envPath);
|
|
122
|
+
}
|
|
123
|
+
if (options.git) {
|
|
124
|
+
console.log(chalk.gray(" Initializing git repository..."));
|
|
125
|
+
try {
|
|
126
|
+
await execa("git", ["init"], { cwd: options.targetDirectory });
|
|
127
|
+
} catch {
|
|
128
|
+
console.warn(chalk.yellow(" Warning: Failed to initialize git repository"));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
console.log("");
|
|
132
|
+
console.log(`${chalk.green.bold("✓")} Project ${chalk.bold(options.projectName)} created successfully!`);
|
|
133
|
+
console.log("");
|
|
134
|
+
console.log(chalk.bold("Next steps:"));
|
|
135
|
+
console.log("");
|
|
136
|
+
console.log(` ${chalk.cyan("cd")} ${options.projectName}`);
|
|
137
|
+
console.log(` ${chalk.cyan("pnpm install")}`);
|
|
138
|
+
console.log("");
|
|
139
|
+
console.log(chalk.gray(" # Set up your database connection in .env"));
|
|
140
|
+
console.log(chalk.gray(" # Then run:"));
|
|
141
|
+
console.log("");
|
|
142
|
+
console.log(` ${chalk.cyan("pnpm dev")}`);
|
|
143
|
+
console.log("");
|
|
144
|
+
console.log(chalk.gray("This starts both the backend (Express + PostgreSQL)") + chalk.gray(" and the frontend (Vite + React) concurrently."));
|
|
145
|
+
console.log("");
|
|
146
|
+
console.log(chalk.gray("Docs: https://rebase.pro/docs"));
|
|
147
|
+
console.log(chalk.gray("GitHub: https://github.com/rebaseco/rebase"));
|
|
148
|
+
console.log("");
|
|
149
|
+
}
|
|
150
|
+
async function replacePlaceholders(options) {
|
|
151
|
+
const filesToProcess = [
|
|
152
|
+
"package.json",
|
|
153
|
+
"frontend/package.json",
|
|
154
|
+
"backend/package.json",
|
|
155
|
+
"shared/package.json",
|
|
156
|
+
"frontend/index.html"
|
|
157
|
+
];
|
|
158
|
+
for (const file of filesToProcess) {
|
|
159
|
+
const fullPath = path.resolve(options.targetDirectory, file);
|
|
160
|
+
if (!fs.existsSync(fullPath)) continue;
|
|
161
|
+
let content = fs.readFileSync(fullPath, "utf-8");
|
|
162
|
+
content = content.replace(/\{\{PROJECT_NAME\}\}/g, options.projectName);
|
|
163
|
+
fs.writeFileSync(fullPath, content, "utf-8");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const __filename$1 = url.fileURLToPath(typeof document === "undefined" && typeof location === "undefined" ? require("url").pathToFileURL(__filename).href : typeof document === "undefined" ? location.href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href);
|
|
167
|
+
const __dirname$1 = path.dirname(__filename$1);
|
|
168
|
+
function getVersion() {
|
|
169
|
+
try {
|
|
170
|
+
const pkgPath = path.resolve(__dirname$1, "../package.json");
|
|
171
|
+
if (fs.existsSync(pkgPath)) {
|
|
172
|
+
return JSON.parse(fs.readFileSync(pkgPath, "utf-8")).version;
|
|
173
|
+
}
|
|
174
|
+
} catch {
|
|
175
|
+
}
|
|
176
|
+
return "unknown";
|
|
177
|
+
}
|
|
178
|
+
async function entry(args) {
|
|
179
|
+
const parsedArgs = arg(
|
|
180
|
+
{
|
|
181
|
+
"--version": Boolean,
|
|
182
|
+
"--help": Boolean,
|
|
183
|
+
"-v": "--version",
|
|
184
|
+
"-h": "--help"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
argv: args.slice(2),
|
|
188
|
+
permissive: true
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
if (parsedArgs["--version"]) {
|
|
192
|
+
console.log(getVersion());
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const command = parsedArgs._[0];
|
|
196
|
+
if (!command || parsedArgs["--help"]) {
|
|
197
|
+
printHelp();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (command === "init") {
|
|
201
|
+
await createRebaseApp(args);
|
|
202
|
+
} else {
|
|
203
|
+
console.log(chalk.red(`Unknown command: ${command}`));
|
|
204
|
+
console.log("");
|
|
205
|
+
printHelp();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function printHelp() {
|
|
209
|
+
console.log(`
|
|
210
|
+
${chalk.bold("Rebase CLI")} — Developer tools for Rebase projects
|
|
211
|
+
|
|
212
|
+
${chalk.green.bold("Usage")}
|
|
213
|
+
rebase ${chalk.blue("<command>")} [options]
|
|
214
|
+
|
|
215
|
+
${chalk.green.bold("Commands")}
|
|
216
|
+
${chalk.blue.bold("init")} Create a new Rebase project
|
|
217
|
+
|
|
218
|
+
${chalk.green.bold("Options")}
|
|
219
|
+
${chalk.blue("--version, -v")} Show version number
|
|
220
|
+
${chalk.blue("--help, -h")} Show this help message
|
|
221
|
+
|
|
222
|
+
${chalk.gray("Documentation: https://rebase.pro/docs")}
|
|
223
|
+
`);
|
|
224
|
+
}
|
|
225
|
+
const TOKEN_DIR = path.join(os__namespace.homedir(), ".rebase");
|
|
226
|
+
function tokenPath(env) {
|
|
227
|
+
return path.join(TOKEN_DIR, (env === "dev" ? "staging." : "") + "tokens.json");
|
|
228
|
+
}
|
|
229
|
+
async function getTokens(env, _debug) {
|
|
230
|
+
const fp = tokenPath(env);
|
|
231
|
+
if (!fs.existsSync(fp)) return null;
|
|
232
|
+
try {
|
|
233
|
+
const data = fs.readFileSync(fp, "utf-8");
|
|
234
|
+
return JSON.parse(data);
|
|
235
|
+
} catch {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function parseJwt(token) {
|
|
240
|
+
if (!token) throw new Error("No JWT token");
|
|
241
|
+
const base64Url = token.split(".")[1];
|
|
242
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
243
|
+
const buffer = Buffer.from(base64, "base64");
|
|
244
|
+
return JSON.parse(buffer.toString());
|
|
245
|
+
}
|
|
246
|
+
async function refreshCredentials(env, credentials, _onErr) {
|
|
247
|
+
if (!credentials) return null;
|
|
248
|
+
const expiryDate = new Date(credentials["expiry_date"]);
|
|
249
|
+
if (expiryDate.getTime() > Date.now()) {
|
|
250
|
+
return credentials;
|
|
251
|
+
}
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
async function login(env, _debug) {
|
|
255
|
+
console.log(
|
|
256
|
+
"Interactive login is not yet implemented in @rebasepro/cli.\nPlease authenticate via the Rebase dashboard and copy your tokens to " + tokenPath(env)
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
async function logout(env, _debug) {
|
|
260
|
+
const fp = tokenPath(env);
|
|
261
|
+
if (fs.existsSync(fp)) {
|
|
262
|
+
fs.unlinkSync(fp);
|
|
263
|
+
console.log("You have been logged out.");
|
|
264
|
+
} else {
|
|
265
|
+
console.log("You are not logged in.");
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
exports2.createRebaseApp = createRebaseApp;
|
|
269
|
+
exports2.entry = entry;
|
|
270
|
+
exports2.getTokens = getTokens;
|
|
271
|
+
exports2.login = login;
|
|
272
|
+
exports2.logout = logout;
|
|
273
|
+
exports2.parseJwt = parseJwt;
|
|
274
|
+
exports2.refreshCredentials = refreshCredentials;
|
|
275
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
276
|
+
}));
|
|
277
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/commands/init.ts","../src/cli.ts","../src/auth.ts"],"sourcesContent":["import arg from \"arg\";\nimport inquirer from \"inquirer\";\nimport chalk from \"chalk\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { promisify } from \"util\";\nimport execa from \"execa\";\nimport ncp from \"ncp\";\nimport { fileURLToPath } from \"url\";\n\nconst access = promisify(fs.access);\nconst copy = promisify(ncp);\n\n// Resolve template path relative to this file\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nfunction findParentDir(currentDir: string, targetName: string): string | null {\n const root = path.parse(currentDir).root;\n while (currentDir && currentDir !== root) {\n if (path.basename(currentDir) === targetName) {\n return currentDir;\n }\n currentDir = path.dirname(currentDir);\n }\n return null;\n}\n\nconst cliRoot = findParentDir(__dirname, \"cli\");\n\nexport interface InitOptions {\n projectName: string;\n git: boolean;\n targetDirectory: string;\n templateDirectory: string;\n}\n\nexport async function createRebaseApp(rawArgs: string[]) {\n console.log(`\n${chalk.bold(\"Rebase\")} — Create a new project 🚀\n`);\n\n const options = await promptForOptions(rawArgs);\n await createProject(options);\n}\n\nasync function promptForOptions(rawArgs: string[]): Promise<InitOptions> {\n const args = arg(\n {\n \"--git\": Boolean,\n \"-g\": \"--git\"\n },\n {\n argv: rawArgs.slice(3), // skip \"node\", \"rebase\", \"init\"\n permissive: true\n }\n );\n\n // The first positional arg after \"init\" is the project name\n const nameArg = args._[0];\n\n const questions: any[] = [];\n\n if (!nameArg) {\n questions.push({\n type: \"input\",\n name: \"projectName\",\n message: \"Project name:\",\n default: \"my-rebase-app\",\n validate: (input: string) => {\n if (!input.trim()) return \"Project name is required\";\n if (!/^[a-z0-9][a-z0-9._-]*$/.test(input)) {\n return \"Project name must start with a lowercase letter or number and contain only lowercase letters, numbers, hyphens, dots, or underscores\";\n }\n return true;\n }\n });\n }\n\n if (!args[\"--git\"]) {\n questions.push({\n type: \"confirm\",\n name: \"git\",\n message: \"Initialize a git repository?\",\n default: true\n });\n }\n\n const answers = await inquirer.prompt(questions);\n\n const projectName = nameArg || answers.projectName;\n const targetDirectory = path.resolve(process.cwd(), projectName);\n const templateDirectory = path.resolve(cliRoot!, \"templates\", \"template\");\n\n return {\n projectName,\n git: args[\"--git\"] || answers.git || false,\n targetDirectory,\n templateDirectory\n };\n}\n\nasync function createProject(options: InitOptions) {\n // Check if directory already exists and is not empty\n if (fs.existsSync(options.targetDirectory)) {\n if (fs.readdirSync(options.targetDirectory).length !== 0) {\n console.error(`${chalk.red.bold(\"ERROR\")} Directory \"${options.projectName}\" already exists and is not empty`);\n process.exit(1);\n }\n } else {\n fs.mkdirSync(options.targetDirectory, { recursive: true });\n }\n\n // Verify template exists\n try {\n await access(options.templateDirectory, fs.constants.R_OK);\n } catch {\n console.error(`${chalk.red.bold(\"ERROR\")} Template not found at ${options.templateDirectory}`);\n process.exit(1);\n }\n\n // Copy template files\n console.log(chalk.gray(\" Copying project files...\"));\n await copy(options.templateDirectory, options.targetDirectory, {\n clobber: false,\n dot: true,\n filter: (source: string) => {\n const basename = path.basename(source);\n // Skip node_modules and .DS_Store\n return basename !== \"node_modules\" && basename !== \".DS_Store\";\n }\n });\n\n // Replace placeholder project name in package.json files\n await replacePlaceholders(options);\n\n // Rename .env.template to .env if it exists\n const envTemplatePath = path.join(options.targetDirectory, \".env.template\");\n const envPath = path.join(options.targetDirectory, \".env\");\n if (fs.existsSync(envTemplatePath) && !fs.existsSync(envPath)) {\n fs.renameSync(envTemplatePath, envPath);\n }\n\n // Initialize git\n if (options.git) {\n console.log(chalk.gray(\" Initializing git repository...\"));\n try {\n await execa(\"git\", [\"init\"], { cwd: options.targetDirectory });\n } catch {\n console.warn(chalk.yellow(\" Warning: Failed to initialize git repository\"));\n }\n }\n\n // Success message\n console.log(\"\");\n console.log(`${chalk.green.bold(\"✓\")} Project ${chalk.bold(options.projectName)} created successfully!`);\n console.log(\"\");\n console.log(chalk.bold(\"Next steps:\"));\n console.log(\"\");\n console.log(` ${chalk.cyan(\"cd\")} ${options.projectName}`);\n console.log(` ${chalk.cyan(\"pnpm install\")}`);\n console.log(\"\");\n console.log(chalk.gray(\" # Set up your database connection in .env\"));\n console.log(chalk.gray(\" # Then run:\"));\n console.log(\"\");\n console.log(` ${chalk.cyan(\"pnpm dev\")}`);\n console.log(\"\");\n console.log(chalk.gray(\"This starts both the backend (Express + PostgreSQL)\")\n + chalk.gray(\" and the frontend (Vite + React) concurrently.\"));\n console.log(\"\");\n console.log(chalk.gray(\"Docs: https://rebase.pro/docs\"));\n console.log(chalk.gray(\"GitHub: https://github.com/rebaseco/rebase\"));\n console.log(\"\");\n}\n\nasync function replacePlaceholders(options: InitOptions) {\n const filesToProcess = [\n \"package.json\",\n \"frontend/package.json\",\n \"backend/package.json\",\n \"shared/package.json\",\n \"frontend/index.html\"\n ];\n\n for (const file of filesToProcess) {\n const fullPath = path.resolve(options.targetDirectory, file);\n if (!fs.existsSync(fullPath)) continue;\n\n let content = fs.readFileSync(fullPath, \"utf-8\");\n content = content.replace(/\\{\\{PROJECT_NAME\\}\\}/g, options.projectName);\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n}\n","import chalk from \"chalk\";\nimport arg from \"arg\";\nimport { createRebaseApp } from \"./commands/init\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nfunction getVersion(): string {\n try {\n // Try to read version from package.json\n const pkgPath = path.resolve(__dirname, \"../package.json\");\n if (fs.existsSync(pkgPath)) {\n return JSON.parse(fs.readFileSync(pkgPath, \"utf-8\")).version;\n }\n } catch {\n // ignore\n }\n return \"unknown\";\n}\n\nexport async function entry(args: string[]) {\n const parsedArgs = arg(\n {\n \"--version\": Boolean,\n \"--help\": Boolean,\n \"-v\": \"--version\",\n \"-h\": \"--help\"\n },\n {\n argv: args.slice(2),\n permissive: true\n }\n );\n\n if (parsedArgs[\"--version\"]) {\n console.log(getVersion());\n return;\n }\n\n const command = parsedArgs._[0];\n\n if (!command || parsedArgs[\"--help\"]) {\n printHelp();\n return;\n }\n\n if (command === \"init\") {\n await createRebaseApp(args);\n } else {\n console.log(chalk.red(`Unknown command: ${command}`));\n console.log(\"\");\n printHelp();\n }\n}\n\nfunction printHelp() {\n console.log(`\n${chalk.bold(\"Rebase CLI\")} — Developer tools for Rebase projects\n\n${chalk.green.bold(\"Usage\")}\n rebase ${chalk.blue(\"<command>\")} [options]\n\n${chalk.green.bold(\"Commands\")}\n ${chalk.blue.bold(\"init\")} Create a new Rebase project\n\n${chalk.green.bold(\"Options\")}\n ${chalk.blue(\"--version, -v\")} Show version number\n ${chalk.blue(\"--help, -h\")} Show this help message\n\n${chalk.gray(\"Documentation: https://rebase.pro/docs\")}\n`);\n}\n","/**\n * Authentication helpers for the Rebase CLI.\n *\n * Token storage lives at ~/.rebase/tokens.json (prod) or\n * ~/.rebase/staging.tokens.json (dev).\n */\nimport fs from \"fs\";\nimport path from \"path\";\nimport * as os from \"os\";\n\nconst TOKEN_DIR = path.join(os.homedir(), \".rebase\");\n\nfunction tokenPath(env: \"prod\" | \"dev\"): string {\n return path.join(TOKEN_DIR, (env === \"dev\" ? \"staging.\" : \"\") + \"tokens.json\");\n}\n\n// ─── Token persistence ────────────────────────────────────\n\nfunction saveTokens(tokens: object, env: \"prod\" | \"dev\") {\n if (!fs.existsSync(TOKEN_DIR)) {\n fs.mkdirSync(TOKEN_DIR, { recursive: true });\n }\n fs.writeFileSync(tokenPath(env), JSON.stringify(tokens));\n}\n\n// ─── Public API ───────────────────────────────────────────\n\nexport async function getTokens(env: \"prod\" | \"dev\", _debug?: boolean): Promise<object | null> {\n const fp = tokenPath(env);\n if (!fs.existsSync(fp)) return null;\n try {\n const data = fs.readFileSync(fp, \"utf-8\");\n return JSON.parse(data);\n } catch {\n return null;\n }\n}\n\nexport function parseJwt(token: string): object {\n if (!token) throw new Error(\"No JWT token\");\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const buffer = Buffer.from(base64, \"base64\");\n return JSON.parse(buffer.toString());\n}\n\nexport async function refreshCredentials(\n env: \"dev\" | \"prod\",\n credentials?: object | null,\n _onErr?: (e: unknown) => void,\n): Promise<object | null> {\n if (!credentials) return null;\n // If the token hasn't expired, just return it.\n const expiryDate = new Date((credentials as any)[\"expiry_date\"]);\n if (expiryDate.getTime() > Date.now()) {\n return credentials;\n }\n // Without a server endpoint we can't actually refresh –\n // the caller should handle the null return by re-authenticating.\n return null;\n}\n\nexport async function login(env: \"prod\" | \"dev\", _debug?: boolean): Promise<void> {\n console.log(\n \"Interactive login is not yet implemented in @rebasepro/cli.\\n\" +\n \"Please authenticate via the Rebase dashboard and copy your tokens to \" +\n tokenPath(env),\n );\n}\n\nexport async function logout(env: \"prod\" | \"dev\", _debug?: boolean): Promise<void> {\n const fp = tokenPath(env);\n if (fs.existsSync(fp)) {\n fs.unlinkSync(fp);\n console.log(\"You have been logged out.\");\n } else {\n console.log(\"You are not logged in.\");\n }\n}\n"],"names":["promisify","__filename","fileURLToPath","__dirname","os"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAUA,QAAM,SAASA,KAAAA,UAAU,GAAG,MAAM;AAClC,QAAM,OAAOA,KAAAA,UAAU,GAAG;AAG1B,QAAMC,eAAaC,IAAAA,qVAA6B;AAChD,QAAMC,cAAY,KAAK,QAAQF,YAAU;AAEzC,WAAS,cAAc,YAAoB,YAAmC;AAC1E,UAAM,OAAO,KAAK,MAAM,UAAU,EAAE;AACpC,WAAO,cAAc,eAAe,MAAM;AACtC,UAAI,KAAK,SAAS,UAAU,MAAM,YAAY;AAC1C,eAAO;AAAA,MACX;AACA,mBAAa,KAAK,QAAQ,UAAU;AAAA,IACxC;AACA,WAAO;AAAA,EACX;AAEA,QAAM,UAAU,cAAcE,aAAW,KAAK;AAS9C,iBAAsB,gBAAgB,SAAmB;AACrD,YAAQ,IAAI;AAAA,EACd,MAAM,KAAK,QAAQ,CAAC;AAAA,CACr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