d1s 0.2.1 → 0.2.2

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.
Files changed (32) hide show
  1. package/dist/.next/.next/BUILD_ID +1 -1
  2. package/dist/.next/.next/build-manifest.json +2 -2
  3. package/dist/.next/.next/cache/.tsbuildinfo +1 -1
  4. package/dist/.next/.next/cache/webpack/client-production/0.pack +0 -0
  5. package/dist/.next/.next/cache/webpack/client-production/1.pack +0 -0
  6. package/dist/.next/.next/cache/webpack/client-production/3.pack +0 -0
  7. package/dist/.next/.next/cache/webpack/client-production/4.pack +0 -0
  8. package/dist/.next/.next/cache/webpack/client-production/index.pack +0 -0
  9. package/dist/.next/.next/cache/webpack/client-production/index.pack.old +0 -0
  10. package/dist/.next/.next/cache/webpack/server-production/0.pack +0 -0
  11. package/dist/.next/.next/cache/webpack/server-production/1.pack +0 -0
  12. package/dist/.next/.next/cache/webpack/server-production/2.pack +0 -0
  13. package/dist/.next/.next/cache/webpack/server-production/3.pack +0 -0
  14. package/dist/.next/.next/cache/webpack/server-production/index.pack +0 -0
  15. package/dist/.next/.next/cache/webpack/server-production/index.pack.old +0 -0
  16. package/dist/.next/.next/next-minimal-server.js.nft.json +1 -1
  17. package/dist/.next/.next/next-server.js.nft.json +1 -1
  18. package/dist/.next/.next/prerender-manifest.json +1 -1
  19. package/dist/.next/.next/server/app/_not-found.html +1 -1
  20. package/dist/.next/.next/server/app/_not-found.rsc +1 -1
  21. package/dist/.next/.next/server/app/index.html +1 -1
  22. package/dist/.next/.next/server/app/index.rsc +1 -1
  23. package/dist/.next/.next/server/pages/404.html +1 -1
  24. package/dist/.next/.next/server/pages/500.html +1 -1
  25. package/dist/.next/.next/static/_t0S4u4KzUwKctaxLKvx4/_buildManifest.js +1 -0
  26. package/dist/.next/.next/static/_t0S4u4KzUwKctaxLKvx4/_ssgManifest.js +1 -0
  27. package/dist/.next/.next/static/xzPddcyKcodbwNX_sKljr/_buildManifest.js +1 -0
  28. package/dist/.next/.next/static/xzPddcyKcodbwNX_sKljr/_ssgManifest.js +1 -0
  29. package/dist/.next/.next/trace +3 -3
  30. package/dist/d1-studio.js +9 -12
  31. package/package.json +1 -1
  32. package/scripts/studio.js +9 -12
package/dist/d1-studio.js CHANGED
@@ -16,9 +16,6 @@ import { findWranglerConfig } from '../src/lib/find-wrangler-config.js';
16
16
  const __filename = fileURLToPath(import.meta.url);
17
17
  const __dirname = dirname(__filename);
18
18
 
19
- // console.log(chalk.blue('Resolved __filename:'), __filename);
20
- // console.log(chalk.blue('Resolved __dirname:'), __dirname);
21
-
22
19
  // License validation utilities
23
20
  class LicenseError extends Error {
24
21
  constructor(message, type = 'VALIDATION_ERROR') {
@@ -123,14 +120,18 @@ async function saveLicenseFile(licenseData) {
123
120
  async function startServer(port, projectDirectory) {
124
121
  return new Promise((resolvePromise, rejectPromise) => {
125
122
  const dev = process.env.NODE_ENV === 'development';
126
- // Point to the parent directory that contains both app and .next
127
- const dir = join(__dirname, '..');
123
+
124
+ // Determine the directory where Next.js build is located:
125
+ // In production (published package), __dirname is in the 'dist' folder so we use it directly.
126
+ // In development, we assume the structure is different and go one level up.
127
+ const isProduction = process.env.NODE_ENV !== 'development';
128
+ const nextAppDir = isProduction ? __dirname : join(__dirname, '..');
129
+
128
130
  const app = next({
129
131
  dev,
130
- dir,
132
+ dir: nextAppDir,
131
133
  conf: {
132
134
  distDir: '.next',
133
- // Ensure app directory is correctly set for routing
134
135
  experimental: {
135
136
  appDir: true
136
137
  }
@@ -214,7 +215,6 @@ async function startStudio() {
214
215
  console.log(chalk.blue('Entered license information:'), answers);
215
216
 
216
217
  const hardwareId = await generateHardwareId();
217
- // console.log(chalk.blue('Generated hardware ID:'), hardwareId);
218
218
 
219
219
  try {
220
220
  const validation = await validateLicenseRemote(
@@ -242,7 +242,6 @@ async function startStudio() {
242
242
  // Get wrangler configuration
243
243
  try {
244
244
  const userProjectPath = process.cwd();
245
- // console.log(chalk.blue('Current working directory:'), userProjectPath);
246
245
 
247
246
  if (!userProjectPath) {
248
247
  console.error(chalk.red('Error: Could not determine project directory'));
@@ -250,7 +249,6 @@ async function startStudio() {
250
249
  }
251
250
 
252
251
  const wranglerResult = await findWranglerConfig(userProjectPath);
253
- // console.log(chalk.blue('Wrangler config result:'), wranglerResult);
254
252
 
255
253
  if (!wranglerResult || !wranglerResult.config) {
256
254
  console.error(chalk.red('\nError: No wrangler.toml found in current directory'));
@@ -260,7 +258,6 @@ async function startStudio() {
260
258
  }
261
259
 
262
260
  const { config, projectPath } = wranglerResult;
263
- // console.log(chalk.blue('Resolved wrangler.toml project path:'), projectPath);
264
261
 
265
262
  if (!config.d1_databases?.length) {
266
263
  console.error(chalk.red('\nError: No D1 databases configured in wrangler.toml'));
@@ -341,4 +338,4 @@ process.on('SIGTERM', () => {
341
338
  startStudio().catch((error) => {
342
339
  console.error(chalk.red('\nFailed to start D1 Studio:'), error);
343
340
  process.exit(1);
344
- });
341
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d1s",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "D1 Studio – a native studio for managing Cloudflare D1 databases.",
6
6
  "main": "./dist/d1-studio.js",
package/scripts/studio.js CHANGED
@@ -16,9 +16,6 @@ import { findWranglerConfig } from '../src/lib/find-wrangler-config.js';
16
16
  const __filename = fileURLToPath(import.meta.url);
17
17
  const __dirname = dirname(__filename);
18
18
 
19
- // console.log(chalk.blue('Resolved __filename:'), __filename);
20
- // console.log(chalk.blue('Resolved __dirname:'), __dirname);
21
-
22
19
  // License validation utilities
23
20
  class LicenseError extends Error {
24
21
  constructor(message, type = 'VALIDATION_ERROR') {
@@ -123,14 +120,18 @@ async function saveLicenseFile(licenseData) {
123
120
  async function startServer(port, projectDirectory) {
124
121
  return new Promise((resolvePromise, rejectPromise) => {
125
122
  const dev = process.env.NODE_ENV === 'development';
126
- // Point to the parent directory that contains both app and .next
127
- const dir = join(__dirname, '..');
123
+
124
+ // Determine the directory where Next.js build is located:
125
+ // In production (published package), __dirname is in the 'dist' folder so we use it directly.
126
+ // In development, we assume the structure is different and go one level up.
127
+ const isProduction = process.env.NODE_ENV !== 'development';
128
+ const nextAppDir = isProduction ? __dirname : join(__dirname, '..');
129
+
128
130
  const app = next({
129
131
  dev,
130
- dir,
132
+ dir: nextAppDir,
131
133
  conf: {
132
134
  distDir: '.next',
133
- // Ensure app directory is correctly set for routing
134
135
  experimental: {
135
136
  appDir: true
136
137
  }
@@ -214,7 +215,6 @@ async function startStudio() {
214
215
  console.log(chalk.blue('Entered license information:'), answers);
215
216
 
216
217
  const hardwareId = await generateHardwareId();
217
- // console.log(chalk.blue('Generated hardware ID:'), hardwareId);
218
218
 
219
219
  try {
220
220
  const validation = await validateLicenseRemote(
@@ -242,7 +242,6 @@ async function startStudio() {
242
242
  // Get wrangler configuration
243
243
  try {
244
244
  const userProjectPath = process.cwd();
245
- // console.log(chalk.blue('Current working directory:'), userProjectPath);
246
245
 
247
246
  if (!userProjectPath) {
248
247
  console.error(chalk.red('Error: Could not determine project directory'));
@@ -250,7 +249,6 @@ async function startStudio() {
250
249
  }
251
250
 
252
251
  const wranglerResult = await findWranglerConfig(userProjectPath);
253
- // console.log(chalk.blue('Wrangler config result:'), wranglerResult);
254
252
 
255
253
  if (!wranglerResult || !wranglerResult.config) {
256
254
  console.error(chalk.red('\nError: No wrangler.toml found in current directory'));
@@ -260,7 +258,6 @@ async function startStudio() {
260
258
  }
261
259
 
262
260
  const { config, projectPath } = wranglerResult;
263
- // console.log(chalk.blue('Resolved wrangler.toml project path:'), projectPath);
264
261
 
265
262
  if (!config.d1_databases?.length) {
266
263
  console.error(chalk.red('\nError: No D1 databases configured in wrangler.toml'));
@@ -341,4 +338,4 @@ process.on('SIGTERM', () => {
341
338
  startStudio().catch((error) => {
342
339
  console.error(chalk.red('\nFailed to start D1 Studio:'), error);
343
340
  process.exit(1);
344
- });
341
+ });