@stackonward/cli 1.3.3 → 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/dist/index.js +33 -34
- package/dist/index.js.map +1 -1
- package/dist/resources/components/nuxt/site-source/app/app.vue +4 -2
- package/dist/resources/components/nuxt/site-source/app/assets/css/site-shell.css +50 -50
- package/dist/resources/components/nuxt/site-source/app/components/{site/ApplicationHeader.vue → app/Header.vue} +3 -3
- package/dist/resources/components/nuxt/site-source/app/components/{site/ApplicationShell.vue → app/Shell.vue} +2 -2
- package/dist/resources/components/nuxt/site-source/app/components/{site/ApplicationSidebar.vue → app/Sidebar.vue} +2 -2
- package/dist/resources/components/nuxt/site-source/app/components/{ui/CheckoutStatus.vue → checkout/Status.vue} +8 -3
- package/dist/resources/components/nuxt/site-source/app/components/{ui/CheckoutSummary.vue → checkout/Summary.vue} +11 -11
- package/dist/resources/components/nuxt/site-source/app/components/{site/CookieConsent.vue → consent/Banner.vue} +3 -3
- package/dist/resources/components/nuxt/site-source/app/components/{site/ContentArticlePage.vue → content/Article.vue} +3 -3
- package/dist/resources/components/nuxt/site-source/app/components/{site/ContentListPage.vue → content/List.vue} +2 -2
- package/dist/resources/components/nuxt/site-source/app/components/{ui/GoogleSignInButton.vue → google/SignInButton.vue} +3 -3
- package/dist/resources/components/nuxt/site-source/app/components/{site/LocaleSwitcher.vue → locale/Menu.vue} +2 -2
- package/dist/resources/components/nuxt/site-source/app/components/site/{MarketingFooter.vue → Footer.vue} +8 -8
- package/dist/resources/components/nuxt/site-source/app/components/site/{MarketingHeader.vue → Header.vue} +27 -27
- package/dist/resources/components/nuxt/site-source/app/components/site/Shell.vue +29 -0
- package/dist/resources/components/nuxt/site-source/app/components/{site/ThemeSwitcher.vue → theme/Menu.vue} +2 -2
- package/dist/resources/components/nuxt/site-source/app/components/ui/{BaseButton.vue → Button.vue} +1 -8
- package/dist/resources/components/nuxt/site-source/app/components/ui/InfiniteScroll.vue +2 -2
- package/dist/resources/components/nuxt/site-source/app/components/{ui/YoutubeEmbed.vue → youtube/Embed.vue} +10 -2
- package/dist/resources/components/nuxt/site-source/app/composables/useConsent.ts +8 -10
- package/dist/resources/components/nuxt/site-source/app/composables/useNavigation.ts +9 -14
- package/dist/resources/components/nuxt/site-source/app/composables/useSeo.ts +3 -1
- package/dist/resources/components/nuxt/site-source/app/composables/useSiteShell.ts +19 -22
- package/dist/resources/components/nuxt/site-source/app/consent/types.ts +59 -0
- package/dist/resources/components/nuxt/site-source/app/content/types.ts +17 -0
- package/dist/resources/components/nuxt/site-source/app/layouts/app.vue +2 -2
- package/dist/resources/components/nuxt/site-source/app/layouts/default.vue +2 -2
- package/dist/resources/components/nuxt/site-source/app/navigation/types.ts +68 -0
- package/dist/resources/components/nuxt/site-source/app/plugins/consent.ts +2 -2
- package/dist/resources/components/nuxt/site-source/app/site/config.ts +35 -0
- package/dist/resources/components/registry.json +63 -51
- package/dist/resources/registry.json +6 -6
- package/dist/resources/templates/nuxt/README.md +3 -3
- package/dist/resources/templates/nuxt/app/app.config.ts +1 -1
- package/dist/resources/templates/nuxt/app/i18n/locales/en.json +1 -1
- package/dist/resources/templates/nuxt/app/pages/app/index.vue +1 -1
- package/dist/resources/templates/nuxt/app/pages/authors/[slug].vue +2 -2
- package/dist/resources/templates/nuxt/app/pages/blog/[slug].vue +4 -3
- package/dist/resources/templates/nuxt/app/pages/blog/category/[category].vue +2 -2
- package/dist/resources/templates/nuxt/app/pages/blog/index.vue +2 -2
- package/dist/resources/templates/nuxt/app/pages/legal/cookies.vue +3 -3
- package/dist/resources/templates/nuxt/app/pages/legal/privacy.vue +2 -2
- package/dist/resources/templates/nuxt/app/pages/legal/terms.vue +2 -2
- package/dist/resources/templates/nuxt/app/pages/ui/index.vue +45 -45
- package/dist/resources/templates/nuxt/nuxt.config.ts +4 -10
- package/dist/resources/templates/nuxt/package.json +2 -2
- package/dist/resources/templates/nuxt/test/e2e/rendering.test.ts +1 -0
- package/dist/resources/templates/nuxt/test/unit/consent.test.ts +4 -7
- package/package.json +3 -3
- package/dist/resources/components/nuxt/site-source/app/components/site/MarketingShell.vue +0 -33
- package/dist/resources/components/nuxt/site-source/app/types/site-shell.ts +0 -172
- /package/dist/resources/components/nuxt/site-source/app/components/{site/ConsentSettingsButton.vue → consent/Settings.vue} +0 -0
- /package/dist/resources/components/nuxt/site-source/app/components/{site/StaticPage.vue → content/Document.vue} +0 -0
- /package/dist/resources/components/nuxt/site-source/app/components/{site/ToastViewport.vue → feedback/Toast.vue} +0 -0
- /package/dist/resources/components/nuxt/site-source/app/components/site/{SiteBrand.vue → Brand.vue} +0 -0
- /package/dist/resources/components/nuxt/site-source/app/components/ui/{BaseGradientBorder.vue → GradientBorder.vue} +0 -0
- /package/dist/resources/components/nuxt/site-source/app/components/ui/{BaseModal.vue → Modal.vue} +0 -0
- /package/dist/resources/components/nuxt/site-source/app/components/ui/{BasePopover.vue → Popover.vue} +0 -0
- /package/dist/resources/components/nuxt/site-source/app/components/ui/{BaseText.vue → Text.vue} +0 -0
package/dist/index.js
CHANGED
|
@@ -5432,51 +5432,50 @@ import { randomUUID as randomUUID3 } from "crypto";
|
|
|
5432
5432
|
import { mkdir as mkdir4, rename as rename2, rm as rm4, writeFile as writeFile3 } from "fs/promises";
|
|
5433
5433
|
import path19 from "path";
|
|
5434
5434
|
|
|
5435
|
-
// src/analytics/
|
|
5436
|
-
|
|
5435
|
+
// src/analytics/google-tag-manager.ts
|
|
5436
|
+
import {
|
|
5437
|
+
createGTMContainer,
|
|
5438
|
+
getGTMContainerConfigJsonSchema
|
|
5439
|
+
} from "@stackonward/google-tag-manager/container";
|
|
5440
|
+
|
|
5441
|
+
// src/analytics/registry.ts
|
|
5442
|
+
var ArtifactError = class extends Error {
|
|
5437
5443
|
code;
|
|
5438
5444
|
constructor(code, message) {
|
|
5439
5445
|
super(message);
|
|
5440
|
-
this.name = "
|
|
5446
|
+
this.name = "ArtifactError";
|
|
5441
5447
|
this.code = code;
|
|
5442
5448
|
}
|
|
5443
5449
|
};
|
|
5444
|
-
var
|
|
5450
|
+
var GeneratorRegistry = class {
|
|
5445
5451
|
#generators = /* @__PURE__ */ new Map();
|
|
5446
5452
|
constructor(generators) {
|
|
5447
|
-
for (const
|
|
5448
|
-
if (this.#generators.has(
|
|
5449
|
-
throw new
|
|
5453
|
+
for (const generator2 of generators) {
|
|
5454
|
+
if (this.#generators.has(generator2.id)) {
|
|
5455
|
+
throw new ArtifactError(
|
|
5450
5456
|
"duplicate_provider",
|
|
5451
|
-
`Analytics provider is registered more than once: ${
|
|
5457
|
+
`Analytics provider is registered more than once: ${generator2.id}`
|
|
5452
5458
|
);
|
|
5453
5459
|
}
|
|
5454
|
-
this.#generators.set(
|
|
5460
|
+
this.#generators.set(generator2.id, generator2);
|
|
5455
5461
|
}
|
|
5456
5462
|
}
|
|
5457
5463
|
get(provider) {
|
|
5458
|
-
const
|
|
5459
|
-
if (!
|
|
5460
|
-
throw new
|
|
5461
|
-
"unknown_provider",
|
|
5462
|
-
`Unknown analytics provider: ${provider}`
|
|
5463
|
-
);
|
|
5464
|
+
const generator2 = this.#generators.get(provider);
|
|
5465
|
+
if (!generator2) {
|
|
5466
|
+
throw new ArtifactError("unknown_provider", `Unknown analytics provider: ${provider}`);
|
|
5464
5467
|
}
|
|
5465
|
-
return
|
|
5468
|
+
return generator2;
|
|
5466
5469
|
}
|
|
5467
5470
|
};
|
|
5468
5471
|
|
|
5469
5472
|
// src/analytics/google-tag-manager.ts
|
|
5470
|
-
|
|
5471
|
-
createGoogleTagManagerContainer,
|
|
5472
|
-
getGoogleTagManagerContainerConfigJsonSchema
|
|
5473
|
-
} from "@stackonward/google-tag-manager/container";
|
|
5474
|
-
var googleTagManagerArtifactGenerator = {
|
|
5473
|
+
var generator = {
|
|
5475
5474
|
id: "google-tag-manager",
|
|
5476
|
-
schema:
|
|
5475
|
+
schema: getGTMContainerConfigJsonSchema,
|
|
5477
5476
|
generate(input) {
|
|
5478
5477
|
try {
|
|
5479
|
-
const container =
|
|
5478
|
+
const container = createGTMContainer(input);
|
|
5480
5479
|
return {
|
|
5481
5480
|
contents: `${JSON.stringify(container, null, 2)}
|
|
5482
5481
|
`,
|
|
@@ -5488,7 +5487,7 @@ var googleTagManagerArtifactGenerator = {
|
|
|
5488
5487
|
};
|
|
5489
5488
|
} catch (error) {
|
|
5490
5489
|
if (error instanceof Error && error.name === "ZodError") {
|
|
5491
|
-
throw new
|
|
5490
|
+
throw new ArtifactError(
|
|
5492
5491
|
"invalid_configuration",
|
|
5493
5492
|
"Analytics provider configuration is invalid"
|
|
5494
5493
|
);
|
|
@@ -5499,29 +5498,29 @@ var googleTagManagerArtifactGenerator = {
|
|
|
5499
5498
|
};
|
|
5500
5499
|
|
|
5501
5500
|
// src/commands/analytics.ts
|
|
5502
|
-
var registry = new
|
|
5501
|
+
var registry = new GeneratorRegistry([generator]);
|
|
5503
5502
|
function registerAnalytics(program2) {
|
|
5504
5503
|
const analytics = program2.command("analytics").description("Generate reviewed analytics provider configuration artifacts");
|
|
5505
5504
|
analytics.command("schema").description("Print the selected analytics provider configuration schema").requiredOption("--provider <provider>", "Analytics provider").action(
|
|
5506
|
-
(options) =>
|
|
5505
|
+
(options) => runAnalyticsCommand(() => {
|
|
5507
5506
|
process.stdout.write(
|
|
5508
5507
|
`${JSON.stringify(registry.get(options.provider).schema(), null, 2)}
|
|
5509
5508
|
`
|
|
5510
5509
|
);
|
|
5511
5510
|
})
|
|
5512
5511
|
);
|
|
5513
|
-
analytics.command("generate").description("Generate a provider configuration artifact without publishing it").requiredOption("--provider <provider>", "Analytics provider").requiredOption("--config <file>", "Product analytics configuration JSON").requiredOption("--out <file>", "Destination artifact").option("--overwrite", "Replace an existing destination").action((options) =>
|
|
5512
|
+
analytics.command("generate").description("Generate a provider configuration artifact without publishing it").requiredOption("--provider <provider>", "Analytics provider").requiredOption("--config <file>", "Product analytics configuration JSON").requiredOption("--out <file>", "Destination artifact").option("--overwrite", "Replace an existing destination").action((options) => runAnalyticsCommand(() => generateArtifact(options)));
|
|
5514
5513
|
}
|
|
5515
5514
|
async function generateArtifact(options) {
|
|
5516
|
-
const
|
|
5515
|
+
const generator2 = registry.get(options.provider);
|
|
5517
5516
|
const input = await readJson(path19.resolve(options.config));
|
|
5518
5517
|
if (input === null) {
|
|
5519
|
-
throw new
|
|
5518
|
+
throw new ArtifactError(
|
|
5520
5519
|
"configuration_unreadable",
|
|
5521
5520
|
"Analytics configuration must be a readable JSON file"
|
|
5522
5521
|
);
|
|
5523
5522
|
}
|
|
5524
|
-
const artifact =
|
|
5523
|
+
const artifact = generator2.generate(input);
|
|
5525
5524
|
const destination = path19.resolve(options.out);
|
|
5526
5525
|
await writeArtifact(destination, artifact.contents, options.overwrite === true);
|
|
5527
5526
|
process.stdout.write(
|
|
@@ -5544,7 +5543,7 @@ async function writeArtifact(destination, contents, overwrite) {
|
|
|
5544
5543
|
return;
|
|
5545
5544
|
} catch (error) {
|
|
5546
5545
|
if (isFileExistsError(error)) {
|
|
5547
|
-
throw new
|
|
5546
|
+
throw new ArtifactError(
|
|
5548
5547
|
"artifact_exists",
|
|
5549
5548
|
"Analytics artifact already exists; pass --overwrite to replace it"
|
|
5550
5549
|
);
|
|
@@ -5565,11 +5564,11 @@ async function writeArtifact(destination, contents, overwrite) {
|
|
|
5565
5564
|
}
|
|
5566
5565
|
}
|
|
5567
5566
|
}
|
|
5568
|
-
async function
|
|
5567
|
+
async function runAnalyticsCommand(operation) {
|
|
5569
5568
|
try {
|
|
5570
5569
|
await operation();
|
|
5571
5570
|
} catch (error) {
|
|
5572
|
-
const failure = error instanceof
|
|
5571
|
+
const failure = error instanceof ArtifactError ? error : new ArtifactError("analytics_command_failed", "Analytics command failed");
|
|
5573
5572
|
process.stderr.write(
|
|
5574
5573
|
`${JSON.stringify({ schemaVersion: 1, outcome: "failed", code: failure.code })}
|
|
5575
5574
|
`
|
|
@@ -5583,7 +5582,7 @@ function isFileExistsError(error) {
|
|
|
5583
5582
|
|
|
5584
5583
|
// src/index.ts
|
|
5585
5584
|
var program = new Command();
|
|
5586
|
-
program.name("stackonward").description("Create projects and install reusable components and snippets").version("1.
|
|
5585
|
+
program.name("stackonward").description("Create projects and install reusable components and snippets").version("1.4.0");
|
|
5587
5586
|
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);
|
|
5588
5587
|
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);
|
|
5589
5588
|
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);
|