bmdl-sdk 1.3.2 → 1.3.4

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/bin/init.js CHANGED
@@ -1,11 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { dirname, resolve } from 'path'
3
+ import {
4
+ copyFileSync,
5
+ existsSync,
6
+ mkdirSync,
7
+ readFileSync,
8
+ writeFileSync,
9
+ } from 'fs'
10
+ import { basename, dirname, resolve } from 'path'
4
11
  import { fileURLToPath } from 'url'
5
- import { existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync } from 'fs'
6
12
 
7
13
  const __dirname = dirname(fileURLToPath(import.meta.url))
8
14
  const projectRoot = process.cwd()
15
+ const projectName = basename(projectRoot)
9
16
  const templatesDir = resolve(__dirname, '../templates')
10
17
  const packageJsonPath = resolve(projectRoot, 'package.json')
11
18
 
@@ -33,6 +40,7 @@ const templateFiles = {
33
40
  'src/dataOptions.ts': 'dataOptions.ts',
34
41
  'src/viewOptions.ts': 'viewOptions.ts',
35
42
  'public/icon.svg': 'icon.svg',
43
+ 'tsconfig.json': 'tsconfig.json',
36
44
  }
37
45
 
38
46
  for (const [dest, template] of Object.entries(templateFiles)) {
@@ -53,8 +61,8 @@ updatePackageJson(projectRoot)
53
61
 
54
62
  console.log('✅ Project initialized successfully!')
55
63
  console.log('\nNext steps:')
56
- console.log(' 1. yarn install')
57
- console.log(' 2. yarn run dev')
64
+ console.log(' 1. yarn run dev')
65
+ console.log(' 2. yarn run build')
58
66
 
59
67
  //////
60
68
 
@@ -75,7 +83,20 @@ function updatePackageJson(projectRoot) {
75
83
  function updateTypesPath(filePath) {
76
84
  const fileCode = readFileSync(filePath, 'utf-8')
77
85
 
78
- const finalCode = fileCode.replace("from '../'", "from 'bmdl-sdk'")
86
+ let finalCode = fileCode.replace("from '../'", "from 'bmdl-sdk'")
87
+ finalCode = fileCode.replace(
88
+ 'NameComponent',
89
+ kebabToCapitalize(`${projectName}-component`),
90
+ )
79
91
 
80
92
  return finalCode
81
93
  }
94
+
95
+ //
96
+
97
+ function kebabToCapitalize(str) {
98
+ return str
99
+ .split('-')
100
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
101
+ .join('')
102
+ }
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bmdl-sdk",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
Binary file