@salesforce/storefront-next-dev 0.3.0-alpha.1 → 0.3.1-alpha.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.
|
@@ -2,9 +2,9 @@ import { t as logger } from "../logger.js";
|
|
|
2
2
|
import "../logger2.js";
|
|
3
3
|
import { Command, Flags } from "@oclif/core";
|
|
4
4
|
import path from "path";
|
|
5
|
-
import Handlebars from "handlebars";
|
|
6
5
|
import fs from "fs";
|
|
7
6
|
import { fileURLToPath } from "url";
|
|
7
|
+
import Handlebars from "handlebars";
|
|
8
8
|
|
|
9
9
|
//#region src/extensibility/create-instructions.ts
|
|
10
10
|
const SKIP_DIRS = [
|
|
@@ -5,11 +5,9 @@ import { a as trimExtensions, i as validateNoCycles, n as resolveDependenciesFor
|
|
|
5
5
|
import { t as prepareForLocalDev } from "../local-dev-setup.js";
|
|
6
6
|
import { Command, Flags } from "@oclif/core";
|
|
7
7
|
import { execFileSync, execSync } from "child_process";
|
|
8
|
-
import { fileURLToPath } from "node:url";
|
|
9
8
|
import path from "path";
|
|
10
9
|
import fs from "fs-extra";
|
|
11
10
|
import dotenv from "dotenv";
|
|
12
|
-
import Handlebars from "handlebars";
|
|
13
11
|
import prompts from "prompts";
|
|
14
12
|
|
|
15
13
|
//#region src/create-storefront.ts
|
|
@@ -102,22 +100,10 @@ const createStorefront = async (options = {}) => {
|
|
|
102
100
|
recursive: true,
|
|
103
101
|
force: true
|
|
104
102
|
});
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (entry && !entry.startsWith("#") && !entry.startsWith("!") && !entry.includes("/") && !entry.includes("*")) gitignoreExclusions.add(entry);
|
|
110
|
-
}
|
|
111
|
-
const subPackages = fs.readdirSync(outputPath).filter((name) => {
|
|
112
|
-
if (name === "node_modules" || name.startsWith(".")) return false;
|
|
113
|
-
if (gitignoreExclusions.has(name)) return false;
|
|
114
|
-
const subDir = path.join(outputPath, name);
|
|
115
|
-
return fs.statSync(subDir).isDirectory() && fs.existsSync(path.join(subDir, "package.json"));
|
|
116
|
-
});
|
|
117
|
-
const workspaceTemplatePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../templates/pnpm-workspace.yaml.hbs");
|
|
118
|
-
const workspaceTemplate = Handlebars.compile(fs.readFileSync(workspaceTemplatePath, "utf8"));
|
|
119
|
-
const packagesBlock = subPackages.length > 0 ? `packages:\n${subPackages.map((p) => ` - ${p}`).join("\n")}\n` : "";
|
|
120
|
-
fs.writeFileSync(path.join(outputPath, "pnpm-workspace.yaml"), workspaceTemplate({ packages: packagesBlock }));
|
|
103
|
+
const workspaceHbsPath = path.join(outputPath, "pnpm-workspace.yaml.hbs");
|
|
104
|
+
if (!fs.existsSync(workspaceHbsPath)) throw new Error(`Template is missing pnpm-workspace.yaml.hbs.\nExpected at: ${workspaceHbsPath}\nEach template must include this file to generate a pnpm-workspace.yaml for the new project.`);
|
|
105
|
+
fs.copyFileSync(workspaceHbsPath, path.join(outputPath, "pnpm-workspace.yaml"));
|
|
106
|
+
fs.rmSync(workspaceHbsPath);
|
|
121
107
|
if (isLocalPath(template) || options.localPackagesDir) {
|
|
122
108
|
const templatePath = template.replace("file://", "");
|
|
123
109
|
await prepareForLocalDev({
|
|
@@ -192,7 +178,7 @@ const createStorefront = async (options = {}) => {
|
|
|
192
178
|
🎉 Congratulations! Your storefront is ready to use! 🎉
|
|
193
179
|
What's next:
|
|
194
180
|
- Navigate to the storefront directory: cd ${outputPath}
|
|
195
|
-
- Install dependencies:
|
|
181
|
+
- Install dependencies: pnpm install
|
|
196
182
|
- Build the storefront: pnpm run build
|
|
197
183
|
- Run the development server: pnpm run dev
|
|
198
184
|
`;
|
package/dist/logger.js
CHANGED
package/dist/server.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as logger } from "./logger.js";
|
|
2
2
|
import { o as loadRuntimeConfig } from "./config.js";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
3
|
import path from "path";
|
|
5
4
|
import chalk from "chalk";
|
|
6
5
|
import express from "express";
|
|
7
6
|
import { createRequestHandler } from "@react-router/express";
|
|
8
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
9
8
|
import { resolve } from "node:path";
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
10
10
|
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
11
11
|
import compression from "compression";
|
|
12
12
|
import zlib from "node:zlib";
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{{{packages}}}
|
|
2
|
-
# Supply chain security: only these packages may run install scripts.
|
|
3
|
-
# All other packages' lifecycle scripts are blocked by pnpm.
|
|
4
|
-
# To allow a new package, add it here and run: pnpm install
|
|
5
|
-
onlyBuiltDependencies:
|
|
6
|
-
- '@swc/core' # Platform-specific native binding (Rust JS compiler)
|
|
7
|
-
- esbuild # Platform-specific binary download (build tooling)
|
|
8
|
-
- msw # Copies mockServiceWorker.js into project (test mocking)
|
|
9
|
-
- protobufjs # Compiles .proto definitions (gRPC/Google libs)
|
|
10
|
-
- unrs-resolver # Native module setup (eslint-import-resolver)
|
|
11
|
-
|
|
12
|
-
# Refuse npm packages published less than 48 hours ago.
|
|
13
|
-
# Bypass: pnpm install --config.minimumReleaseAge=0
|
|
14
|
-
minimumReleaseAge: 2880
|
|
15
|
-
|
|
16
|
-
# Prevent lockfile version downgrades.
|
|
17
|
-
trustPolicy: no-downgrade
|