@storytype/cli 0.4.0 → 0.5.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.
@@ -278,12 +278,16 @@ function promotedComponent(containerDir, entryFile, fileNames) {
278
278
  }
279
279
  function ownedComponent(dirPath, dirName, entryFile, fileNames) {
280
280
  const expectedDirName = toKebabCase(dirName);
281
+ const name = toPascalCase(getComponentBaseName(entryFile));
282
+ const isOwnFile = (fileName) => getFileType(fileName) === "index" || toPascalCase(getComponentBaseName(fileName)) === name;
281
283
  return {
282
- name: toPascalCase(getComponentBaseName(entryFile)),
284
+ name,
283
285
  currentDir: dirPath,
284
286
  targetDir: dirName === expectedDirName ? dirPath : path.join(path.dirname(dirPath), expectedDirName),
285
287
  entryPath: path.join(dirPath, entryFile),
286
- files: fileNames.map((fileName) => describeFile(dirPath, fileName)),
288
+ files: fileNames.map(
289
+ (fileName) => isOwnFile(fileName) ? describeFile(dirPath, fileName) : foreignFile(dirPath, fileName)
290
+ ),
287
291
  atomicLevel: findAtomicLevel(dirPath),
288
292
  action: dirName === expectedDirName ? "none" : "rename"
289
293
  };
@@ -296,6 +300,14 @@ function describeFile(dirPath, fileName) {
296
300
  type: getFileType(fileName)
297
301
  };
298
302
  }
303
+ function foreignFile(dirPath, fileName) {
304
+ return {
305
+ path: path.join(dirPath, fileName),
306
+ name: fileName,
307
+ targetName: fileName,
308
+ type: "other"
309
+ };
310
+ }
299
311
  function findAtomicLevel(dirPath) {
300
312
  for (const segment of dirPath.split(path.sep).reverse()) {
301
313
  const level = toAtomicLevel(segment);
package/dist/cli.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  toAtomicLevelFromAlias,
16
16
  toKebabCase,
17
17
  toPascalCase
18
- } from "./chunk-G73DMA4C.js";
18
+ } from "./chunk-MCLJ4HXR.js";
19
19
 
20
20
  // src/program.ts
21
21
  import chalk from "chalk";
@@ -23,7 +23,7 @@ import { Argument, Command, Option } from "commander";
23
23
  import path4 from "path";
24
24
 
25
25
  // package.json
26
- var version = "0.4.0";
26
+ var version = "0.5.0";
27
27
 
28
28
  // src/completion/Completion.ts
29
29
  function renderCompletion(program, shell) {
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  analyzeProject,
3
3
  displayResults
4
- } from "./chunk-G73DMA4C.js";
4
+ } from "./chunk-MCLJ4HXR.js";
5
5
 
6
6
  // src/index.ts
7
7
  async function generateComponent(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storytype/cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "CLI tool for scaffolding Storytype components and analyzing project structure",
5
5
  "keywords": [
6
6
  "cli",
@@ -52,7 +52,7 @@
52
52
  "build:templates": "mkdir -p dist/templates && cp -r src/templates/* dist/templates/",
53
53
  "dev": "tsup src/cli.ts src/index.ts --format esm --dts --watch",
54
54
  "clean": "rm -rf dist",
55
- "lint": "tsc --noEmit",
55
+ "lint": "biome lint src",
56
56
  "typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
57
57
  "test": "vitest run --coverage",
58
58
  "test:watch": "vitest",