@wondercraft/create-wonderplate-shopify
Advanced tools
Comparing version 0.0.202 to 0.0.204
#!/usr/bin/env node | ||
import a from"fs-extra";import E from"ora";import o from"path";import u from"path";import{fileURLToPath as S}from"url";var T=S(import.meta.url),v=u.dirname(T),m=u.join(v,"../");import*as i from"@clack/prompts";var w="wonderplate-shopify",y=async()=>{let n=await i.group({name:()=>i.text({message:"What is the name of your project? This will be used in package.json",placeholder:w}),storeName:()=>i.text({message:"What is the handle of your Shopify store (without myshopify.com)?",placeholder:"my-store-handle",validate:t=>{if(t.includes("myshopify.com"))return"Please enter the handle of your store without the myshopify.com";if(t.includes("/")||t.includes("."))return"Please enter the handle of your store without slashes or dots"}}),jsFramework:()=>i.select({message:"Which JS framework will you be using?",options:[{label:"None",value:"none"},{label:"Alpine",value:"alpine"},{label:"React",value:"react",hint:"NOT YET IMPLEMENTED"},{label:"Vue",value:"vue",hint:"NOT YET IMPLEMENTED"},{label:"HTMX",value:"htmx",hint:"NOT YET IMPLEMENTED"}],initialValue:"none"}),downloadTheme:()=>i.select({message:"Do you want to download a theme?",options:[{label:"None",value:"none"},{label:"Dawn",value:"dawn"}],initialValue:"none"}),tailwind:()=>i.confirm({message:"Will you be using Tailwind CSS for styling?"})},{onCancel:()=>{i.cancel("Exiting setup..."),process.exit(0)}});return{...n,name:n.name||w}};import{execSync as k}from"child_process";import O from"extract-zip";import _ from"fs-extra";import l from"path";var g={dawn:{zip:"https://github.com/Shopify/dawn/archive/master.zip",extracted:"dawn-main"}};async function f(n,t){let s=`curl --output theme.zip -L -O ${g[n].zip}`;k(s),await O(l.join(t,"theme.zip"),{dir:t}).then(()=>console.log("Extraction complete")).catch(e=>console.error("Error occurred while extracting zip file",e));let r=l.join(t,g[n].extracted);_.readdirSync(r).forEach(e=>{!e.startsWith(".")&&_.lstatSync(l.join(r,e)).isDirectory()&&_.moveSync(l.join(r,e),l.join(t,e))}),_.removeSync(r),_.removeSync(l.join(t,"theme.zip"))}console.log(` | ||
import s from"fs-extra";import O from"ora";import o from"path";import u from"path";import{fileURLToPath as S}from"url";var T=S(import.meta.url),v=u.dirname(T),m=u.join(v,"../");import*as i from"@clack/prompts";var y="wonderplate-shopify",w=async()=>{let n=await i.group({name:()=>i.text({message:"What is the name of your project? This will be used in package.json",placeholder:y}),storeName:()=>i.text({message:"What is the handle of your Shopify store (without myshopify.com)?",placeholder:"my-store-handle",validate:t=>{if(t.includes("myshopify.com"))return"Please enter the handle of your store without the myshopify.com";if(t.includes("/")||t.includes("."))return"Please enter the handle of your store without slashes or dots"}}),jsFramework:()=>i.select({message:"Which JS framework will you be using?",options:[{label:"None",value:"none"},{label:"Alpine",value:"alpine"},{label:"React",value:"react",hint:"NOT YET IMPLEMENTED"},{label:"Vue",value:"vue",hint:"NOT YET IMPLEMENTED"},{label:"HTMX",value:"htmx",hint:"NOT YET IMPLEMENTED"}],initialValue:"none"}),downloadTheme:()=>i.select({message:"Do you want to download a theme?",options:[{label:"None",value:"none"},{label:"Dawn",value:"dawn"}],initialValue:"none"}),tailwind:()=>i.confirm({message:"Will you be using Tailwind CSS for styling?"})},{onCancel:()=>{i.cancel("Exiting setup..."),process.exit(0)}});return{...n,name:n.name||y}};import{execSync as k}from"child_process";import E from"extract-zip";import _ from"fs-extra";import l from"path";var g={dawn:{zip:"https://github.com/Shopify/dawn/archive/master.zip",extracted:"dawn-main"}};async function f(n,t){let r=`curl --output theme.zip -L -O ${g[n].zip}`;k(r),await E(l.join(t,"theme.zip"),{dir:t}).then(()=>console.log("Extraction complete")).catch(e=>console.error("Error occurred while extracting zip file",e));let c=l.join(t,g[n].extracted);_.readdirSync(c).forEach(e=>{!e.startsWith(".")&&_.lstatSync(l.join(c,e)).isDirectory()&&_.moveSync(l.join(c,e),l.join(t,e))}),_.removeSync(c),_.removeSync(l.join(t,"theme.zip"))}console.log(` | ||
_ _ _____ _ _ ____ ____ ____ ____ __ __ ____ ____ | ||
@@ -8,8 +8,8 @@ ( \\/\\/ )( _ )( \\( )( _ \\( ___)( _ \\( _ \\( ) /__\\ (_ _)( ___) | ||
`);var b=async()=>{let n=o.resolve(process.cwd()),t=o.join(m,"template"),s=await y(),r=E(`Scaffolding in: ${n}... | ||
`).start();["package.json","vite.config.ts",".shopifyignore",".gitignore"].forEach(c=>{a.copySync(o.join(t,c),o.join(n,c))}),a.copySync(o.join(t,"_src"),o.join(n,"_src"));let e=a.readJSONSync(o.join(n,"package.json"));if(e.name=s.name,s.storeName&&(e.config.store=s.storeName),s.tailwind){["tailwind.config.js","postcss.config.js"].forEach(p=>{a.copySync(o.join(t,p),o.join(n,p))});let c=a.readJSONSync(o.join(m,"src/packageMappers/package.tailwind.json"));e.dependencies={...e.dependencies,...c.dependencies},e.devDependencies={...e.devDependencies,...c.devDependencies},await a.appendFileSync(o.join(n,"_src/styles/main.scss"),`@tailwind base; | ||
`);var b=async()=>{let n=o.resolve(process.cwd()),t=o.join(m,"template"),r=await w(),c=O(`Scaffolding in: ${n}... | ||
`).start();["package.json","vite.config.ts"].forEach(a=>{s.copySync(o.join(t,a),o.join(n,a))}),["_shopifyignore","_gitignore"].forEach(a=>{s.copySync(o.join(t,a),o.join(n,a.replace("_",".")))}),s.copySync(o.join(t,"_src"),o.join(n,"_src"));let e=s.readJSONSync(o.join(n,"package.json"));if(e.name=r.name,r.storeName&&(e.config.store=r.storeName),r.tailwind){["tailwind.config.js","postcss.config.js"].forEach(p=>{s.copySync(o.join(t,p),o.join(n,p))});let a=s.readJSONSync(o.join(m,"src/packageMappers/package.tailwind.json"));e.dependencies={...e.dependencies,...a.dependencies},e.devDependencies={...e.devDependencies,...a.devDependencies},await s.appendFileSync(o.join(n,"_src/styles/main.scss"),`@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities;`,function(p){if(p)throw p;console.log("Saved!")})}else a.removeSync(o.join(n,"_src/styles/tailwind.css"));let d=s.downloadTheme;d==="dawn"&&(r.info(`Downloading ${d} theme...`),await f(d,n));let h=s.jsFramework;if(h=="alpine"){r.info(`Installing ${h}...`);let c=a.readJSONSync(o.join(m,`src/packageMappers/package.${h}.json`));e.dependencies={...e.dependencies,...c.dependencies},e.devDependencies={...e.devDependencies,...c.devDependencies},await a.appendFileSync(o.join(n,"_src/js/app.js"),`import Alpine from 'alpinejs' | ||
@tailwind utilities;`,function(p){if(p)throw p;console.log("Saved!")})}else s.removeSync(o.join(n,"_src/styles/tailwind.css"));let d=r.downloadTheme;d==="dawn"&&(c.info(`Downloading ${d} theme...`),await f(d,n));let h=r.jsFramework;if(h=="alpine"){c.info(`Installing ${h}...`);let a=s.readJSONSync(o.join(m,`src/packageMappers/package.${h}.json`));e.dependencies={...e.dependencies,...a.dependencies},e.devDependencies={...e.devDependencies,...a.devDependencies},await s.appendFileSync(o.join(n,"_src/js/app.js"),`import Alpine from 'alpinejs' | ||
window.Alpine = Alpine | ||
Alpine.start() | ||
`,function(p){if(p)throw p;console.log("Saved!")})}a.writeJSONSync(o.join(n,"package.json"),e,{spaces:2}),r.succeed("Scaffolding complete!"),process.exit(0)};b(); | ||
`,function(p){if(p)throw p;console.log("Saved!")})}s.writeJSONSync(o.join(n,"package.json"),e,{spaces:2}),c.succeed("Scaffolding complete!"),process.exit(0)};b(); |
{ | ||
"name": "@wondercraft/create-wonderplate-shopify", | ||
"version": "0.0.202", | ||
"version": "0.0.204", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -27,7 +27,12 @@ #!/usr/bin/env node | ||
// Copying root config files | ||
["package.json", "vite.config.ts", ".shopifyignore", ".gitignore"].forEach( | ||
(file) => { | ||
fs.copySync(path.join(srcDir, file), path.join(projectDir, file)); | ||
} | ||
); | ||
["package.json", "vite.config.ts"].forEach((file) => { | ||
fs.copySync(path.join(srcDir, file), path.join(projectDir, file)); | ||
}); | ||
// NPM tarballs don't include dot files, so we have to rename them | ||
["_shopifyignore", "_gitignore"].forEach((file) => { | ||
fs.copySync( | ||
path.join(srcDir, file), | ||
path.join(projectDir, file.replace("_", ".")) | ||
); | ||
}); | ||
@@ -34,0 +39,0 @@ //Copying src files |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
3
2
37076
37
473