@create-mastery/cli 0.1.1 → 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/cli.ts CHANGED
@@ -86,7 +86,10 @@ program
86
86
  gen
87
87
  .command('schema')
88
88
  .description('generates the schema for the dictionaries')
89
- .action(() => genSchema())
89
+ .action(() => {
90
+ const projectRoot = requireProjectRoot()
91
+ genSchema(projectRoot)
92
+ })
90
93
 
91
94
  add
92
95
  .command('component')
@@ -2,18 +2,6 @@ import fs from 'node:fs'
2
2
  import path from 'node:path'
3
3
  import chalk from 'chalk'
4
4
  import * as GenerateSchema from 'generate-schema'
5
- import { findProjectRoot } from '../utils/find-project-root'
6
-
7
- const projectRoot = findProjectRoot()
8
-
9
- const dictionarieDir = path.resolve(projectRoot ?? '', 'src/i18n/dictionaries/')
10
- const dictionary = JSON.parse(
11
- fs.readFileSync(`${dictionarieDir}/en.json`, 'utf8')
12
- )
13
- const schemaPath = path.resolve(
14
- projectRoot ?? '',
15
- `${dictionarieDir}/schema.schema.json`
16
- )
17
5
 
18
6
  interface JsonSchema {
19
7
  type: string
@@ -44,7 +32,21 @@ function addRequiredRecursively(
44
32
  }
45
33
  }
46
34
 
47
- export function genSchema() {
35
+ export function genSchema(projectRoot: string) {
36
+ const dictionarieDir = path.resolve(
37
+ projectRoot ?? '',
38
+ 'src/i18n/dictionaries/'
39
+ )
40
+
41
+ const dictionary = JSON.parse(
42
+ fs.readFileSync(`${dictionarieDir}/en.json`, 'utf8')
43
+ )
44
+
45
+ const schemaPath = path.resolve(
46
+ projectRoot ?? '',
47
+ `${dictionarieDir}/schema.schema.json`
48
+ )
49
+
48
50
  const schema = GenerateSchema.json('dictionary schema', dictionary)
49
51
 
50
52
  addRequiredRecursively(schema, dictionary)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@create-mastery/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The official Create Website CLI, created to enhance the DX",
5
5
  "homepage": "https://github.com/Create-Mastery/website/tree/main/cli#readme",
6
6
  "repository": {