2.0.2 • Published 6 years ago
adept-shop-ui-builder v2.0.2
Shop UI Builder
Builds a shops frontend files based on the config from the platform manager.
When you run the build command, the script will run a webpack production build to
compile/transpile all of the react and ES6 javascript to code that will run natively
in supported browsers. Once the compiled file is built, it is gzipped and uploaded
to S3 with all of the headers automatically set.
The build function will return an object that has all of the S3 file paths that have
been uploaded. Currently the only one is jsPath but in the future this might be extended
to jsMinPath or jsDevPath.
Currently, the only platform that is supported is Shopify.
Installation
npm install --save git+ssh://git@github.com:AdeptMind/adept-shop-ui-builder.git
Usage
const frontendBuilder = require('adept-shop-ui-builder');
// Should the store info returned by platform manager
// The data that is returned from the shops endpoint in platform manager
// https://platform-manager.adeptmind.ai/shops/24
const shop = {
"id": 24,
"name": "adeptmind-store-2",
"platform": "shopify",
"shop_url": "adeptmind-store-2.myshopify.com",
"search_url": "https://adept-alloc-82-2018-05-14.adeptmind.ai",
"shop_id": "636a4927-36e0-4ed6-aede-937a29441036",
"created_at": "2018-05-09T17:41:21.480Z",
"updated_at": "2018-05-14T20:59:58.921Z",
"is_installed": true,
"is_active": false
}
// Key value pair of [component]: {
"customization-option": "blue",
}
// Valid components are `search-box`, `product-display`, `filters`, and `search-page`
// This info should be saved in the platform manager and returned through
// https://platform-manager.adeptmind.ai/shops/24/configs
const shopConfigs = {
"search-box": {
// ...
},
"product-display": {
// ...
},
"filters": {
// ...
},
"search-page": {
// ...
}
}
const paths = await ShopUIBuilder.build(shopInfo, shopConfigs);
console.log(path.jsPath);