@vendure-platform/create 0.3.0 → 0.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/cli.js CHANGED
@@ -1,309 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.runStorefrontOnlyCli = runStorefrontOnlyCli;
37
- exports.runCli = runCli;
38
- const p = __importStar(require("@clack/prompts"));
39
- const plugin_registry_1 = require("./plugin-registry");
40
- const PACKAGE_MANAGERS = ['bun', 'npm', 'pnpm'];
41
- function validatePackageManager(pm) {
42
- if (!pm)
43
- return 'bun';
44
- if (PACKAGE_MANAGERS.includes(pm))
45
- return pm;
46
- throw new Error(`Invalid --pm value "${pm}". Must be one of: ${PACKAGE_MANAGERS.join(', ')}`);
47
- }
48
- function validateApiUrl(url) {
49
- if (!url)
50
- return undefined;
51
- try {
52
- new URL(url);
53
- return url;
54
- }
55
- catch {
56
- throw new Error(`Invalid --api-url value "${url}": not a valid URL`);
57
- }
58
- }
59
- function validateProjectName(name) {
60
- if (name.trim().length === 0)
61
- return 'Project name is required';
62
- if (/[^a-zA-Z0-9._-]/.test(name)) {
63
- return 'Project name may only contain letters, numbers, dots, hyphens, and underscores';
64
- }
65
- }
66
- /**
67
- * Build the option list for the plugin multiselect.
68
- *
69
- * Core plugins (`tier: 'core'` or `'core-requires-config'`) are always active
70
- * under `VendurePlatform.init()` and therefore hidden from the prompt — only
71
- * `optional` and `requires-config` plugins appear here. Each option is
72
- * labelled `"<displayName> (<category>)"`, with a `"needs configuration"`
73
- * hint on `requires-config` entries so users understand they only activate
74
- * when picked.
75
- *
76
- * Entries are sorted by category, then display name, so related plugins sit
77
- * together in the list.
78
- */
79
- function buildPluginOptions() {
80
- return plugin_registry_1.pluginRegistry
81
- .filter((pl) => pl.tier === 'optional' || pl.tier === 'requires-config')
82
- .sort((a, b) => {
83
- if (a.category !== b.category)
84
- return a.category.localeCompare(b.category);
85
- return a.displayName.localeCompare(b.displayName);
86
- })
87
- .map((pl) => ({
88
- label: `${pl.displayName} (${pl.category})`,
89
- value: pl.key,
90
- hint: pl.tier === 'requires-config' ? 'needs configuration' : undefined,
91
- }));
92
- }
93
- /** Plugin keys that should be pre-selected in the prompt (all `optional` ones). */
94
- function defaultSelectedKeys() {
95
- return plugin_registry_1.pluginRegistry.filter((pl) => pl.tier === 'optional').map((pl) => pl.key);
96
- }
97
- /**
98
- * Run the CLI in storefront-only mode. Returns options for `scaffoldStorefrontOnly`.
99
- * Interactive prompts kick in for any value not provided via flags.
100
- */
101
- async function runStorefrontOnlyCli(projectNameArg, flags) {
102
- var _a, _b, _c;
103
- const packageManager = validatePackageManager(flags === null || flags === void 0 ? void 0 : flags.pm);
104
- const apiUrl = validateApiUrl(flags === null || flags === void 0 ? void 0 : flags.apiUrl);
105
- const scenario = (_a = flags === null || flags === void 0 ? void 0 : flags.scenario) !== null && _a !== void 0 ? _a : 'customer';
106
- // Non-interactive if project name and api-url are both supplied
107
- if (projectNameArg && apiUrl) {
108
- const validation = validateProjectName(projectNameArg);
109
- if (validation) {
110
- p.log.error(`Error: ${validation}`);
111
- process.exit(1);
112
- }
113
- return {
114
- projectName: projectNameArg,
115
- apiUrl,
116
- scenario,
117
- packageManager,
118
- skipInstall: (flags === null || flags === void 0 ? void 0 : flags.install) === false,
119
- skipGit: (flags === null || flags === void 0 ? void 0 : flags.git) === false,
120
- dryRun: (_b = flags === null || flags === void 0 ? void 0 : flags.dryRun) !== null && _b !== void 0 ? _b : false,
121
- };
122
- }
123
- p.intro('create-vendure-platform (storefront-only)');
124
- if (projectNameArg) {
125
- const validation = validateProjectName(projectNameArg);
126
- if (validation) {
127
- p.cancel(validation);
128
- process.exit(1);
129
- }
130
- }
131
- const answers = await p.group({
132
- projectName: () => {
133
- if (projectNameArg)
134
- return Promise.resolve(projectNameArg);
135
- return p.text({
136
- message: 'Project name:',
137
- validate: validateProjectName,
138
- });
139
- },
140
- apiUrl: () => {
141
- if (apiUrl)
142
- return Promise.resolve(apiUrl);
143
- return p.text({
144
- message: 'Vendure Shop API URL (leave blank to use http://localhost:3500/shop-api):',
145
- placeholder: 'https://shop.example.com/shop-api',
146
- validate: (value) => {
147
- if (!value)
148
- return undefined;
149
- try {
150
- new URL(value);
151
- }
152
- catch {
153
- return 'Must be a valid URL';
154
- }
155
- },
156
- });
157
- },
158
- installDeps: () => p.confirm({
159
- message: `Install dependencies with ${packageManager}?`,
160
- initialValue: true,
161
- }),
162
- }, {
163
- onCancel: () => {
164
- p.cancel('Setup cancelled.');
165
- process.exit(0);
166
- },
167
- });
168
- return {
169
- projectName: answers.projectName,
170
- apiUrl: answers.apiUrl || undefined,
171
- scenario,
172
- packageManager,
173
- skipInstall: !answers.installDeps,
174
- skipGit: (flags === null || flags === void 0 ? void 0 : flags.git) === false,
175
- dryRun: (_c = flags === null || flags === void 0 ? void 0 : flags.dryRun) !== null && _c !== void 0 ? _c : false,
176
- };
177
- }
178
- /**
179
- * Run the CLI to gather scaffold options.
180
- * If all required flags are provided, skips interactive prompts entirely.
181
- */
182
- async function runCli(projectNameArg, flags) {
183
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
184
- const packageManager = validatePackageManager(flags === null || flags === void 0 ? void 0 : flags.pm);
185
- // Non-interactive mode: all required fields provided via flags
186
- if (projectNameArg && (flags === null || flags === void 0 ? void 0 : flags.company) && (flags === null || flags === void 0 ? void 0 : flags.plugins) !== undefined) {
187
- const validation = validateProjectName(projectNameArg);
188
- if (validation) {
189
- p.log.error(`Error: ${validation}`);
190
- process.exit(1);
191
- }
192
- const selectedPlugins = flags.plugins
193
- ? flags.plugins.split(',').map((k) => k.trim()).filter(Boolean)
194
- : [];
195
- return {
196
- projectName: projectNameArg,
197
- companyName: flags.company,
198
- selectedPlugins,
199
- includeStorefront: (_a = flags.storefront) !== null && _a !== void 0 ? _a : true,
200
- createGithubRepo: (_b = flags.github) !== null && _b !== void 0 ? _b : false,
201
- githubOrg: flags.githubOrg,
202
- packageManager,
203
- skipInstall: flags.install === false,
204
- skipGit: flags.git === false,
205
- dryRun: (_c = flags.dryRun) !== null && _c !== void 0 ? _c : false,
206
- registryToken: ((_d = flags.registryToken) === null || _d === void 0 ? void 0 : _d.trim()) || undefined,
207
- licenseToken: ((_e = flags.licenseToken) === null || _e === void 0 ? void 0 : _e.trim()) || undefined,
208
- };
209
- }
210
- // Interactive mode
211
- p.intro('create-vendure-platform');
212
- if (projectNameArg) {
213
- const validation = validateProjectName(projectNameArg);
214
- if (validation) {
215
- p.cancel(validation);
216
- process.exit(1);
217
- }
218
- }
219
- const pluginOptions = buildPluginOptions();
220
- const initialPluginValues = defaultSelectedKeys();
221
- // Prompt ordering: tokens first (so users without them can bail before
222
- // investing in plugin selection), then project metadata, then plugin
223
- // selection, then operational toggles. Two separate prompts because the
224
- // Enterprise Portal issues two distinct tokens: a registry npm auth
225
- // token (for installing private `@vendure-platform/*` packages) and a
226
- // server-side license token (read at boot by the License Guard plugin).
227
- // They have different lifetimes and rotation policies so we never
228
- // collapse them into one prompt.
229
- const answers = await p.group({
230
- projectName: () => {
231
- if (projectNameArg)
232
- return Promise.resolve(projectNameArg);
233
- return p.text({
234
- message: 'Project name:',
235
- validate: validateProjectName,
236
- });
237
- },
238
- registryToken: () => {
239
- if ((flags === null || flags === void 0 ? void 0 : flags.registryToken) !== undefined)
240
- return Promise.resolve(flags.registryToken);
241
- return p.password({
242
- message: `Vendure private-registry npm auth token (from https://enterprise.vendure.io). Used by \`${packageManager} install\`. Leave blank to skip:`,
243
- });
244
- },
245
- licenseToken: () => {
246
- if ((flags === null || flags === void 0 ? void 0 : flags.licenseToken) !== undefined)
247
- return Promise.resolve(flags.licenseToken);
248
- return p.password({
249
- // Distinct from the registry token above — this one is
250
- // checked at server boot by the License Guard plugin.
251
- // Leaving it blank is fine for a first kick-the-tyres run;
252
- // the soft-mode flag emitted into .env still lets the
253
- // server start.
254
- message: 'Vendure Platform license token (server-side, written to .env). Leave blank to skip:',
255
- });
256
- },
257
- companyName: ({ results }) => {
258
- const name = results.projectName;
259
- const defaultCompany = name
260
- .replace(/^vendure-/, '')
261
- .replace(/-demo$/, '')
262
- .replace(/-/g, ' ')
263
- .replace(/\b\w/g, (c) => c.toUpperCase());
264
- return p.text({
265
- message: 'Company name (used in README and project branding):',
266
- defaultValue: defaultCompany,
267
- placeholder: defaultCompany,
268
- });
269
- },
270
- selectedPlugins: () => p.multiselect({
271
- message: 'Optional plugins to include (core plugins are always installed):',
272
- options: pluginOptions,
273
- initialValues: initialPluginValues,
274
- required: false,
275
- }),
276
- includeStorefront: () => p.confirm({
277
- message: 'Include the Next.js storefront?',
278
- initialValue: true,
279
- }),
280
- installDeps: () => p.confirm({
281
- message: `Install dependencies with ${packageManager}?`,
282
- initialValue: true,
283
- }),
284
- }, {
285
- onCancel: () => {
286
- p.cancel('Setup cancelled.');
287
- process.exit(0);
288
- },
289
- });
290
- // GitHub repo creation is not exposed as an interactive prompt — it's an
291
- // internal-demo workflow. Trigger it via `--github [--github-org <org>]`
292
- // (in fully-non-interactive mode, see the early return at the top of this
293
- // function).
294
- const registryTokenRaw = (_g = (_f = answers.registryToken) === null || _f === void 0 ? void 0 : _f.trim()) !== null && _g !== void 0 ? _g : '';
295
- const licenseTokenRaw = (_j = (_h = answers.licenseToken) === null || _h === void 0 ? void 0 : _h.trim()) !== null && _j !== void 0 ? _j : '';
296
- return {
297
- projectName: answers.projectName,
298
- companyName: answers.companyName,
299
- selectedPlugins: answers.selectedPlugins,
300
- includeStorefront: answers.includeStorefront,
301
- createGithubRepo: false,
302
- githubOrg: undefined,
303
- packageManager,
304
- skipInstall: !answers.installDeps,
305
- registryToken: registryTokenRaw === '' ? undefined : registryTokenRaw,
306
- licenseToken: licenseTokenRaw === '' ? undefined : licenseTokenRaw,
307
- };
308
- }
309
- //# sourceMappingURL=cli.js.map
1
+ "use strict";var e=this&&this.__createBinding||(Object.create?function(e,n,r,t){void 0===t&&(t=r);var i=Object.getOwnPropertyDescriptor(n,r);i&&!("get"in i?!n.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return n[r]}}),Object.defineProperty(e,t,i)}:function(e,n,r,t){void 0===t&&(t=r),e[t]=n[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),r=this&&this.__importStar||function(){var r=function(e){return r=Object.getOwnPropertyNames||function(e){var n=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[n.length]=r);return n},r(e)};return function(t){if(t&&t.__esModule)return t;var i={};if(null!=t)for(var o=r(t),l=0;l<o.length;l++)"default"!==o[l]&&e(i,t,o[l]);return n(i,t),i}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.runStorefrontOnlyCli=p,exports.runCli=d;const t=r(require("@clack/prompts")),i=require("./plugin-registry"),o=["bun","npm","pnpm"];function l(e){if(!e)return"bun";if(o.includes(e))return e;throw new Error(`Invalid --pm value "${e}". Must be one of: ${o.join(", ")}`)}function a(e){if(e)try{return new URL(e),e}catch{throw new Error(`Invalid --api-url value "${e}": not a valid URL`)}}function s(e){return 0===e.trim().length?"Project name is required":/[^a-zA-Z0-9._-]/.test(e)?"Project name may only contain letters, numbers, dots, hyphens, and underscores":void 0}function c(){return i.pluginRegistry.filter(e=>"optional"===e.tier||"requires-config"===e.tier).sort((e,n)=>e.category!==n.category?e.category.localeCompare(n.category):e.displayName.localeCompare(n.displayName)).map(e=>({label:`${e.displayName} (${e.category})`,value:e.key,hint:"requires-config"===e.tier?"needs configuration":void 0}))}function u(){return i.pluginRegistry.filter(e=>"optional"===e.tier).map(e=>e.key)}async function p(e,n){var r,i,o;const c=l(null==n?void 0:n.pm),u=a(null==n?void 0:n.apiUrl),p=null!==(r=null==n?void 0:n.scenario)&&void 0!==r?r:"customer";if(e&&u){const r=s(e);return r&&(t.log.error(`Error: ${r}`),process.exit(1)),{projectName:e,apiUrl:u,scenario:p,packageManager:c,skipInstall:!1===(null==n?void 0:n.install),skipGit:!1===(null==n?void 0:n.git),dryRun:null!==(i=null==n?void 0:n.dryRun)&&void 0!==i&&i}}if(t.intro("create-vendure-platform (storefront-only)"),e){const n=s(e);n&&(t.cancel(n),process.exit(1))}const d=await t.group({projectName:()=>e?Promise.resolve(e):t.text({message:"Project name:",validate:s}),apiUrl:()=>u?Promise.resolve(u):t.text({message:"Vendure Shop API URL (leave blank to use http://localhost:3500/shop-api):",placeholder:"https://shop.example.com/shop-api",validate:e=>{if(e)try{new URL(e)}catch{return"Must be a valid URL"}}}),installDeps:()=>t.confirm({message:`Install dependencies with ${c}?`,initialValue:!0})},{onCancel:()=>{t.cancel("Setup cancelled."),process.exit(0)}});return{projectName:d.projectName,apiUrl:d.apiUrl||void 0,scenario:p,packageManager:c,skipInstall:!d.installDeps,skipGit:!1===(null==n?void 0:n.git),dryRun:null!==(o=null==n?void 0:n.dryRun)&&void 0!==o&&o}}async function d(e,n){var r,i,o,a,p,d,m,v,g;const f=l(null==n?void 0:n.pm);if(e&&(null==n?void 0:n.company)&&void 0!==(null==n?void 0:n.plugins)){const l=s(e);l&&(t.log.error(`Error: ${l}`),process.exit(1));const c=n.plugins?n.plugins.split(",").map(e=>e.trim()).filter(Boolean):[];return{projectName:e,companyName:n.company,selectedPlugins:c,includeStorefront:null===(r=n.storefront)||void 0===r||r,createGithubRepo:null!==(i=n.github)&&void 0!==i&&i,githubOrg:n.githubOrg,packageManager:f,skipInstall:!1===n.install,skipGit:!1===n.git,dryRun:null!==(o=n.dryRun)&&void 0!==o&&o,registryToken:(null===(a=n.registryToken)||void 0===a?void 0:a.trim())||void 0,licenseToken:(null===(p=n.licenseToken)||void 0===p?void 0:p.trim())||void 0}}if(t.intro("create-vendure-platform"),e){const n=s(e);n&&(t.cancel(n),process.exit(1))}const y=c(),h=u(),k=await t.group({projectName:()=>e?Promise.resolve(e):t.text({message:"Project name:",validate:s}),registryToken:()=>void 0!==(null==n?void 0:n.registryToken)?Promise.resolve(n.registryToken):t.password({message:`Vendure private-registry npm auth token (from https://enterprise.vendure.io). Used by \`${f} install\`. Leave blank to skip:`}),licenseToken:()=>void 0!==(null==n?void 0:n.licenseToken)?Promise.resolve(n.licenseToken):t.password({message:"Vendure Platform license token (server-side, written to .env). Leave blank to skip:"}),companyName:({results:e})=>{const n=e.projectName.replace(/^vendure-/,"").replace(/-demo$/,"").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase());return t.text({message:"Company name (used in README and project branding):",defaultValue:n,placeholder:n})},selectedPlugins:()=>t.multiselect({message:"Optional plugins to include (core plugins are always installed):",options:y,initialValues:h,required:!1}),includeStorefront:()=>t.confirm({message:"Include the Next.js storefront?",initialValue:!0}),installDeps:()=>t.confirm({message:`Install dependencies with ${f}?`,initialValue:!0})},{onCancel:()=>{t.cancel("Setup cancelled."),process.exit(0)}}),b=null!==(m=null===(d=k.registryToken)||void 0===d?void 0:d.trim())&&void 0!==m?m:"",j=null!==(g=null===(v=k.licenseToken)||void 0===v?void 0:v.trim())&&void 0!==g?g:"";return{projectName:k.projectName,companyName:k.companyName,selectedPlugins:k.selectedPlugins,includeStorefront:k.includeStorefront,createGithubRepo:!1,githubOrg:void 0,packageManager:f,skipInstall:!k.installDeps,registryToken:""===b?void 0:b,licenseToken:""===j?void 0:j}}
package/dist/git-init.js CHANGED
@@ -1,60 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.initGit = initGit;
37
- const child_process_1 = require("child_process");
38
- const path = __importStar(require("path"));
39
- /**
40
- * Initialize a git repository and optionally create a GitHub repo.
41
- */
42
- async function initGit(projectDir, createGithubRepo, githubOrg) {
43
- const projectName = path.basename(projectDir);
44
- (0, child_process_1.execSync)('git init', { cwd: projectDir, stdio: 'pipe' });
45
- (0, child_process_1.execSync)('git add -A', { cwd: projectDir, stdio: 'pipe' });
46
- (0, child_process_1.execSync)('git commit -m "Initial scaffold from @vendure-platform/create"', {
47
- cwd: projectDir,
48
- stdio: 'pipe',
49
- });
50
- if (createGithubRepo && githubOrg) {
51
- const repoName = `${githubOrg}/${projectName}`;
52
- try {
53
- (0, child_process_1.execSync)(`gh repo create ${repoName} --private --source=. --push`, { cwd: projectDir, stdio: 'pipe' });
54
- }
55
- catch (err) {
56
- throw err;
57
- }
58
- }
59
- }
60
- //# sourceMappingURL=git-init.js.map
1
+ "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(){var r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},r(e)};return function(i){if(i&&i.__esModule)return i;var n={};if(null!=i)for(var c=r(i),o=0;o<c.length;o++)"default"!==c[o]&&e(n,i,c[o]);return t(n,i),n}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.initGit=c;const i=require("child_process"),n=r(require("path"));async function c(e,t,r){const c=n.basename(e);if((0,i.execSync)("git init",{cwd:e,stdio:"pipe"}),(0,i.execSync)("git add -A",{cwd:e,stdio:"pipe"}),(0,i.execSync)('git commit -m "Initial scaffold from @vendure-platform/create"',{cwd:e,stdio:"pipe"}),t&&r){const t=`${r}/${c}`;try{(0,i.execSync)(`gh repo create ${t} --private --source=. --push`,{cwd:e,stdio:"pipe"})}catch(e){throw e}}}
package/dist/index.js CHANGED
@@ -1,19 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runStorefrontOnlyCli = exports.runCli = exports.getPlugin = exports.SELECTABLE_KEYS = exports.ALWAYS_ACTIVE_KEYS = exports.resolveActivePluginKeys = exports.INTERNAL_PACKAGES = exports.pluginRegistry = exports.scaffoldStorefrontOnly = exports.TEMPLATE_FILES = exports.scaffold = void 0;
4
- var scaffolder_1 = require("./scaffolder");
5
- Object.defineProperty(exports, "scaffold", { enumerable: true, get: function () { return scaffolder_1.scaffold; } });
6
- Object.defineProperty(exports, "TEMPLATE_FILES", { enumerable: true, get: function () { return scaffolder_1.TEMPLATE_FILES; } });
7
- var scaffold_storefront_only_1 = require("./scaffold-storefront-only");
8
- Object.defineProperty(exports, "scaffoldStorefrontOnly", { enumerable: true, get: function () { return scaffold_storefront_only_1.scaffoldStorefrontOnly; } });
9
- var plugin_registry_1 = require("./plugin-registry");
10
- Object.defineProperty(exports, "pluginRegistry", { enumerable: true, get: function () { return plugin_registry_1.pluginRegistry; } });
11
- Object.defineProperty(exports, "INTERNAL_PACKAGES", { enumerable: true, get: function () { return plugin_registry_1.INTERNAL_PACKAGES; } });
12
- Object.defineProperty(exports, "resolveActivePluginKeys", { enumerable: true, get: function () { return plugin_registry_1.resolveActivePluginKeys; } });
13
- Object.defineProperty(exports, "ALWAYS_ACTIVE_KEYS", { enumerable: true, get: function () { return plugin_registry_1.ALWAYS_ACTIVE_KEYS; } });
14
- Object.defineProperty(exports, "SELECTABLE_KEYS", { enumerable: true, get: function () { return plugin_registry_1.SELECTABLE_KEYS; } });
15
- Object.defineProperty(exports, "getPlugin", { enumerable: true, get: function () { return plugin_registry_1.getPlugin; } });
16
- var cli_1 = require("./cli");
17
- Object.defineProperty(exports, "runCli", { enumerable: true, get: function () { return cli_1.runCli; } });
18
- Object.defineProperty(exports, "runStorefrontOnlyCli", { enumerable: true, get: function () { return cli_1.runStorefrontOnlyCli; } });
19
- //# sourceMappingURL=index.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.runStorefrontOnlyCli=exports.runCli=exports.getPlugin=exports.SELECTABLE_KEYS=exports.ALWAYS_ACTIVE_KEYS=exports.resolveActivePluginKeys=exports.INTERNAL_PACKAGES=exports.pluginRegistry=exports.scaffoldStorefrontOnly=exports.TEMPLATE_FILES=exports.scaffold=void 0;var e=require("./scaffolder");Object.defineProperty(exports,"scaffold",{enumerable:!0,get:function(){return e.scaffold}}),Object.defineProperty(exports,"TEMPLATE_FILES",{enumerable:!0,get:function(){return e.TEMPLATE_FILES}});var r=require("./scaffold-storefront-only");Object.defineProperty(exports,"scaffoldStorefrontOnly",{enumerable:!0,get:function(){return r.scaffoldStorefrontOnly}});var t=require("./plugin-registry");Object.defineProperty(exports,"pluginRegistry",{enumerable:!0,get:function(){return t.pluginRegistry}}),Object.defineProperty(exports,"INTERNAL_PACKAGES",{enumerable:!0,get:function(){return t.INTERNAL_PACKAGES}}),Object.defineProperty(exports,"resolveActivePluginKeys",{enumerable:!0,get:function(){return t.resolveActivePluginKeys}}),Object.defineProperty(exports,"ALWAYS_ACTIVE_KEYS",{enumerable:!0,get:function(){return t.ALWAYS_ACTIVE_KEYS}}),Object.defineProperty(exports,"SELECTABLE_KEYS",{enumerable:!0,get:function(){return t.SELECTABLE_KEYS}}),Object.defineProperty(exports,"getPlugin",{enumerable:!0,get:function(){return t.getPlugin}});var n=require("./cli");Object.defineProperty(exports,"runCli",{enumerable:!0,get:function(){return n.runCli}}),Object.defineProperty(exports,"runStorefrontOnlyCli",{enumerable:!0,get:function(){return n.runStorefrontOnlyCli}});
@@ -1,203 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SELECTABLE_KEYS = exports.ALWAYS_ACTIVE_KEYS = exports.INTERNAL_PACKAGES = exports.pluginRegistry = void 0;
4
- exports.getPlugin = getPlugin;
5
- exports.resolveActivePluginKeys = resolveActivePluginKeys;
6
- const plugin_meta_1 = require("@vendure-platform/plugin-meta");
7
- /**
8
- * Scaffolder-specific data keyed by `PluginMeta.key`. The "shared" half of
9
- * each plugin's data (tier, dependencies, packageName, displayName,
10
- * category) lives in `@vendure-platform/plugin-meta`; this map only contains
11
- * what's specific to scaffolding text files — env vars to emit into `.env`,
12
- * the options block to emit into `VendurePlatform.init({...})`, and any
13
- * extra imports the options block requires.
14
- *
15
- * Typed against `PluginMetaKey` so adding a new entry to `PLUGIN_META`
16
- * without a matching extras block is a compile error.
17
- */
18
- const SCAFFOLDER_EXTRAS = {
19
- 'license-guard': {
20
- envVars: [{ name: 'VENDURE_PLATFORM_LICENSE_TOKEN', defaultValue: 'dev-license-token' }],
21
- platformOptionsBlock: `licenseGuard: {
22
- token: process.env.VENDURE_PLATFORM_LICENSE_TOKEN,
23
- }`,
24
- },
25
- 'org-hierarchy': {
26
- envVars: [],
27
- platformOptionsBlock: '',
28
- },
29
- 'advanced-search': {
30
- envVars: [
31
- { name: 'TYPESENSE_API_KEY', defaultValue: 'your-typesense-api-key' },
32
- { name: 'TYPESENSE_HOST', defaultValue: 'localhost' },
33
- { name: 'TYPESENSE_PORT', defaultValue: '8108' },
34
- { name: 'TYPESENSE_PROTOCOL', defaultValue: 'http' },
35
- ],
36
- platformOptionsBlock: `advancedSearch: {
37
- typeSenseClientOptions: {
38
- apiKey: process.env.TYPESENSE_API_KEY as string,
39
- nodes: [
40
- {
41
- host: process.env.TYPESENSE_HOST as string,
42
- port: Number(process.env.TYPESENSE_PORT ?? 8108),
43
- protocol: (process.env.TYPESENSE_PROTOCOL ?? 'http') as 'http' | 'https',
44
- },
45
- ],
46
- },
47
- analytics: {
48
- analyticsStrategy: new SqlAnalyticsStrategy(),
49
- },
50
- }`,
51
- platformImports: [`import { SqlAnalyticsStrategy } from '@vendure-platform/advanced-search';`],
52
- },
53
- 'workflow-engine': {
54
- envVars: [{ name: 'WORKFLOW_ENGINE_SCHEMA', defaultValue: 'dbos' }],
55
- platformOptionsBlock: `workflowEngine: {
56
- databaseConnection: {
57
- host: process.env.DB_HOST ?? 'localhost',
58
- port: Number(process.env.DB_PORT ?? 5432),
59
- database: process.env.DB_NAME ?? 'vendure',
60
- username: process.env.DB_USERNAME ?? 'vendure',
61
- password: process.env.DB_PASSWORD ?? 'vendure',
62
- ssl: process.env.APP_ENV === 'production',
63
- },
64
- systemDatabaseSchemaName: process.env.WORKFLOW_ENGINE_SCHEMA ?? 'dbos',
65
- applicationVersion: 'v1',
66
- }`,
67
- },
68
- 'approval-workflows': { envVars: [], platformOptionsBlock: '' },
69
- 'global-search': { envVars: [], platformOptionsBlock: '' },
70
- 'entity-access-control': { envVars: [], platformOptionsBlock: '' },
71
- 'tax-id-management': { envVars: [], platformOptionsBlock: '' },
72
- 'shopping-list': { envVars: [], platformOptionsBlock: '' },
73
- 'quick-order': { envVars: [], platformOptionsBlock: '' },
74
- 'reorder-from-history': { envVars: [], platformOptionsBlock: '' },
75
- 'store-credit': {
76
- envVars: [],
77
- platformOptionsBlock: `storeCredit: {
78
- availableFontStacks: [
79
- 'Arial, Helvetica Neue, Helvetica, sans-serif',
80
- 'Impact, Charcoal, sans-serif',
81
- ],
82
- createDefaultGiftCardProduct: {
83
- name: 'Gift Card',
84
- sku: 'GC01',
85
- },
86
- }`,
87
- },
88
- 'quote-management': { envVars: [], platformOptionsBlock: '' },
89
- 'price-rules': { envVars: [], platformOptionsBlock: '' },
90
- 'packaging-units': { envVars: [], platformOptionsBlock: '' },
91
- 'content-versioning': { envVars: [], platformOptionsBlock: '' },
92
- 'configurator': { envVars: [], platformOptionsBlock: '' },
93
- 'sso': {
94
- envVars: [
95
- { name: 'GOOGLE_CLIENT_ID', defaultValue: '' },
96
- { name: 'GOOGLE_CLIENT_SECRET', defaultValue: '' },
97
- { name: 'VENDURE_HOST', defaultValue: 'http://localhost:3500' },
98
- ],
99
- platformOptionsBlock: `sso: {
100
- vendureHost: process.env.VENDURE_HOST ?? 'http://localhost:3500',
101
- providers: [
102
- {
103
- type: 'oidc',
104
- id: 'google',
105
- displayName: 'Google SSO',
106
- issuerUrl: 'https://accounts.google.com',
107
- clientId: process.env.GOOGLE_CLIENT_ID ?? '',
108
- clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? '',
109
- scopes: ['openid', 'profile', 'email'],
110
- },
111
- ],
112
- }`,
113
- },
114
- 'audit-trail': {
115
- envVars: [],
116
- platformOptionsBlock: `auditTrail: (defaults) => ({
117
- ...defaults,
118
- logSink: new DatabaseLogSink({
119
- dataSourceOptions: {
120
- type: 'postgres',
121
- host: process.env.DB_HOST ?? 'localhost',
122
- port: Number(process.env.DB_PORT ?? 5432),
123
- database: process.env.DB_NAME ?? 'vendure',
124
- schema: process.env.AUDIT_LOG_SCHEMA ?? 'audit_trail',
125
- username: process.env.DB_USERNAME ?? 'vendure',
126
- password: process.env.DB_PASSWORD ?? 'vendure',
127
- synchronize: true,
128
- },
129
- }),
130
- })`,
131
- platformImports: [`import { DatabaseLogSink } from '@vendure-platform/audit-trail';`],
132
- },
133
- };
134
- /**
135
- * The full registry consumed by the scaffolder: the shared `PluginMeta` from
136
- * `@vendure-platform/plugin-meta` joined with the local scaffolder extras.
137
- *
138
- * This list contains only plugins that `VendurePlatform` manages. Plugins
139
- * that exist in the monorepo but are never registered via
140
- * `VendurePlatform.init()` (e.g. `@vendure-platform/integration`,
141
- * `@vendure-platform/platform` itself, `@vendure-platform/demo-center`) are
142
- * acknowledged in `INTERNAL_PACKAGES` below so the CI testbed-coverage script
143
- * can see them — they're not part of this registry.
144
- */
145
- exports.pluginRegistry = plugin_meta_1.PLUGIN_META.map((meta) => ({
146
- ...meta,
147
- ...SCAFFOLDER_EXTRAS[meta.key],
148
- }));
149
- /**
150
- * Acknowledged plugin packages that intentionally do NOT participate in
151
- * `VendurePlatform.init()` and therefore don't appear in `pluginRegistry`:
152
- *
153
- * - `@vendure-platform/platform`: the umbrella package itself. Imported
154
- * directly by the generated `vendure-config.ts`.
155
- * - `@vendure-platform/integration`: integration sub-plugins consumed by
156
- * `VendurePlatform`'s `INTEGRATION_MAP`. Wired automatically.
157
- * - `@vendure-platform/demo-center`: internal-only, used by the official
158
- * Vendure demo server. Never scaffolded into customer projects.
159
- *
160
- * Each entry is annotated with an `// @internal-package` sentinel comment
161
- * that `.github/scripts/check-testbed-coverage.js` greps for to confirm a
162
- * `@VendurePlugin`-decorated package is intentionally internal rather than
163
- * missing from the registry. Don't rename or remove the sentinel without
164
- * also updating the script.
165
- */
166
- exports.INTERNAL_PACKAGES = [
167
- // @internal-package
168
- { packageName: '@vendure-platform/platform' },
169
- // @internal-package
170
- { packageName: '@vendure-platform/integration' },
171
- // @internal-package
172
- { packageName: '@vendure-platform/demo-center' },
173
- ];
174
- function getPlugin(key) {
175
- return exports.pluginRegistry.find((p) => p.key === key);
176
- }
177
- /** Plugin keys that are always active under `VendurePlatform`, regardless of selection. */
178
- exports.ALWAYS_ACTIVE_KEYS = exports.pluginRegistry
179
- .filter((p) => p.tier === 'core' || p.tier === 'core-requires-config')
180
- .map((p) => p.key);
181
- /**
182
- * Plugin keys that are eligible to appear in the interactive selection prompt:
183
- * everything except the always-active core plugins.
184
- */
185
- exports.SELECTABLE_KEYS = exports.pluginRegistry
186
- .filter((p) => p.tier !== 'core' && p.tier !== 'core-requires-config')
187
- .map((p) => p.key);
188
- /**
189
- * Compute the set of plugin keys whose options/imports/env vars should be
190
- * emitted into the generated project — always-active core plus the user's
191
- * selected optional / requires-config plugins. Result preserves registry order.
192
- */
193
- function resolveActivePluginKeys(selected) {
194
- const activeSet = new Set(exports.ALWAYS_ACTIVE_KEYS);
195
- for (const key of selected) {
196
- if (!getPlugin(key)) {
197
- throw new Error(`Unknown plugin key: "${key}"`);
198
- }
199
- activeSet.add(key);
200
- }
201
- return exports.pluginRegistry.filter((p) => activeSet.has(p.key)).map((p) => p.key);
202
- }
203
- //# sourceMappingURL=plugin-registry.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SELECTABLE_KEYS=exports.ALWAYS_ACTIVE_KEYS=exports.INTERNAL_PACKAGES=exports.pluginRegistry=void 0,exports.getPlugin=o,exports.resolveActivePluginKeys=t;const e=require("@vendure-platform/plugin-meta"),n={"license-guard":{envVars:[{name:"VENDURE_PLATFORM_LICENSE_TOKEN",defaultValue:"dev-license-token"}],platformOptionsBlock:"licenseGuard: {\n token: process.env.VENDURE_PLATFORM_LICENSE_TOKEN,\n }"},"org-hierarchy":{envVars:[],platformOptionsBlock:""},"advanced-search":{envVars:[{name:"TYPESENSE_API_KEY",defaultValue:"your-typesense-api-key"},{name:"TYPESENSE_HOST",defaultValue:"localhost"},{name:"TYPESENSE_PORT",defaultValue:"8108"},{name:"TYPESENSE_PROTOCOL",defaultValue:"http"}],platformOptionsBlock:"advancedSearch: {\n typeSenseClientOptions: {\n apiKey: process.env.TYPESENSE_API_KEY as string,\n nodes: [\n {\n host: process.env.TYPESENSE_HOST as string,\n port: Number(process.env.TYPESENSE_PORT ?? 8108),\n protocol: (process.env.TYPESENSE_PROTOCOL ?? 'http') as 'http' | 'https',\n },\n ],\n },\n analytics: {\n analyticsStrategy: new SqlAnalyticsStrategy(),\n },\n }",platformImports:["import { SqlAnalyticsStrategy } from '@vendure-platform/advanced-search';"]},"workflow-engine":{envVars:[{name:"WORKFLOW_ENGINE_SCHEMA",defaultValue:"dbos"}],platformOptionsBlock:"workflowEngine: {\n databaseConnection: {\n host: process.env.DB_HOST ?? 'localhost',\n port: Number(process.env.DB_PORT ?? 5432),\n database: process.env.DB_NAME ?? 'vendure',\n username: process.env.DB_USERNAME ?? 'vendure',\n password: process.env.DB_PASSWORD ?? 'vendure',\n ssl: process.env.APP_ENV === 'production',\n },\n systemDatabaseSchemaName: process.env.WORKFLOW_ENGINE_SCHEMA ?? 'dbos',\n applicationVersion: 'v1',\n }"},"approval-workflows":{envVars:[],platformOptionsBlock:""},"global-search":{envVars:[],platformOptionsBlock:""},"entity-access-control":{envVars:[],platformOptionsBlock:""},"tax-id-management":{envVars:[],platformOptionsBlock:""},"shopping-list":{envVars:[],platformOptionsBlock:""},"quick-order":{envVars:[],platformOptionsBlock:""},"reorder-from-history":{envVars:[],platformOptionsBlock:""},"store-credit":{envVars:[],platformOptionsBlock:"storeCredit: {\n availableFontStacks: [\n 'Arial, Helvetica Neue, Helvetica, sans-serif',\n 'Impact, Charcoal, sans-serif',\n ],\n createDefaultGiftCardProduct: {\n name: 'Gift Card',\n sku: 'GC01',\n },\n }"},"quote-management":{envVars:[],platformOptionsBlock:""},"price-rules":{envVars:[],platformOptionsBlock:""},"packaging-units":{envVars:[],platformOptionsBlock:""},"content-versioning":{envVars:[],platformOptionsBlock:""},configurator:{envVars:[],platformOptionsBlock:""},sso:{envVars:[{name:"GOOGLE_CLIENT_ID",defaultValue:""},{name:"GOOGLE_CLIENT_SECRET",defaultValue:""},{name:"VENDURE_HOST",defaultValue:"http://localhost:3500"}],platformOptionsBlock:"sso: {\n vendureHost: process.env.VENDURE_HOST ?? 'http://localhost:3500',\n providers: [\n {\n type: 'oidc',\n id: 'google',\n displayName: 'Google SSO',\n issuerUrl: 'https://accounts.google.com',\n clientId: process.env.GOOGLE_CLIENT_ID ?? '',\n clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? '',\n scopes: ['openid', 'profile', 'email'],\n },\n ],\n }"},"audit-trail":{envVars:[],platformOptionsBlock:"auditTrail: (defaults) => ({\n ...defaults,\n logSink: new DatabaseLogSink({\n dataSourceOptions: {\n type: 'postgres',\n host: process.env.DB_HOST ?? 'localhost',\n port: Number(process.env.DB_PORT ?? 5432),\n database: process.env.DB_NAME ?? 'vendure',\n schema: process.env.AUDIT_LOG_SCHEMA ?? 'audit_trail',\n username: process.env.DB_USERNAME ?? 'vendure',\n password: process.env.DB_PASSWORD ?? 'vendure',\n synchronize: true,\n },\n }),\n })",platformImports:["import { DatabaseLogSink } from '@vendure-platform/audit-trail';"]},punchout:{envVars:[{name:"PUNCHOUT_STOREFRONT_URL",defaultValue:"http://localhost:3000"}],platformOptionsBlock:"punchout: {\n storefrontUrl: process.env.PUNCHOUT_STOREFRONT_URL ?? 'http://localhost:3000',\n }"}};function o(e){return exports.pluginRegistry.find(n=>n.key===e)}function t(e){const n=new Set(exports.ALWAYS_ACTIVE_KEYS);for(const t of e){if(!o(t))throw new Error(`Unknown plugin key: "${t}"`);n.add(t)}return exports.pluginRegistry.filter(e=>n.has(e.key)).map(e=>e.key)}exports.pluginRegistry=e.PLUGIN_META.map(e=>({...e,...n[e.key]})),exports.INTERNAL_PACKAGES=[{packageName:"@vendure-platform/platform"},{packageName:"@vendure-platform/integration"},{packageName:"@vendure-platform/demo-center"}],exports.ALWAYS_ACTIVE_KEYS=exports.pluginRegistry.filter(e=>"core"===e.tier||"core-requires-config"===e.tier).map(e=>e.key),exports.SELECTABLE_KEYS=exports.pluginRegistry.filter(e=>"core"!==e.tier&&"core-requires-config"!==e.tier).map(e=>e.key);
package/dist/registry.js CHANGED
@@ -1,29 +1 @@
1
- "use strict";
2
- /**
3
- * Single source of truth for the @vendure-platform private registry URL.
4
- *
5
- * The URL appears in three places at scaffold time:
6
- * - the project-root `.npmrc` scope mapping (via the `npmrc.hbs` template)
7
- * - the storefront `.npmrc` scope mapping (written by `storefront-copier`)
8
- * - the actionable 401 message in `scaffold-shared.ts` (login command +
9
- * regex that fingerprints private-registry failures in stderr)
10
- *
11
- * Keeping the URL in one place means the next registry rename is a single-
12
- * file edit. The `VENDURE_REGISTRY_URL` override is intended for local
13
- * Verdaccio testing — set it before invoking the create CLI to scaffold a
14
- * project pointed at a local registry without needing to patch the template
15
- * post-scaffold.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.DEFAULT_REGISTRY_URL = void 0;
19
- exports.getRegistryUrl = getRegistryUrl;
20
- exports.getRegistryHostname = getRegistryHostname;
21
- exports.DEFAULT_REGISTRY_URL = 'https://registry.platform.vendure.io/';
22
- function getRegistryUrl() {
23
- var _a;
24
- return (_a = process.env.VENDURE_REGISTRY_URL) !== null && _a !== void 0 ? _a : exports.DEFAULT_REGISTRY_URL;
25
- }
26
- function getRegistryHostname() {
27
- return new URL(getRegistryUrl()).hostname;
28
- }
29
- //# sourceMappingURL=registry.js.map
1
+ "use strict";function e(){var e;return null!==(e=process.env.VENDURE_REGISTRY_URL)&&void 0!==e?e:exports.DEFAULT_REGISTRY_URL}function t(){return new URL(e()).hostname}Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_REGISTRY_URL=void 0,exports.getRegistryUrl=e,exports.getRegistryHostname=t,exports.DEFAULT_REGISTRY_URL="https://registry.platform.vendure.io/";