Skip to content

Commit e23e8dd

Browse files
committed
no more requireing supabase being initialized first
1 parent 771a89c commit e23e8dd

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

src/commands/init.ts

+10-12
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ export default async (
1515
projectPath: string
1616
) => {
1717

18-
const isSupabaseRoot = confirmSupabaseRoot(projectPath);
19-
if (!isSupabaseRoot) {
20-
logError("This command must be pointed at the root of a Basejump project.");
21-
process.exit(1);
22-
}
23-
2418
// ask user for project defaults using prompts library
2519
const { teamAccounts, teamAccountBilling, personalAccountBilling, starterApp, enableTesting } = await prompts([
2620
{
@@ -32,19 +26,19 @@ export default async (
3226
{
3327
type: "confirm",
3428
name: "teamAccountBilling",
35-
message: "Would you like to enable subscription billing for TEAM accounts? You can change this at any time",
29+
message: "Enable billing for TEAM accounts? You can change this at any time",
3630
initial: true
3731
},
3832
{
3933
type: "confirm",
4034
name: "personalAccountBilling",
41-
message: "Would you like to enable subscription billing for PERSONAL accounts? You can change this at any time",
35+
message: "Enable billing for PERSONAL accounts? You can change this at any time",
4236
initial: false
4337
},
4438
{
4539
type: "confirm",
4640
name: "enableTesting",
47-
message: "Do you want to enable testing for your project by installing supabase_test_helpers?",
41+
message: "Enable pgTap and supabase_test_helpers for testing?",
4842
initial: true
4943
},
5044
{
@@ -75,8 +69,6 @@ export default async (
7569
process.exit(1)
7670
}
7771

78-
console.log(basejumpRepoInfo);
79-
8072
const found = await hasRepo(basejumpRepoInfo)
8173

8274
if (!found) {
@@ -90,6 +82,12 @@ export default async (
9082

9183
await downloadAndExtractRepo(root, basejumpRepoInfo);
9284

85+
const isSupabaseRoot = confirmSupabaseRoot(projectPath);
86+
if (!isSupabaseRoot) {
87+
logError("This command must be pointed at the root of a Basejump project.");
88+
process.exit(1);
89+
}
90+
9391

9492
/**
9593
* Generate the supabase migration files
@@ -132,7 +130,7 @@ export default async (
132130
dynamicReplacers: [
133131
{
134132
slot: '{{timestamp}}',
135-
slotValue: generateTimestamp(),
133+
slotValue: generateTimestamp(1),
136134
},
137135
],
138136
entry: {

src/utils/generate-timestamp.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
export default function generateTimestamp() {
2-
// returns in format YYYYMMDDHHMMSS
3-
return new Date().toISOString().replace(/[^0-9]/g, "").slice(0, 14);
1+
export default function generateTimestamp(increment = 0) {
2+
const date = new Date();
3+
date.setSeconds(date.getSeconds() + increment);
4+
return date.toISOString().replace(/[^0-9]/g, "").slice(0, 14);
45
}

yarn.lock

+10-5
Original file line numberDiff line numberDiff line change
@@ -3013,6 +3013,11 @@ minipass@^4.0.0:
30133013
resolved "https://registry.npmjs.org/minipass/-/minipass-4.2.5.tgz"
30143014
integrity sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q==
30153015

3016+
minipass@^5.0.0:
3017+
version "5.0.0"
3018+
resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d"
3019+
integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==
3020+
30163021
minizlib@^2.1.1:
30173022
version "2.1.2"
30183023
resolved "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz"
@@ -3649,14 +3654,14 @@ tapable@^2.2.0:
36493654
resolved "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz"
36503655
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
36513656

3652-
tar@^6.1.13:
3653-
version "6.1.13"
3654-
resolved "https://registry.npmjs.org/tar/-/tar-6.1.13.tgz"
3655-
integrity sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw==
3657+
3658+
version "6.1.15"
3659+
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.15.tgz#c9738b0b98845a3b344d334b8fa3041aaba53a69"
3660+
integrity sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==
36563661
dependencies:
36573662
chownr "^2.0.0"
36583663
fs-minipass "^2.0.0"
3659-
minipass "^4.0.0"
3664+
minipass "^5.0.0"
36603665
minizlib "^2.1.1"
36613666
mkdirp "^1.0.3"
36623667
yallist "^4.0.0"

0 commit comments

Comments
 (0)