@spree/cli 2.1.1 → 2.1.2
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 +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -162,7 +162,7 @@ ${re.default.bold("Switching to dev compose (bind-mounts ./backend)...")}
|
|
|
162
162
|
`),await W(["up","-d"],t.projectDir,{stdio:"inherit"}),console.log(`
|
|
163
163
|
${re.default.bold("Preparing the development database...")}
|
|
164
164
|
`),await O(["bin/rails","db:prepare"],t.projectDir,{tty:!1}),Z([`Backend is now bind-mounted from ${re.default.bold("./backend")} \u2014 edits are live.`,"",`The dev stack uses its own ${re.default.bold("spree_development")} database (just`,`created and seeded). Load demo products with ${re.default.bold("spree sample-data")}.`,"","You can now customize:",` ${re.default.dim("backend/app/")} \u2014 models, controllers, services (instant reload)`,` ${re.default.dim("backend/config/")} \u2014 Rails configuration (instant reload)`,` ${re.default.dim("backend/Gemfile")} \u2014 add gems via ${re.default.bold("spree bundle add <gem>")}`,"",`Rebuild only on Dockerfile / .ruby-version changes: ${re.default.bold("spree build")}`].join(`
|
|
165
|
-
`),"Ejected!")})}function Om(e){e.command("exec").description("Run an arbitrary command inside the web container").argument("<command...>","command and arguments to run").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();await O(t,r.projectDir)})}var PS=new Set(["migration","scaffold","scaffold_controller","mailer","job","channel","helper","resource","integration_test","system_test","task","generator","benchmark"]);function vm(e){e.command("generate").alias("g").description("Run a generator (Spree generators auto-prefixed; Rails built-ins forwarded as-is)").argument("<name>","generator name (`model`, `model_decorator`, `migration`, \u2026)").argument("[args...]","arguments to pass to the generator").allowUnknownOption(!0).passThroughOptions(!0).action(async(t,r)=>{let n=b(),o=t.includes(":")||PS.has(t)?t:`spree:${t}`;await O(["bin/rails","g",o,...r],n.projectDir)})}import rs from"fs";import{platform as LS}from"os";import kS from"path";var Qe=q(ue(),1);var FS=3e3,Tm=12e4;function Am(e){e.command("init").description("First-run setup: start services, configure API key, load sample data").option("--no-sample-data","skip loading sample data").option("--no-open","skip opening browser").action(async t=>{let r=b();I.step("Pulling latest images..."),await W(["pull"],r.projectDir,{stdio:"inherit"});let n=U();n.start("Starting Docker services..."),await W(["up","-d"],r.projectDir),n.stop("Docker services started."),n.start("Waiting for Spree to be ready..."),await jS(r.port),n.stop("Spree is ready."),n.start("Seeding database..."),await X("db:seed",r.projectDir),n.stop("Database seeded."),n.start("Configuring API key...");let o=await NS(r.projectDir);US(r.projectDir,o),n.stop(`API key: ${Qe.default.cyan(o)}`),t.sampleData&&(n.start("Loading sample data..."),await X("spree:load_sample_data",r.projectDir),n.stop("Sample data loaded.")),n.start("Indexing products for search..."),await X("spree:search:reindex",r.projectDir),n.stop("Search index ready."),Z(["",Qe.default.bold("Admin Dashboard"),` ${Qe.default.cyan(`http://localhost:${r.port}/admin`)}`,` Email: ${fr}`,` Password: ${hr}`,"",Qe.default.bold("Store API"),` ${Qe.default.cyan(`http://localhost:${r.port}/api/v3/store`)}`,` API Key: ${Qe.default.cyan(o)}`,""].join(`
|
|
165
|
+
`),"Ejected!")})}function Om(e){e.command("exec").description("Run an arbitrary command inside the web container").argument("<command...>","command and arguments to run").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();await O(t,r.projectDir)})}var PS=new Set(["migration","controller","scaffold","scaffold_controller","mailer","job","channel","helper","resource","integration_test","system_test","task","generator","benchmark"]);function vm(e){e.command("generate").alias("g").description("Run a generator (Spree generators auto-prefixed; Rails built-ins forwarded as-is)").argument("<name>","generator name (`model`, `model_decorator`, `migration`, \u2026)").argument("[args...]","arguments to pass to the generator").allowUnknownOption(!0).passThroughOptions(!0).action(async(t,r)=>{let n=b(),o=t.includes(":")||PS.has(t)?t:`spree:${t}`;await O(["bin/rails","g",o,...r],n.projectDir)})}import rs from"fs";import{platform as LS}from"os";import kS from"path";var Qe=q(ue(),1);var FS=3e3,Tm=12e4;function Am(e){e.command("init").description("First-run setup: start services, configure API key, load sample data").option("--no-sample-data","skip loading sample data").option("--no-open","skip opening browser").action(async t=>{let r=b();I.step("Pulling latest images..."),await W(["pull"],r.projectDir,{stdio:"inherit"});let n=U();n.start("Starting Docker services..."),await W(["up","-d"],r.projectDir),n.stop("Docker services started."),n.start("Waiting for Spree to be ready..."),await jS(r.port),n.stop("Spree is ready."),n.start("Seeding database..."),await X("db:seed",r.projectDir),n.stop("Database seeded."),n.start("Configuring API key...");let o=await NS(r.projectDir);US(r.projectDir,o),n.stop(`API key: ${Qe.default.cyan(o)}`),t.sampleData&&(n.start("Loading sample data..."),await X("spree:load_sample_data",r.projectDir),n.stop("Sample data loaded.")),n.start("Indexing products for search..."),await X("spree:search:reindex",r.projectDir),n.stop("Search index ready."),Z(["",Qe.default.bold("Admin Dashboard"),` ${Qe.default.cyan(`http://localhost:${r.port}/admin`)}`,` Email: ${fr}`,` Password: ${hr}`,"",Qe.default.bold("Store API"),` ${Qe.default.cyan(`http://localhost:${r.port}/api/v3/store`)}`,` API Key: ${Qe.default.cyan(o)}`,""].join(`
|
|
166
166
|
`),"Your Spree store is ready!"),t.open&&await BS(`http://localhost:${r.port}/admin`),I.info(`Streaming logs (Ctrl+C to stop)...
|
|
167
167
|
`),await vn("web",r.projectDir)})}async function jS(e){let t=`http://localhost:${e}/up`,r=Date.now();for(;Date.now()-r<Tm;){try{if((await fetch(t)).ok)return}catch{}await new Promise(n=>setTimeout(n,FS))}throw new Error(`Spree did not become healthy within ${Tm/1e3}s`)}async function NS(e){let t=await X("spree:cli:ensure_api_key",e),r=t.match(/pk_[A-Za-z0-9_-]+/);if(!r)throw new Error(`Could not extract API key from Rails output: ${t}`);return r[0]}function US(e,t){let r=kS.join(e,"apps","storefront",".env.local");if(!rs.existsSync(r))return;let n=rs.readFileSync(r,"utf-8");rs.writeFileSync(r,n.replace(/SPREE_PUBLISHABLE_KEY=.*/,`SPREE_PUBLISHABLE_KEY=${t}`))}async function BS(e){let t=LS(),r=t==="darwin"?"open":t==="win32"?"start":"xdg-open";try{await On(`${r} ${e}`,{stdio:"ignore"})}catch{}}function Im(e){e.command("logs").description("Stream service logs").argument("[service]","service name (web or worker)","web").action(async t=>{let r=b();await vn(t,r.projectDir)})}var Tn=q(ue(),1);function Dm(e){e.command("migrate").description("Install pending Spree migrations from gems, then run them (`spree:install:migrations` + `db:migrate`)").argument("[args...]","extra args forwarded to db:migrate").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=b();console.log(`
|
|
168
168
|
${Tn.default.bold("\u2192 Installing pending Spree migrations from gems...")}`),await O(["bin/rails","spree:install:migrations"],r.projectDir),console.log(`
|