Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendors #32

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ scripts/preact.js
scripts/htm.js
scripts/dropins
tools/picker
vendors/
14 changes: 9 additions & 5 deletions head.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />

<!-- Import Mapping -->
<script type="importmap">
{
"imports": {
"@dropins/elsie/": "/scripts/dropins/elsie/",
"@dropins/storefront-cart/": "/scripts/dropins/storefront-cart/",
"@dropins/storefront-checkout/": "/scripts/dropins/storefront-checkout/",
"@dropins/storefront-pdp/": "/scripts/dropins/storefront-pdp/",
"@dropins/storefront-order-confirmation/": "/scripts/dropins/storefront-order-confirmation/"
"@dropins/elsie/": "/vendors/@dropins/elsie/",
"@dropins/storefront-cart/": "/vendors/@dropins/storefront-cart/",
"@dropins/storefront-checkout/": "/vendors/@dropins/storefront-checkout/",
"@dropins/storefront-pdp/": "/vendors/@dropins/storefront-pdp/",
"@dropins/storefront-order-confirmation/": "/vendors/@dropins/storefront-order-confirmation/"
}
}
</script>

<script src="/scripts/aem.js" type="module"></script>
<script src="/scripts/scripts.js" type="module"></script>

<link rel="stylesheet" href="/styles/styles.css" />
18 changes: 18 additions & 0 deletions install_vendors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Array of files to copy
declare -a files_to_copy=("@dropins")

# Remove existing dropins folder
rm -rf vendors/

# Create vendors directory if not exists
mkdir -p vendors/

# Copy specified files from node_modules/@dropins to vendors/dropins
for file in "${files_to_copy[@]}"; do
cp -R "node_modules/$file" "vendors/."
done

# Remove package.json files inside dropins
find vendors -type f -name "package.json" -exec rm {} \;
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"lint:css": "stylelint blocks/**/*.css styles/*.css",
"lint": "npm run lint:js && npm run lint:css",
"start": "aem up --print-index",
"postinstall": "rm -rf scripts/dropins && cp -R node_modules/@dropins scripts/dropins && find scripts/dropins -type f -name \"package.json\" -exec rm {} \\;"
"install:dropins": "bash ./install_vendors.sh",
"postinstall": "npm run install:dropins",
"postupdate": "npm run install:dropins"
},
"repository": {
"type": "git",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.