scb-wc 0.1.9 → 0.1.10

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/scb-wc.mjs CHANGED
@@ -46,6 +46,23 @@ function renameTemplateEntry(name) {
46
46
  return name.startsWith('dot-') ? `.${name.slice(4)}` : name;
47
47
  }
48
48
 
49
+ function toPascalCaseSegment(segment) {
50
+ if (!segment) return '';
51
+ return segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase();
52
+ }
53
+
54
+ function sanitizeStarterNamespace(name) {
55
+ const pascalCaseName = name
56
+ .split(/[^A-Za-z0-9]+/)
57
+ .filter(Boolean)
58
+ .map(toPascalCaseSegment)
59
+ .join('');
60
+
61
+ if (!pascalCaseName) return 'ScbStarterApp';
62
+ if (/^[0-9]/.test(pascalCaseName)) return `_${pascalCaseName}`;
63
+ return pascalCaseName;
64
+ }
65
+
49
66
  function ensureTargetIsCreatable(targetDir) {
50
67
  if (!fs.existsSync(targetDir)) return;
51
68
  const entries = fs.readdirSync(targetDir);
@@ -123,6 +140,7 @@ replacePlaceholders(targetDir, {
123
140
  '__SCB_WC_PACKAGE_NAME__': packageJson.name,
124
141
  '__SCB_WC_VERSION__': packageJson.version,
125
142
  '__STARTER_NAME__': path.basename(targetDir),
143
+ '__STARTER_NAMESPACE__': sanitizeStarterNamespace(path.basename(targetDir)),
126
144
  });
127
145
 
128
146
  console.log(`\nSkapade ${template}-starter i ${targetDir}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scb-wc",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -422,5 +422,5 @@
422
422
  },
423
423
  "./mvc/*": "./mvc/*"
424
424
  },
425
- "buildHash": "6C78F9EF4E48DA41170BD089511421DDA43063F8573209127B80E3F6103A22E3"
425
+ "buildHash": "5CFBC69AE3811CCA97321188740C215913D6850FA07F4413B78F2A8A41D5AC18"
426
426
  }
@@ -1,5 +1,5 @@
1
1
  @using Microsoft.AspNetCore.Components.Routing
2
- @using __STARTER_NAME__.Components.Layout
2
+ @using __STARTER_NAMESPACE__.Components.Layout
3
3
 
4
4
  <Router AppAssembly="@typeof(Program).Assembly">
5
5
  <Found Context="routeData">
@@ -1,10 +1,11 @@
1
1
  @using Microsoft.AspNetCore.Components.Forms
2
2
  @using Microsoft.AspNetCore.Components.Routing
3
3
  @using Microsoft.AspNetCore.Components.Web
4
+ @using static Microsoft.AspNetCore.Components.Web.RenderMode
4
5
  @using Microsoft.JSInterop
5
- @using __STARTER_NAME__
6
- @using __STARTER_NAME__.Components
7
- @using __STARTER_NAME__.Components.Layout
8
- @using __STARTER_NAME__.Components.Pages
9
- @using __STARTER_NAME__.Components.Wrappers
6
+ @using __STARTER_NAMESPACE__
7
+ @using __STARTER_NAMESPACE__.Components
8
+ @using __STARTER_NAMESPACE__.Components.Layout
9
+ @using __STARTER_NAMESPACE__.Components.Pages
10
+ @using __STARTER_NAMESPACE__.Components.Wrappers
10
11
  @using ScbBlazor
@@ -1,4 +1,4 @@
1
- using __STARTER_NAME__.Components;
1
+ using __STARTER_NAMESPACE__.Components;
2
2
 
3
3
  var builder = WebApplication.CreateBuilder(args);
4
4
 
@@ -3,5 +3,6 @@
3
3
  <TargetFramework>net9.0</TargetFramework>
4
4
  <Nullable>enable</Nullable>
5
5
  <ImplicitUsings>enable</ImplicitUsings>
6
+ <RootNamespace>__STARTER_NAMESPACE__</RootNamespace>
6
7
  </PropertyGroup>
7
8
  </Project>