rocket-list-cli 0.1.0 → 0.1.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.
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { readFileSync } from 'fs';
3
3
  import { join, dirname } from 'path';
4
4
  import { fileURLToPath } from 'url';
5
- import { ListPageGenerator, findWorkspaceRoot } from './generator.js';
5
+ import { ListPageGenerator } from './generator.js';
6
6
  const __filename = fileURLToPath(import.meta.url);
7
7
  const __dirname = dirname(__filename);
8
8
  const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
@@ -72,11 +72,7 @@ async function main() {
72
72
  process.exit(1);
73
73
  }
74
74
  const appPath = positional[2] ?? 'apps/react/src';
75
- const workspaceRoot = findWorkspaceRoot(process.cwd());
76
- if (!workspaceRoot) {
77
- console.error('Error: turbo.json not found. Run this command inside a project directory.');
78
- process.exit(1);
79
- }
75
+ const workspaceRoot = process.cwd();
80
76
  const templatesDir = flags.templates
81
77
  ? join(workspaceRoot, flags.templates)
82
78
  : undefined;
@@ -41,7 +41,3 @@ export declare class ListPageGenerator {
41
41
  private renderTemplate;
42
42
  generate(id: string, appPath: string): Promise<GenerateResult>;
43
43
  }
44
- /**
45
- * Walk up from startDir looking for turbo.json to locate the workspace root.
46
- */
47
- export declare function findWorkspaceRoot(startDir: string): string | null;
package/dist/generator.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import Handlebars from 'handlebars';
2
2
  import { join, dirname } from 'path';
3
3
  import { readFile, mkdir, writeFile } from 'fs/promises';
4
- import { existsSync } from 'fs';
5
4
  import { fileURLToPath } from 'url';
6
5
  const __filename = fileURLToPath(import.meta.url);
7
6
  const __dirname = dirname(__filename);
@@ -14,7 +13,7 @@ export function toKebabCase(str) {
14
13
  }
15
14
  export function toPascalCase(str) {
16
15
  return str
17
- .split(/[-_\s]+/)
16
+ .split(/[-_\s/]+/)
18
17
  .map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
19
18
  .join('');
20
19
  }
@@ -75,7 +74,7 @@ export class ListPageGenerator {
75
74
  const config = await this.fetchAdminConfig(id);
76
75
  const rawName = config.componentPath || config.path.replace(/^\//, '');
77
76
  const name = toKebabCase(rawName);
78
- const apiName = toKebabCase(config.apiPath || '');
77
+ const apiName = toKebabCase(config.apiPath || 'api');
79
78
  const routerPath = config.routerPath || config.path;
80
79
  const templateData = { name, apiName, schemaData: config.schema, adminConfig: config };
81
80
  const basePath = join(this.workspaceRoot, appPath);
@@ -112,18 +111,3 @@ export class ListPageGenerator {
112
111
  }
113
112
  }
114
113
  }
115
- /**
116
- * Walk up from startDir looking for turbo.json to locate the workspace root.
117
- */
118
- export function findWorkspaceRoot(startDir) {
119
- let dir = startDir;
120
- while (true) {
121
- if (existsSync(join(dir, 'turbo.json'))) {
122
- return dir;
123
- }
124
- const parent = dirname(dir);
125
- if (parent === dir)
126
- return null;
127
- dir = parent;
128
- }
129
- }
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { ListPageGenerator, findWorkspaceRoot, toKebabCase, toPascalCase, } from './generator.js';
1
+ export { ListPageGenerator, toKebabCase, toPascalCase, } from './generator.js';
2
2
  export type { AdminConfig, GenerateResult, GeneratorOptions, } from './generator.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { ListPageGenerator, findWorkspaceRoot, toKebabCase, toPascalCase, } from './generator.js';
1
+ export { ListPageGenerator, toKebabCase, toPascalCase, } from './generator.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rocket-list-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Super List page generator CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",