bmdl-sdk 1.3.2 → 1.3.3

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,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { dirname, resolve } from 'path'
3
+ import { basename, dirname, resolve } from 'path'
4
4
  import { fileURLToPath } from 'url'
5
5
  import { existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync } from 'fs'
6
6
 
7
7
  const __dirname = dirname(fileURLToPath(import.meta.url))
8
8
  const projectRoot = process.cwd()
9
+ const projectName = basename(projectRoot)
9
10
  const templatesDir = resolve(__dirname, '../templates')
10
11
  const packageJsonPath = resolve(projectRoot, 'package.json')
11
12
 
@@ -33,6 +34,7 @@ const templateFiles = {
33
34
  'src/dataOptions.ts': 'dataOptions.ts',
34
35
  'src/viewOptions.ts': 'viewOptions.ts',
35
36
  'public/icon.svg': 'icon.svg',
37
+ 'tsconfig.json': 'tsconfig.json',
36
38
  }
37
39
 
38
40
  for (const [dest, template] of Object.entries(templateFiles)) {
@@ -75,7 +77,17 @@ function updatePackageJson(projectRoot) {
75
77
  function updateTypesPath(filePath) {
76
78
  const fileCode = readFileSync(filePath, 'utf-8')
77
79
 
78
- const finalCode = fileCode.replace("from '../'", "from 'bmdl-sdk'")
80
+ let finalCode = fileCode.replace("from '../'", "from 'bmdl-sdk'")
81
+ finalCode = fileCode.replace("NameComponent", kebabToCapitalize(`${sdf}-component`))
79
82
 
80
83
  return finalCode
81
84
  }
85
+
86
+ //
87
+
88
+ function kebabToCapitalize(str) {
89
+ return str
90
+ .split('-')
91
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
92
+ .join('');
93
+ }
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.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
Binary file