@stackonward/cli 1.2.1 → 1.3.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/dist/index.js +17 -10
- package/dist/index.js.map +1 -1
- package/dist/resources/components/nuxt/site-source/app/app.vue +9 -6
- package/dist/resources/components/nuxt/site-source/app/assets/css/site-shell.css +268 -33
- package/dist/resources/components/nuxt/site-source/app/components/site/ApplicationHeader.vue +7 -4
- package/dist/resources/components/nuxt/site-source/app/components/site/ApplicationShell.vue +1 -1
- package/dist/resources/components/nuxt/site-source/app/components/site/ApplicationSidebar.vue +4 -3
- package/dist/resources/components/nuxt/site-source/app/components/site/BackToTop.vue +4 -12
- package/dist/resources/components/nuxt/site-source/app/components/site/ConsentSettingsButton.vue +24 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ContentArticlePage.vue +18 -6
- package/dist/resources/components/nuxt/site-source/app/components/site/ContentListPage.vue +2 -2
- package/dist/resources/components/nuxt/site-source/app/components/site/CookieConsent.vue +44 -4
- package/dist/resources/components/nuxt/site-source/app/components/site/LocaleSwitcher.vue +57 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/MarketingFooter.vue +11 -9
- package/dist/resources/components/nuxt/site-source/app/components/site/MarketingHeader.vue +31 -19
- package/dist/resources/components/nuxt/site-source/app/components/site/MarketingShell.vue +7 -9
- package/dist/resources/components/nuxt/site-source/app/components/site/SiteBrand.vue +3 -2
- package/dist/resources/components/nuxt/site-source/app/components/site/StaticPage.vue +2 -1
- package/dist/resources/components/nuxt/site-source/app/components/site/ThemeSwitcher.vue +63 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ToastViewport.vue +3 -2
- package/dist/resources/components/nuxt/site-source/app/composables/useConsent.ts +299 -51
- package/dist/resources/components/nuxt/site-source/app/composables/useNavigation.ts +49 -6
- package/dist/resources/components/nuxt/site-source/app/composables/useSeo.ts +4 -2
- package/dist/resources/components/nuxt/site-source/app/composables/useSiteShell.ts +29 -11
- package/dist/resources/components/nuxt/site-source/app/plugins/consent.ts +43 -0
- package/dist/resources/components/nuxt/site-source/app/types/site-shell.ts +146 -59
- package/dist/resources/components/registry.json +30 -0
- package/dist/resources/registry.json +3 -3
- package/dist/resources/templates/nuxt/app/app.config.ts +83 -38
- package/dist/resources/templates/nuxt/app/i18n/locales/en.json +124 -0
- package/dist/resources/templates/nuxt/app/pages/legal/cookies.vue +68 -0
- package/dist/resources/templates/nuxt/nuxt.config.ts +16 -0
- package/dist/resources/templates/nuxt/package.json +2 -2
- package/dist/resources/templates/nuxt/test/unit/consent.test.ts +289 -0
- package/dist/resources/templates/nuxt/vitest.config.ts +6 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -309,23 +309,28 @@ async function loadSnippetsRegistry() {
|
|
|
309
309
|
}
|
|
310
310
|
return {};
|
|
311
311
|
}
|
|
312
|
-
function resolveComponentDependencies(componentName, registry2, resolved = /* @__PURE__ */ new Set()) {
|
|
312
|
+
function resolveComponentDependencies(componentName, registry2, installContext, resolved = /* @__PURE__ */ new Set()) {
|
|
313
313
|
if (resolved.has(componentName)) return [];
|
|
314
314
|
const component = registry2.components[componentName];
|
|
315
315
|
if (!component) {
|
|
316
316
|
throw new Error(`Component "${componentName}" not found in registry`);
|
|
317
317
|
}
|
|
318
|
+
if (component.installContext !== installContext) {
|
|
319
|
+
throw new Error(
|
|
320
|
+
`Component "${componentName}" is only available in the ${component.installContext} install context`
|
|
321
|
+
);
|
|
322
|
+
}
|
|
318
323
|
resolved.add(componentName);
|
|
319
324
|
const deps = [];
|
|
320
325
|
for (const depName of component.registryDependencies) {
|
|
321
|
-
deps.push(...resolveComponentDependencies(depName, registry2, resolved));
|
|
326
|
+
deps.push(...resolveComponentDependencies(depName, registry2, installContext, resolved));
|
|
322
327
|
}
|
|
323
328
|
deps.push(component);
|
|
324
329
|
return deps;
|
|
325
330
|
}
|
|
326
|
-
function getComponentsByFramework(registry2, framework) {
|
|
331
|
+
function getComponentsByFramework(registry2, framework, installContext) {
|
|
327
332
|
return Object.values(registry2.components).filter(
|
|
328
|
-
(c) => c.framework === framework || c.framework === "universal" || framework === "nuxt" && c.framework === "vue"
|
|
333
|
+
(c) => c.installContext === installContext && (c.framework === framework || c.framework === "universal" || framework === "nuxt" && c.framework === "vue")
|
|
329
334
|
);
|
|
330
335
|
}
|
|
331
336
|
function getSnippetsByFramework(registry2, framework) {
|
|
@@ -362,7 +367,7 @@ function findComponentKey(registry2, component) {
|
|
|
362
367
|
}
|
|
363
368
|
function buildComponentInstallPlan(input) {
|
|
364
369
|
const selectedComponents = input.componentKeys.flatMap(
|
|
365
|
-
(key) => resolveComponentDependencies(key, input.registry)
|
|
370
|
+
(key) => resolveComponentDependencies(key, input.registry, input.installContext)
|
|
366
371
|
);
|
|
367
372
|
const components = [
|
|
368
373
|
...new Map(
|
|
@@ -606,7 +611,8 @@ async function installTemplateRegistryItems(templateInfo, targetDir) {
|
|
|
606
611
|
componentKeys: [...registryItems],
|
|
607
612
|
framework: "nuxt",
|
|
608
613
|
projectRoot: targetDir,
|
|
609
|
-
registry: registry2
|
|
614
|
+
registry: registry2,
|
|
615
|
+
installContext: "template"
|
|
610
616
|
});
|
|
611
617
|
await copyFiles(installPlan.filesToCopy, false);
|
|
612
618
|
}
|
|
@@ -704,7 +710,7 @@ async function addComponents(items, options, project, registry2) {
|
|
|
704
710
|
logger.error("Could not detect framework. Supported: Nuxt, Vue, React");
|
|
705
711
|
process.exit(1);
|
|
706
712
|
}
|
|
707
|
-
const availableComponents = getComponentsByFramework(registry2, framework);
|
|
713
|
+
const availableComponents = getComponentsByFramework(registry2, framework, "standalone");
|
|
708
714
|
if (availableComponents.length === 0) {
|
|
709
715
|
logger.warn(`No components available for ${framework}`);
|
|
710
716
|
return;
|
|
@@ -715,7 +721,7 @@ async function addComponents(items, options, project, registry2) {
|
|
|
715
721
|
} else if (items.length > 0) {
|
|
716
722
|
for (const item of items) {
|
|
717
723
|
try {
|
|
718
|
-
const deps = resolveComponentDependencies(item, registry2);
|
|
724
|
+
const deps = resolveComponentDependencies(item, registry2, "standalone");
|
|
719
725
|
selectedComponents.push(...deps);
|
|
720
726
|
} catch (error) {
|
|
721
727
|
logger.error(error.message);
|
|
@@ -744,7 +750,7 @@ async function addComponents(items, options, project, registry2) {
|
|
|
744
750
|
return;
|
|
745
751
|
}
|
|
746
752
|
for (const name of response.components) {
|
|
747
|
-
const deps = resolveComponentDependencies(name, registry2);
|
|
753
|
+
const deps = resolveComponentDependencies(name, registry2, "standalone");
|
|
748
754
|
selectedComponents.push(...deps);
|
|
749
755
|
}
|
|
750
756
|
}
|
|
@@ -775,6 +781,7 @@ async function addComponents(items, options, project, registry2) {
|
|
|
775
781
|
framework,
|
|
776
782
|
projectRoot: project.root,
|
|
777
783
|
registry: registry2,
|
|
784
|
+
installContext: "standalone",
|
|
778
785
|
targetBase: options.path
|
|
779
786
|
});
|
|
780
787
|
const spinner = ora2("Adding components...").start();
|
|
@@ -5576,7 +5583,7 @@ function isFileExistsError(error) {
|
|
|
5576
5583
|
|
|
5577
5584
|
// src/index.ts
|
|
5578
5585
|
var program = new Command();
|
|
5579
|
-
program.name("stackonward").description("Create projects and install reusable components and snippets").version("1.
|
|
5586
|
+
program.name("stackonward").description("Create projects and install reusable components and snippets").version("1.3.0");
|
|
5580
5587
|
program.command("init [name]").description("Create a new project from template").option("-t, --template <template>", "Template to use").option("-d, --dir <directory>", "Target directory").option("--skip-install", "Skip dependency installation").option("--skip-git", "Skip git initialization").option("--module <module>", "Go module path (required for go-backend)").option("--author <author>", "Author name").option("-y, --yes", "Use defaults without interactive prompts").action(init);
|
|
5581
5588
|
program.command("add [items...]").description("Add components or snippets to your project").option("-c, --component", "Add component(s)").option("-s, --snippet", "Add snippet(s)").option("-a, --all", "Add all items in category").option("-y, --yes", "Skip confirmation prompts").option("-o, --overwrite", "Overwrite existing files").option("-p, --path <path>", "Custom install path").action(add);
|
|
5582
5589
|
program.command("list [type]").description("List available templates, components, or snippets").option("-t, --templates", "List templates").option("-c, --components", "List components").option("-s, --snippets", "List snippets").action(list);
|