create-hypercolor 0.2.1 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-hypercolor",
3
- "version": "0.2.1",
3
+ "version": "0.3.2",
4
4
  "description": "Bun create scaffolder for Hypercolor effect workspaces",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -26,12 +26,12 @@
26
26
  "typecheck": "tsc --noEmit"
27
27
  },
28
28
  "dependencies": {
29
- "@clack/prompts": "^1.5.0"
29
+ "@clack/prompts": "^1.7.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^25.9.1",
32
+ "@types/node": "^26.1.2",
33
33
  "bun-types": "^1.3.14",
34
- "typescript": "^6.0.3"
34
+ "typescript": "^7.0.2"
35
35
  },
36
36
  "engines": {
37
37
  "bun": ">=1.2.0",
package/src/scaffold.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { existsSync, readdirSync, readFileSync } from 'node:fs'
2
- import { resolve } from 'node:path'
2
+ import { resolve, win32 } from 'node:path'
3
3
  import { fileURLToPath } from 'node:url'
4
4
 
5
5
  import { normalizeEffectId, normalizeWorkspaceName } from './naming'
@@ -124,5 +124,5 @@ export function resolveEditor(): string | undefined {
124
124
  }
125
125
 
126
126
  export function workspaceNameFromTarget(target: string): string {
127
- return normalizeWorkspaceName(target.split('/').at(-1) ?? target)
127
+ return normalizeWorkspaceName(win32.basename(target))
128
128
  }
package/src/templates.ts CHANGED
@@ -7,12 +7,8 @@ import type { ResolvedTemplates, TemplateKind } from './types'
7
7
  const PACKAGE_ROOT = resolve(import.meta.dirname, '..')
8
8
  const TEMPLATES_ROOT = join(PACKAGE_ROOT, 'templates')
9
9
 
10
- function renderTemplate(content: string, variables: Record<string, string>): string {
11
- let rendered = content
12
- for (const [key, value] of Object.entries(variables)) {
13
- rendered = rendered.replaceAll(`__${key}__`, value)
14
- }
15
- return rendered
10
+ export function renderTemplate(content: string, variables: Record<string, string>): string {
11
+ return content.replace(/__([A-Za-z0-9_]+?)__/g, (token, key: string) => variables[key] ?? token)
16
12
  }
17
13
 
18
14
  function copyTemplateTree(
@@ -109,8 +105,9 @@ export function createWorkspaceFiles(args: {
109
105
  workspaceTemplateDir(template),
110
106
  workspaceDir,
111
107
  {
112
- SDK_PACKAGE_SPEC: sdkPackageSpec,
108
+ SDK_PACKAGE_SPEC_JSON: JSON.stringify(sdkPackageSpec),
113
109
  WORKSPACE_NAME: workspaceName,
110
+ WORKSPACE_NAME_JSON: JSON.stringify(workspaceName),
114
111
  },
115
112
  createdPaths,
116
113
  )
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "__WORKSPACE_NAME__",
2
+ "name": __WORKSPACE_NAME_JSON__,
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "type": "module",
@@ -9,7 +9,7 @@
9
9
  "ship:daemon": "hypercolor install effects/*.html --daemon"
10
10
  },
11
11
  "devDependencies": {
12
- "hypercolor": "__SDK_PACKAGE_SPEC__"
12
+ "hypercolor": __SDK_PACKAGE_SPEC_JSON__
13
13
  },
14
14
  "engines": {
15
15
  "bun": ">=1.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "__WORKSPACE_NAME__",
2
+ "name": __WORKSPACE_NAME_JSON__,
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "type": "module",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@biomejs/biome": "^2.4.6",
18
- "hypercolor": "__SDK_PACKAGE_SPEC__",
18
+ "hypercolor": __SDK_PACKAGE_SPEC_JSON__,
19
19
  "bun-types": "^1.3.12",
20
20
  "typescript": "^5.9.3"
21
21
  },