@launch77/cli 1.2.0 → 1.4.0
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/CHANGELOG.md +22 -0
- package/dist/cli.js +8 -1
- package/dist/cli.js.map +1 -1
- package/dist/infrastructure/git.d.ts +37 -0
- package/dist/infrastructure/git.d.ts.map +1 -0
- package/dist/infrastructure/git.js +82 -0
- package/dist/infrastructure/git.js.map +1 -0
- package/dist/infrastructure/github.d.ts +43 -0
- package/dist/infrastructure/github.d.ts.map +1 -0
- package/dist/infrastructure/github.js +89 -0
- package/dist/infrastructure/github.js.map +1 -0
- package/dist/infrastructure/template-generator.d.ts +1 -1
- package/dist/infrastructure/template-generator.d.ts.map +1 -1
- package/dist/infrastructure/template.d.ts +5 -0
- package/dist/infrastructure/template.d.ts.map +1 -1
- package/dist/infrastructure/template.js +11 -0
- package/dist/infrastructure/template.js.map +1 -1
- package/dist/modules/app/commands/create-app.js +1 -1
- package/dist/modules/app/commands/create-app.js.map +1 -1
- package/dist/modules/app/commands/delete-app.js +1 -1
- package/dist/modules/app/commands/delete-app.js.map +1 -1
- package/dist/modules/app/services/app-svc.d.ts +1 -1
- package/dist/modules/app/services/app-svc.d.ts.map +1 -1
- package/dist/modules/app/services/manifest-svc.d.ts +1 -1
- package/dist/modules/app/services/manifest-svc.d.ts.map +1 -1
- package/dist/modules/catalog/config/catalog-config.test.js +1 -1
- package/dist/modules/catalog/config/catalog-config.test.js.map +1 -1
- package/dist/modules/catalog/schemas/catalog-ui-components.schema.json +2 -18
- package/dist/modules/git/commands/git-connect.d.ts +3 -0
- package/dist/modules/git/commands/git-connect.d.ts.map +1 -0
- package/dist/modules/git/commands/git-connect.js +156 -0
- package/dist/modules/git/commands/git-connect.js.map +1 -0
- package/dist/modules/git/errors/git-errors.d.ts +21 -0
- package/dist/modules/git/errors/git-errors.d.ts.map +1 -0
- package/dist/modules/git/errors/git-errors.js +41 -0
- package/dist/modules/git/errors/git-errors.js.map +1 -0
- package/dist/modules/git/index.d.ts +5 -0
- package/dist/modules/git/index.d.ts.map +1 -0
- package/dist/modules/git/index.js +8 -0
- package/dist/modules/git/index.js.map +1 -0
- package/dist/modules/git/services/git-service.d.ts +24 -0
- package/dist/modules/git/services/git-service.d.ts.map +1 -0
- package/dist/modules/git/services/git-service.js +56 -0
- package/dist/modules/git/services/git-service.js.map +1 -0
- package/dist/modules/git/services/github-service.d.ts +27 -0
- package/dist/modules/git/services/github-service.d.ts.map +1 -0
- package/dist/modules/git/services/github-service.js +45 -0
- package/dist/modules/git/services/github-service.js.map +1 -0
- package/dist/modules/plugin/commands/plugin-create.d.ts +3 -0
- package/dist/modules/plugin/commands/plugin-create.d.ts.map +1 -0
- package/dist/modules/plugin/commands/plugin-create.js +59 -0
- package/dist/modules/plugin/commands/plugin-create.js.map +1 -0
- package/dist/modules/plugin/commands/plugin-install.d.ts.map +1 -1
- package/dist/modules/plugin/commands/plugin-install.js +9 -24
- package/dist/modules/plugin/commands/plugin-install.js.map +1 -1
- package/dist/modules/plugin/errors/plugin-errors.d.ts +24 -1
- package/dist/modules/plugin/errors/plugin-errors.d.ts.map +1 -1
- package/dist/modules/plugin/errors/plugin-errors.js +79 -6
- package/dist/modules/plugin/errors/plugin-errors.js.map +1 -1
- package/dist/modules/plugin/index.d.ts +4 -2
- package/dist/modules/plugin/index.d.ts.map +1 -1
- package/dist/modules/plugin/index.js +4 -2
- package/dist/modules/plugin/index.js.map +1 -1
- package/dist/modules/plugin/lib/plugin-registry.d.ts +6 -12
- package/dist/modules/plugin/lib/plugin-registry.d.ts.map +1 -1
- package/dist/modules/plugin/lib/plugin-registry.js +13 -30
- package/dist/modules/plugin/lib/plugin-registry.js.map +1 -1
- package/dist/modules/plugin/lib/plugin-resolver.d.ts +76 -0
- package/dist/modules/plugin/lib/plugin-resolver.d.ts.map +1 -0
- package/dist/modules/plugin/lib/plugin-resolver.js +128 -0
- package/dist/modules/plugin/lib/plugin-resolver.js.map +1 -0
- package/dist/modules/plugin/lib/plugin-resolver.test.d.ts +2 -0
- package/dist/modules/plugin/lib/plugin-resolver.test.d.ts.map +1 -0
- package/dist/modules/plugin/lib/plugin-resolver.test.js +175 -0
- package/dist/modules/plugin/lib/plugin-resolver.test.js.map +1 -0
- package/dist/modules/plugin/services/plugin-create-service.d.ts +16 -0
- package/dist/modules/plugin/services/plugin-create-service.d.ts.map +1 -0
- package/dist/modules/plugin/services/plugin-create-service.js +47 -0
- package/dist/modules/plugin/services/plugin-create-service.js.map +1 -0
- package/dist/modules/plugin/services/plugin-svc.d.ts +8 -3
- package/dist/modules/plugin/services/plugin-svc.d.ts.map +1 -1
- package/dist/modules/plugin/services/plugin-svc.js +96 -15
- package/dist/modules/plugin/services/plugin-svc.js.map +1 -1
- package/dist/modules/release/commands/release-init.d.ts +3 -0
- package/dist/modules/release/commands/release-init.d.ts.map +1 -0
- package/dist/modules/release/commands/release-init.js +92 -0
- package/dist/modules/release/commands/release-init.js.map +1 -0
- package/dist/modules/release/errors/release-errors.d.ts +7 -0
- package/dist/modules/release/errors/release-errors.d.ts.map +1 -0
- package/dist/modules/release/errors/release-errors.js +13 -0
- package/dist/modules/release/errors/release-errors.js.map +1 -0
- package/dist/modules/release/index.d.ts +4 -0
- package/dist/modules/release/index.d.ts.map +1 -0
- package/dist/modules/release/index.js +7 -0
- package/dist/modules/release/index.js.map +1 -0
- package/dist/modules/release/services/release-service.d.ts +34 -0
- package/dist/modules/release/services/release-service.d.ts.map +1 -0
- package/dist/modules/release/services/release-service.js +154 -0
- package/dist/modules/release/services/release-service.js.map +1 -0
- package/dist/modules/workspace/commands/init-workspace.d.ts.map +1 -1
- package/dist/modules/workspace/commands/init-workspace.js +4 -5
- package/dist/modules/workspace/commands/init-workspace.js.map +1 -1
- package/dist/modules/workspace/services/workspace-service.d.ts +2 -1
- package/dist/modules/workspace/services/workspace-service.d.ts.map +1 -1
- package/dist/modules/workspace/services/workspace-service.js +27 -1
- package/dist/modules/workspace/services/workspace-service.js.map +1 -1
- package/dist/templates/plugin/README.md.hbs +39 -0
- package/dist/{plugins/theme/package.json → templates/plugin/package.json.hbs} +5 -3
- package/dist/templates/plugin/plugin.json.hbs +7 -0
- package/dist/templates/plugin/src/generator.ts.hbs +64 -0
- package/dist/templates/plugin/templates/src/.gitkeep +0 -0
- package/dist/templates/plugin/tsconfig.json +10 -0
- package/dist/{plugins/theme → templates/plugin}/tsup.config.ts +0 -1
- package/dist/templates/workspace/.github/workflows/ci.yml +102 -0
- package/dist/templates/workspace/package.json +16 -1
- package/dist/templates/workspace/turbo.json +5 -0
- package/dist/utils/launch77-context.d.ts +1 -1
- package/dist/utils/launch77-context.d.ts.map +1 -1
- package/dist/utils/launch77-context.js +25 -2
- package/dist/utils/launch77-context.js.map +1 -1
- package/dist/utils/launch77-validation.d.ts +1 -1
- package/dist/utils/launch77-validation.d.ts.map +1 -1
- package/dist/utils/string.d.ts +13 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/string.js +18 -0
- package/dist/utils/string.js.map +1 -0
- package/package.json +7 -10
- package/src/cli.ts +10 -1
- package/src/infrastructure/git.ts +86 -0
- package/src/infrastructure/github.ts +111 -0
- package/src/infrastructure/template-generator.ts +1 -1
- package/src/infrastructure/template.ts +14 -0
- package/src/modules/app/commands/create-app.ts +1 -1
- package/src/modules/app/commands/delete-app.ts +1 -1
- package/src/modules/app/services/app-svc.ts +1 -1
- package/src/modules/app/services/manifest-svc.ts +1 -1
- package/src/modules/catalog/config/catalog-config.test.ts +1 -1
- package/src/modules/git/commands/git-connect.ts +183 -0
- package/src/modules/git/errors/git-errors.ts +44 -0
- package/src/modules/git/index.ts +9 -0
- package/src/modules/git/services/git-service.ts +63 -0
- package/src/modules/git/services/github-service.ts +52 -0
- package/src/modules/plugin/commands/plugin-create.ts +68 -0
- package/src/modules/plugin/commands/plugin-install.ts +9 -26
- package/src/modules/plugin/errors/plugin-errors.ts +87 -6
- package/src/modules/plugin/index.ts +4 -2
- package/src/modules/plugin/lib/plugin-registry.ts +14 -37
- package/src/modules/plugin/lib/plugin-resolver.test.ts +215 -0
- package/src/modules/plugin/lib/plugin-resolver.ts +160 -0
- package/src/modules/plugin/services/plugin-create-service.ts +69 -0
- package/src/modules/plugin/services/plugin-svc.ts +108 -15
- package/src/modules/release/commands/release-init.ts +102 -0
- package/src/modules/release/errors/release-errors.ts +13 -0
- package/src/modules/release/index.ts +8 -0
- package/src/modules/release/services/release-service.ts +170 -0
- package/src/modules/workspace/commands/init-workspace.ts +4 -6
- package/src/modules/workspace/services/workspace-service.ts +30 -1
- package/src/utils/launch77-context.ts +29 -3
- package/src/utils/launch77-validation.ts +1 -1
- package/src/utils/string.ts +17 -0
- package/templates/plugin/README.md.hbs +39 -0
- package/templates/plugin/package.json.hbs +34 -0
- package/templates/plugin/plugin.json.hbs +7 -0
- package/templates/plugin/src/generator.ts.hbs +64 -0
- package/templates/plugin/templates/src/.gitkeep +0 -0
- package/templates/plugin/tsconfig.json +10 -0
- package/templates/plugin/tsup.config.ts +9 -0
- package/templates/workspace/.github/workflows/ci.yml +102 -0
- package/templates/workspace/package.json +5 -0
- package/templates/workspace/turbo.json +5 -0
- package/tests/integration/cli.test.ts +25 -0
- package/tests/integration/setup.ts +20 -0
- package/vitest.config.ts +9 -0
- package/vitest.integration.config.ts +9 -0
- package/dist/app-templates/webapp/.env.ci +0 -6
- package/dist/app-templates/webapp/.env.example +0 -9
- package/dist/app-templates/webapp/.eslintrc.json +0 -6
- package/dist/app-templates/webapp/README.md.hbs +0 -80
- package/dist/app-templates/webapp/app/about/page.tsx.hbs +0 -41
- package/dist/app-templates/webapp/app/dashboard/page.tsx.hbs +0 -51
- package/dist/app-templates/webapp/app/globals.css +0 -31
- package/dist/app-templates/webapp/app/layout.tsx.hbs +0 -26
- package/dist/app-templates/webapp/app/page.tsx.hbs +0 -30
- package/dist/app-templates/webapp/next.config.js +0 -99
- package/dist/app-templates/webapp/package.json.hbs +0 -30
- package/dist/app-templates/webapp/postcss.config.js +0 -6
- package/dist/app-templates/webapp/tailwind.config.ts +0 -24
- package/dist/app-templates/webapp/tsconfig.json +0 -29
- package/dist/app-templates/webapp/vercel.json.hbs +0 -7
- package/dist/modules/catalog/schemas/schemas/catalog-ui-components.schema.json +0 -145
- package/dist/plugins/theme/plugin.json +0 -9
- package/dist/plugins/theme/src/generator.ts +0 -92
- package/dist/plugins/theme/src/utils/config-modifier.ts +0 -142
- package/dist/plugins/theme/src/utils/css-modifier.ts +0 -89
- package/dist/plugins/theme/templates/app/theme-test/page.tsx +0 -156
- package/dist/plugins/theme/templates/src/modules/theme/README.md +0 -209
- package/dist/plugins/theme/templates/src/modules/theme/config/brand.css +0 -23
- package/dist/plugins/theme/tsconfig.json +0 -14
- package/dist/templates/templates/startup/apps/.gitkeep +0 -8
- package/dist/templates/templates/workspace/.launch77/workspace.json +0 -3
- package/dist/templates/templates/workspace/README.md +0 -62
- package/dist/templates/templates/workspace/app-templates/.gitkeep +0 -1
- package/dist/templates/templates/workspace/apps/.gitkeep +0 -1
- package/dist/templates/templates/workspace/libraries/.gitkeep +0 -1
- package/dist/templates/templates/workspace/package.json +0 -31
- package/dist/templates/templates/workspace/plugins/.gitkeep +0 -1
- package/dist/templates/templates/workspace/tsconfig.json +0 -22
- package/dist/templates/templates/workspace/turbo.json +0 -25
- package/launch77-cli-1.2.0.tgz +0 -0
- package/src/modules/plugin/lib/launch77-workspace.code-workspace +0 -14
- /package/dist/templates/{templates/workspace → workspace}/.eslintignore +0 -0
- /package/dist/templates/{templates/workspace → workspace}/.eslintrc.js +0 -0
- /package/dist/templates/{templates/workspace → workspace}/.husky/pre-push +0 -0
- /package/dist/templates/{templates/workspace → workspace}/.lintstagedrc.json +0 -0
- /package/dist/templates/{templates/workspace → workspace}/.prettierrc +0 -0
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises'
|
|
2
|
-
|
|
3
|
-
export interface AddTailwindPresetResult {
|
|
4
|
-
success: boolean
|
|
5
|
-
error?: string
|
|
6
|
-
alreadyExists?: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Add Launch77 theme preset to tailwind.config.ts
|
|
11
|
-
* Idempotent - won't duplicate if preset already exists
|
|
12
|
-
*/
|
|
13
|
-
export async function addTailwindPreset(
|
|
14
|
-
filePath: string,
|
|
15
|
-
presetRequire: string
|
|
16
|
-
): Promise<AddTailwindPresetResult> {
|
|
17
|
-
try {
|
|
18
|
-
// Check if file exists
|
|
19
|
-
const fileExists = await fs
|
|
20
|
-
.access(filePath)
|
|
21
|
-
.then(() => true)
|
|
22
|
-
.catch(() => false)
|
|
23
|
-
|
|
24
|
-
if (!fileExists) {
|
|
25
|
-
return {
|
|
26
|
-
success: false,
|
|
27
|
-
error: `File not found: ${filePath}`,
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Read file content
|
|
32
|
-
const content = await fs.readFile(filePath, 'utf-8')
|
|
33
|
-
|
|
34
|
-
// Check if preset already exists
|
|
35
|
-
if (content.includes(presetRequire)) {
|
|
36
|
-
return {
|
|
37
|
-
success: true,
|
|
38
|
-
alreadyExists: true,
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Find the config object and check for existing presets property
|
|
43
|
-
const lines = content.split('\n')
|
|
44
|
-
let configStartIndex = -1
|
|
45
|
-
let presetsIndex = -1
|
|
46
|
-
let indentation = ' '
|
|
47
|
-
|
|
48
|
-
// Find where the config object starts
|
|
49
|
-
for (let i = 0; i < lines.length; i++) {
|
|
50
|
-
const line = lines[i]
|
|
51
|
-
|
|
52
|
-
// Look for the config object declaration
|
|
53
|
-
if (line.includes('satisfies Config') || line.includes(': Config =')) {
|
|
54
|
-
configStartIndex = i
|
|
55
|
-
// Detect indentation from first property
|
|
56
|
-
for (let j = i + 1; j < lines.length; j++) {
|
|
57
|
-
const propLine = lines[j]
|
|
58
|
-
const match = propLine.match(/^(\s+)\w+:/)
|
|
59
|
-
if (match) {
|
|
60
|
-
indentation = match[1]
|
|
61
|
-
break
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Check if presets property already exists
|
|
67
|
-
if (line.includes('presets:')) {
|
|
68
|
-
presetsIndex = i
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (configStartIndex === -1) {
|
|
73
|
-
return {
|
|
74
|
-
success: false,
|
|
75
|
-
error: 'Could not find Tailwind config object',
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
let newContent: string
|
|
80
|
-
|
|
81
|
-
if (presetsIndex !== -1) {
|
|
82
|
-
// Presets property exists - add to existing array
|
|
83
|
-
const presetsLine = lines[presetsIndex]
|
|
84
|
-
|
|
85
|
-
// Check if it's an empty array
|
|
86
|
-
if (presetsLine.includes('[]')) {
|
|
87
|
-
// Replace empty array with array containing our preset
|
|
88
|
-
lines[presetsIndex] = presetsLine.replace('[]', `[${presetRequire}]`)
|
|
89
|
-
} else {
|
|
90
|
-
// Add to existing array - find the opening bracket
|
|
91
|
-
const openBracketIndex = presetsLine.indexOf('[')
|
|
92
|
-
if (openBracketIndex !== -1) {
|
|
93
|
-
// Insert after the opening bracket
|
|
94
|
-
lines[presetsIndex] =
|
|
95
|
-
presetsLine.slice(0, openBracketIndex + 1) +
|
|
96
|
-
presetRequire +
|
|
97
|
-
', ' +
|
|
98
|
-
presetsLine.slice(openBracketIndex + 1)
|
|
99
|
-
} else {
|
|
100
|
-
return {
|
|
101
|
-
success: false,
|
|
102
|
-
error: 'Could not parse existing presets array',
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
newContent = lines.join('\n')
|
|
107
|
-
} else {
|
|
108
|
-
// No presets property - add it as first property in config
|
|
109
|
-
// Find the line after config object starts (skip opening brace)
|
|
110
|
-
let insertIndex = configStartIndex + 1
|
|
111
|
-
|
|
112
|
-
// Skip the opening brace line if it's on the same line
|
|
113
|
-
if (lines[configStartIndex].includes('{')) {
|
|
114
|
-
// Opening brace is on same line, insert after
|
|
115
|
-
} else {
|
|
116
|
-
// Find the opening brace
|
|
117
|
-
while (insertIndex < lines.length && !lines[insertIndex].includes('{')) {
|
|
118
|
-
insertIndex++
|
|
119
|
-
}
|
|
120
|
-
insertIndex++
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Insert presets property
|
|
124
|
-
const presetsLine = `${indentation}presets: [${presetRequire}],`
|
|
125
|
-
lines.splice(insertIndex, 0, presetsLine)
|
|
126
|
-
|
|
127
|
-
newContent = lines.join('\n')
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Write back to file
|
|
131
|
-
await fs.writeFile(filePath, newContent, 'utf-8')
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
success: true,
|
|
135
|
-
}
|
|
136
|
-
} catch (error) {
|
|
137
|
-
return {
|
|
138
|
-
success: false,
|
|
139
|
-
error: error instanceof Error ? error.message : String(error),
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises'
|
|
2
|
-
|
|
3
|
-
export interface InsertCssImportsResult {
|
|
4
|
-
success: boolean
|
|
5
|
-
error?: string
|
|
6
|
-
alreadyExists?: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Insert CSS imports after @tailwind directives
|
|
11
|
-
* Idempotent - won't duplicate if imports already exist
|
|
12
|
-
*/
|
|
13
|
-
export async function insertCssImports(
|
|
14
|
-
filePath: string,
|
|
15
|
-
imports: string[]
|
|
16
|
-
): Promise<InsertCssImportsResult> {
|
|
17
|
-
try {
|
|
18
|
-
// Check if file exists
|
|
19
|
-
const fileExists = await fs
|
|
20
|
-
.access(filePath)
|
|
21
|
-
.then(() => true)
|
|
22
|
-
.catch(() => false)
|
|
23
|
-
|
|
24
|
-
if (!fileExists) {
|
|
25
|
-
return {
|
|
26
|
-
success: false,
|
|
27
|
-
error: `File not found: ${filePath}`,
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Read file content
|
|
32
|
-
const content = await fs.readFile(filePath, 'utf-8')
|
|
33
|
-
|
|
34
|
-
// Check if imports already exist
|
|
35
|
-
const allImportsExist = imports.every((importLine) => content.includes(importLine))
|
|
36
|
-
|
|
37
|
-
if (allImportsExist) {
|
|
38
|
-
return {
|
|
39
|
-
success: true,
|
|
40
|
-
alreadyExists: true,
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Find the last @tailwind directive
|
|
45
|
-
const lines = content.split('\n')
|
|
46
|
-
let lastTailwindIndex = -1
|
|
47
|
-
|
|
48
|
-
for (let i = 0; i < lines.length; i++) {
|
|
49
|
-
if (lines[i].trim().startsWith('@tailwind')) {
|
|
50
|
-
lastTailwindIndex = i
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (lastTailwindIndex === -1) {
|
|
55
|
-
return {
|
|
56
|
-
success: false,
|
|
57
|
-
error: 'Could not find @tailwind directives',
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Insert imports after the last @tailwind directive
|
|
62
|
-
const importsToAdd = imports.filter((importLine) => !content.includes(importLine))
|
|
63
|
-
|
|
64
|
-
if (importsToAdd.length === 0) {
|
|
65
|
-
return {
|
|
66
|
-
success: true,
|
|
67
|
-
alreadyExists: true,
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Build the new content
|
|
72
|
-
const before = lines.slice(0, lastTailwindIndex + 1)
|
|
73
|
-
const after = lines.slice(lastTailwindIndex + 1)
|
|
74
|
-
|
|
75
|
-
const newContent = [...before, '', '/* Launch77 Theme */', ...importsToAdd, ...after].join('\n')
|
|
76
|
-
|
|
77
|
-
// Write back to file
|
|
78
|
-
await fs.writeFile(filePath, newContent, 'utf-8')
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
success: true,
|
|
82
|
-
}
|
|
83
|
-
} catch (error) {
|
|
84
|
-
return {
|
|
85
|
-
success: false,
|
|
86
|
-
error: error instanceof Error ? error.message : String(error),
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import Link from 'next/link'
|
|
2
|
-
|
|
3
|
-
export default function ThemeTestPage() {
|
|
4
|
-
return (
|
|
5
|
-
<main className="min-h-screen bg-background p-8">
|
|
6
|
-
<div className="max-w-4xl mx-auto space-y-8">
|
|
7
|
-
{/* Header */}
|
|
8
|
-
<div className="space-y-2">
|
|
9
|
-
<h1 className="text-4xl font-bold text-foreground">
|
|
10
|
-
Theme Test Page
|
|
11
|
-
</h1>
|
|
12
|
-
<p className="text-muted-foreground">
|
|
13
|
-
Test your theme colors and see changes in real-time
|
|
14
|
-
</p>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
{/* Instructions */}
|
|
18
|
-
<div className="bg-card border border-border rounded-lg p-6 space-y-4">
|
|
19
|
-
<h2 className="text-2xl font-semibold text-card-foreground">
|
|
20
|
-
How to Test Your Theme
|
|
21
|
-
</h2>
|
|
22
|
-
<ol className="list-decimal list-inside space-y-2 text-card-foreground">
|
|
23
|
-
<li>Open <code className="bg-muted px-2 py-1 rounded text-sm">app/brand.css</code></li>
|
|
24
|
-
<li>Uncomment and change the color values (HSL format)</li>
|
|
25
|
-
<li>Save the file and watch this page update automatically</li>
|
|
26
|
-
</ol>
|
|
27
|
-
<p className="text-sm text-muted-foreground">
|
|
28
|
-
Example: Change <code className="bg-muted px-2 py-1 rounded">--color-primary</code> to <code className="bg-muted px-2 py-1 rounded">270 91% 65%</code> for purple
|
|
29
|
-
</p>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
{/* Color Swatches */}
|
|
33
|
-
<div className="space-y-4">
|
|
34
|
-
<h2 className="text-2xl font-semibold text-foreground">
|
|
35
|
-
Theme Colors
|
|
36
|
-
</h2>
|
|
37
|
-
<div className="grid grid-cols-2 md:grid-cols-3 gap-4">
|
|
38
|
-
<div className="space-y-2">
|
|
39
|
-
<div className="h-24 bg-primary rounded-lg flex items-center justify-center">
|
|
40
|
-
<span className="text-primary-foreground font-semibold">Primary</span>
|
|
41
|
-
</div>
|
|
42
|
-
<p className="text-sm text-muted-foreground">--color-primary</p>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<div className="space-y-2">
|
|
46
|
-
<div className="h-24 bg-secondary rounded-lg flex items-center justify-center">
|
|
47
|
-
<span className="text-secondary-foreground font-semibold">Secondary</span>
|
|
48
|
-
</div>
|
|
49
|
-
<p className="text-sm text-muted-foreground">--color-secondary</p>
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
<div className="space-y-2">
|
|
53
|
-
<div className="h-24 bg-accent rounded-lg flex items-center justify-center">
|
|
54
|
-
<span className="text-accent-foreground font-semibold">Accent</span>
|
|
55
|
-
</div>
|
|
56
|
-
<p className="text-sm text-muted-foreground">--color-accent</p>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
<div className="space-y-2">
|
|
60
|
-
<div className="h-24 bg-muted rounded-lg flex items-center justify-center">
|
|
61
|
-
<span className="text-muted-foreground font-semibold">Muted</span>
|
|
62
|
-
</div>
|
|
63
|
-
<p className="text-sm text-muted-foreground">--color-muted</p>
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
<div className="space-y-2">
|
|
67
|
-
<div className="h-24 bg-card border border-border rounded-lg flex items-center justify-center">
|
|
68
|
-
<span className="text-card-foreground font-semibold">Card</span>
|
|
69
|
-
</div>
|
|
70
|
-
<p className="text-sm text-muted-foreground">--color-card</p>
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<div className="space-y-2">
|
|
74
|
-
<div className="h-24 bg-destructive rounded-lg flex items-center justify-center">
|
|
75
|
-
<span className="text-destructive-foreground font-semibold">Destructive</span>
|
|
76
|
-
</div>
|
|
77
|
-
<p className="text-sm text-muted-foreground">--color-destructive</p>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
{/* Interactive Components */}
|
|
83
|
-
<div className="space-y-4">
|
|
84
|
-
<h2 className="text-2xl font-semibold text-foreground">
|
|
85
|
-
Component Examples
|
|
86
|
-
</h2>
|
|
87
|
-
|
|
88
|
-
{/* Buttons */}
|
|
89
|
-
<div className="space-y-3">
|
|
90
|
-
<h3 className="text-lg font-medium text-foreground">Buttons</h3>
|
|
91
|
-
<div className="flex flex-wrap gap-3">
|
|
92
|
-
<button className="px-6 py-3 bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity font-medium">
|
|
93
|
-
Primary Button
|
|
94
|
-
</button>
|
|
95
|
-
<button className="px-6 py-3 bg-secondary text-secondary-foreground rounded-lg hover:opacity-90 transition-opacity font-medium">
|
|
96
|
-
Secondary Button
|
|
97
|
-
</button>
|
|
98
|
-
<button className="px-6 py-3 bg-accent text-accent-foreground rounded-lg hover:opacity-90 transition-opacity font-medium">
|
|
99
|
-
Accent Button
|
|
100
|
-
</button>
|
|
101
|
-
<button className="px-6 py-3 bg-destructive text-destructive-foreground rounded-lg hover:opacity-90 transition-opacity font-medium">
|
|
102
|
-
Destructive Button
|
|
103
|
-
</button>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
{/* Cards */}
|
|
108
|
-
<div className="space-y-3">
|
|
109
|
-
<h3 className="text-lg font-medium text-foreground">Cards</h3>
|
|
110
|
-
<div className="grid md:grid-cols-2 gap-4">
|
|
111
|
-
<div className="bg-card border border-border rounded-lg p-6 space-y-2">
|
|
112
|
-
<h4 className="font-semibold text-card-foreground">Card Title</h4>
|
|
113
|
-
<p className="text-muted-foreground">
|
|
114
|
-
This card uses the card background and border colors from your theme.
|
|
115
|
-
</p>
|
|
116
|
-
</div>
|
|
117
|
-
<div className="bg-muted rounded-lg p-6 space-y-2">
|
|
118
|
-
<h4 className="font-semibold text-foreground">Muted Card</h4>
|
|
119
|
-
<p className="text-muted-foreground">
|
|
120
|
-
This card uses the muted background color for a subtle effect.
|
|
121
|
-
</p>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
|
|
126
|
-
{/* Form Elements */}
|
|
127
|
-
<div className="space-y-3">
|
|
128
|
-
<h3 className="text-lg font-medium text-foreground">Form Elements</h3>
|
|
129
|
-
<div className="space-y-3 max-w-md">
|
|
130
|
-
<input
|
|
131
|
-
type="text"
|
|
132
|
-
placeholder="Input with border color"
|
|
133
|
-
className="w-full px-4 py-2 bg-background border border-input rounded-lg focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"
|
|
134
|
-
/>
|
|
135
|
-
<textarea
|
|
136
|
-
placeholder="Textarea with theme colors"
|
|
137
|
-
rows={3}
|
|
138
|
-
className="w-full px-4 py-2 bg-background border border-input rounded-lg focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"
|
|
139
|
-
/>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
{/* Back Link */}
|
|
145
|
-
<div className="pt-8 border-t border-border">
|
|
146
|
-
<Link
|
|
147
|
-
href="/"
|
|
148
|
-
className="inline-flex items-center text-primary hover:underline"
|
|
149
|
-
>
|
|
150
|
-
← Back to Home
|
|
151
|
-
</Link>
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
</main>
|
|
155
|
-
)
|
|
156
|
-
}
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
# Theme Module
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This module provides theme customization using the @launch77-shared/lib-theme Tailwind CSS preset.
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- Launch77 theme preset with semantic color tokens
|
|
10
|
-
- Brand color customization via CSS variables
|
|
11
|
-
- Automatic base styles and accessibility features
|
|
12
|
-
- Dark mode support
|
|
13
|
-
- Theme test page for visual verification
|
|
14
|
-
|
|
15
|
-
## Setup
|
|
16
|
-
|
|
17
|
-
The theme plugin has already installed the @launch77-shared/lib-theme package. Follow these manual steps to complete the setup:
|
|
18
|
-
|
|
19
|
-
### 1. Update app/globals.css
|
|
20
|
-
|
|
21
|
-
Add these imports at the top of your `app/globals.css` file:
|
|
22
|
-
|
|
23
|
-
```css
|
|
24
|
-
@import '@launch77-shared/lib-theme/tokens.css';
|
|
25
|
-
|
|
26
|
-
@tailwind base;
|
|
27
|
-
@tailwind components;
|
|
28
|
-
@tailwind utilities;
|
|
29
|
-
|
|
30
|
-
@import '../src/modules/theme/config/brand.css';
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### 2. Update tailwind.config.ts
|
|
34
|
-
|
|
35
|
-
Replace your Tailwind config with:
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
import type { Config } from 'tailwindcss'
|
|
39
|
-
|
|
40
|
-
const config: Config = {
|
|
41
|
-
presets: [require('@launch77-shared/lib-theme')],
|
|
42
|
-
content: [
|
|
43
|
-
'./app/**/*.{js,ts,jsx,tsx,mdx}',
|
|
44
|
-
'./components/**/*.{js,ts,jsx,tsx,mdx}',
|
|
45
|
-
'./lib/**/*.{js,ts,jsx,tsx,mdx}',
|
|
46
|
-
],
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default config
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Theme Customization
|
|
53
|
-
|
|
54
|
-
### Brand Colors
|
|
55
|
-
|
|
56
|
-
Edit `src/modules/theme/config/brand.css` to customize your brand colors:
|
|
57
|
-
|
|
58
|
-
```css
|
|
59
|
-
:root {
|
|
60
|
-
/* Primary brand color */
|
|
61
|
-
--color-primary: 158 64% 52%;
|
|
62
|
-
--color-primary-foreground: 0 0% 100%;
|
|
63
|
-
|
|
64
|
-
/* Accent color */
|
|
65
|
-
--color-accent: 25 95% 53%;
|
|
66
|
-
--color-accent-foreground: 0 0% 100%;
|
|
67
|
-
|
|
68
|
-
/* Secondary color */
|
|
69
|
-
--color-secondary: 270 50% 40%;
|
|
70
|
-
--color-secondary-foreground: 0 0% 100%;
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### HSL Color Format
|
|
75
|
-
|
|
76
|
-
Colors use HSL format (Hue Saturation Lightness) without the `hsl()` wrapper:
|
|
77
|
-
|
|
78
|
-
- **Hue**: 0-360 (color wheel position)
|
|
79
|
-
- **Saturation**: 0-100% (color intensity)
|
|
80
|
-
- **Lightness**: 0-100% (brightness)
|
|
81
|
-
|
|
82
|
-
Example: `270 91% 65%` = purple
|
|
83
|
-
|
|
84
|
-
### Available Theme Colors
|
|
85
|
-
|
|
86
|
-
The theme includes semantic color tokens:
|
|
87
|
-
|
|
88
|
-
- `primary` - Main brand color
|
|
89
|
-
- `secondary` - Secondary brand color
|
|
90
|
-
- `accent` - Accent/highlight color
|
|
91
|
-
- `muted` - Subtle backgrounds
|
|
92
|
-
- `card` - Card backgrounds
|
|
93
|
-
- `destructive` - Error/danger states
|
|
94
|
-
- `background` - Page background
|
|
95
|
-
- `foreground` - Text color
|
|
96
|
-
- `border` - Border color
|
|
97
|
-
- `input` - Input borders
|
|
98
|
-
- `ring` - Focus rings
|
|
99
|
-
|
|
100
|
-
Each color has a corresponding `-foreground` variant for text on that background.
|
|
101
|
-
|
|
102
|
-
## Testing Your Theme
|
|
103
|
-
|
|
104
|
-
Visit the theme test page to see your theme in action:
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
http://localhost:3000/theme-test
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
The test page shows:
|
|
111
|
-
- All theme color swatches
|
|
112
|
-
- Interactive components (buttons, cards, forms)
|
|
113
|
-
- Real-time updates when you modify brand.css
|
|
114
|
-
|
|
115
|
-
### How to Test
|
|
116
|
-
|
|
117
|
-
1. Open `src/modules/theme/config/brand.css` in your editor
|
|
118
|
-
2. Uncomment and change color values
|
|
119
|
-
3. Save the file
|
|
120
|
-
4. Watch the theme-test page update automatically
|
|
121
|
-
|
|
122
|
-
## Usage in Components
|
|
123
|
-
|
|
124
|
-
Use theme colors via Tailwind utility classes:
|
|
125
|
-
|
|
126
|
-
```tsx
|
|
127
|
-
// Backgrounds
|
|
128
|
-
<div className="bg-primary text-primary-foreground">Primary</div>
|
|
129
|
-
<div className="bg-secondary text-secondary-foreground">Secondary</div>
|
|
130
|
-
<div className="bg-accent text-accent-foreground">Accent</div>
|
|
131
|
-
|
|
132
|
-
// Borders
|
|
133
|
-
<div className="border border-border">With border</div>
|
|
134
|
-
|
|
135
|
-
// Text colors
|
|
136
|
-
<p className="text-foreground">Main text</p>
|
|
137
|
-
<p className="text-muted-foreground">Subtle text</p>
|
|
138
|
-
|
|
139
|
-
// Interactive states
|
|
140
|
-
<button className="bg-primary hover:opacity-90 focus:ring-2 focus:ring-ring">
|
|
141
|
-
Button
|
|
142
|
-
</button>
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## Dark Mode
|
|
146
|
-
|
|
147
|
-
The theme includes dark mode support. Add the `.dark` class to enable:
|
|
148
|
-
|
|
149
|
-
```tsx
|
|
150
|
-
// In your root layout
|
|
151
|
-
<html className={isDarkMode ? 'dark' : ''}>
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
Customize dark mode colors in `brand.css`:
|
|
155
|
-
|
|
156
|
-
```css
|
|
157
|
-
.dark {
|
|
158
|
-
--color-primary: 158 64% 52%;
|
|
159
|
-
--color-primary-foreground: 240 5.9% 10%;
|
|
160
|
-
}
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Module Structure
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
src/modules/theme/
|
|
167
|
-
├── config/
|
|
168
|
-
│ └── brand.css # Brand color customization
|
|
169
|
-
└── README.md # This file
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Troubleshooting
|
|
173
|
-
|
|
174
|
-
### Colors not updating
|
|
175
|
-
|
|
176
|
-
1. Check import order in `globals.css` - brand.css should come AFTER `@tailwind` directives
|
|
177
|
-
2. Ensure brand.css path is correct: `@import '../src/modules/theme/config/brand.css'`
|
|
178
|
-
3. Clear Next.js cache: `rm -rf .next && npm run dev`
|
|
179
|
-
|
|
180
|
-
### Theme preset not working
|
|
181
|
-
|
|
182
|
-
1. Verify `tailwind.config.ts` includes the preset: `presets: [require('@launch77-shared/lib-theme')]`
|
|
183
|
-
2. Check @launch77-shared/lib-theme is installed: `npm list @launch77-shared/lib-theme`
|
|
184
|
-
3. Restart dev server after config changes
|
|
185
|
-
|
|
186
|
-
### TypeScript errors
|
|
187
|
-
|
|
188
|
-
The theme uses CSS variables and Tailwind classes - no TypeScript configuration needed. If you see type errors in CSS files, add to `.gitignore`:
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
*.css.d.ts
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
## Next Steps
|
|
195
|
-
|
|
196
|
-
1. Complete the manual setup steps above
|
|
197
|
-
2. Visit `/theme-test` to verify installation
|
|
198
|
-
3. Customize brand colors in `brand.css`
|
|
199
|
-
4. Start building with Launch77 theme tokens
|
|
200
|
-
|
|
201
|
-
## Documentation
|
|
202
|
-
|
|
203
|
-
For complete theme documentation, see:
|
|
204
|
-
- `node_modules/@launch77-shared/lib-theme/docs/THEME.md`
|
|
205
|
-
- Launch77 theme library documentation
|
|
206
|
-
|
|
207
|
-
## Support
|
|
208
|
-
|
|
209
|
-
For issues or questions about the theme module, refer to the Launch77 documentation or contact the development team.
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* Brand Colors */
|
|
2
|
-
/* Customize your theme by overriding CSS variables */
|
|
3
|
-
|
|
4
|
-
:root {
|
|
5
|
-
/* Example: Customize primary color */
|
|
6
|
-
/* --color-primary: 158 64% 52%; */
|
|
7
|
-
/* --color-primary-foreground: 0 0% 100%; */
|
|
8
|
-
|
|
9
|
-
/* Example: Customize accent color */
|
|
10
|
-
/* --color-accent: 25 95% 53%; */
|
|
11
|
-
/* --color-accent-foreground: 0 0% 100%; */
|
|
12
|
-
|
|
13
|
-
/* Example: Customize secondary color */
|
|
14
|
-
/* --color-secondary: 270 50% 40%; */
|
|
15
|
-
/* --color-secondary-foreground: 0 0% 100%; */
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/* Dark mode overrides */
|
|
19
|
-
.dark {
|
|
20
|
-
/* Example: Customize colors for dark mode */
|
|
21
|
-
/* --color-primary: 158 64% 52%; */
|
|
22
|
-
/* --color-primary-foreground: 240 5.9% 10%; */
|
|
23
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "./dist",
|
|
5
|
-
"rootDir": "./src",
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"moduleResolution": "bundler",
|
|
8
|
-
"target": "ES2022",
|
|
9
|
-
"lib": ["ES2022"],
|
|
10
|
-
"types": ["node"]
|
|
11
|
-
},
|
|
12
|
-
"include": ["src/**/*"],
|
|
13
|
-
"exclude": ["node_modules", "dist"]
|
|
14
|
-
}
|