vuestorefront / vue-storefront-1

The open-source frontend for any eCommerce. Built with a PWA and headless approach, using a modern JS stack. We have custom integrations with Magento, commercetools, Shopware and Shopify and total coverage is just a matter of time. The API approach also allows you to merge VSF with any third-party tool like CMS, payment gateways or analytics. Newest updates: https://blog.vuestorefront.io. Always Open Source, MIT license.
https://www.vuestorefront.io
MIT License
19 stars 13 forks source link

How to store project in a repository #440

Open davidwindell opened 3 years ago

davidwindell commented 3 years ago

There doesn't seem to be any clear documentation on a recommend project setup for VSF 1.

Is the correct process to fork the vuestorefront/vue-storefront repository (with all git history), commit that to your own repository and then git rebase the remote vsf origin whenever a new release of VSF comes out?

I presume if that were the case then the only changes in our repository will be in themes/ourtheme and local.json so a rebase won't cause any conflicts?

Sorry if this seems obvious but I want to be clear on this, we are used to using Magento and have tiny repos with a well managed .gitignore (so no core files are committed) and use composer to pull Magento itself in. I guess doing this for VSF will have to wait until VSF Next is out and uses NPM packages to install the core?

davidwindell commented 3 years ago

After some experimentation, this is the solution I have settled on:

screenshot-gitlab com-2021 01 29-11_40_05

It means we have a nice tiny repo and upgrades will be super easy. I simply copy vue core folders from the node_modules folder upon yarn install and gitignore them:

My package.json looks like this:

```json { "name": "outeredge-vsf", "version": "1.0.0", "author": "outer/edge", "private": true, "copyFiles": [ { "from": "node_modules/vue-storefront/{core,src}/**", "to": "./" }, { "from": "node_modules/vue-storefront/{tsconfig*.json,.eslint*,shims.d.ts}", "to": "./" }, { "from": "node_modules/vue-storefront/config/default.json", "to": "./config/default.json" }, { "from": "node_modules/vsf-capybara/**", "to": "./src/themes/capybara" } ], "copyFilesSettings": { "whenFileExists": "overwrite" }, "dependencies": { "copy-files-from-to": "^3.2.0", "vsf-capybara": "git+https://github.com/vuestorefront/vsf-capybara.git#v1.0.3", "vue-storefront": "git+https://github.com/vuestorefront/vue-storefront.git#v1.12.2" }, "scripts": { "postinstall": "copy-files-from-to", "static-server": "cross-env TS_NODE_PROJECT=\"tsconfig-build.json\" ts-node ./core/scripts/static-server.ts", "generate": "cross-env TS_NODE_PROJECT=\"tsconfig-build.json\" ts-node ./core/scripts/generate.ts", "generate-files": "cross-env TS_NODE_PROJECT=\"tsconfig-build.json\" ts-node ./core/scripts/generate-files.ts", "start": "cross-env NODE_ENV=production TS_NODE_PROJECT=\"tsconfig-build.json\" pm2 start ecosystem.json $PM2_ARGS", "start:inspect": "cross-env NODE_ENV=production TS_NODE_PROJECT=\"tsconfig-build.json\" node --inspect -r ts-node/register ./core/scripts/server", "installer": "node ./core/scripts/installer", "installer:ci": "yarn installer --default-config", "all": "cross-env NODE_ENV=development node ./core/scripts/all", "cache": "node ./core/scripts/cache", "dev": "yarn generate-files && cross-env TS_NODE_PROJECT=\"tsconfig-build.json\" ts-node ./core/scripts/server.ts", "dev:sw": "yarn generate-files && cross-env TS_NODE_PROJECT=\"tsconfig-build.json\" yarn build:sw && yarn dev", "dev:inspect": "yarn generate-files && cross-env TS_NODE_PROJECT=\"tsconfig-build.json\" node --inspect -r ts-node/register ./core/scripts/server", "build:sw": "cross-env NODE_ENV=production TS_NODE_PROJECT=\"tsconfig-build.json\" webpack --config ./core/build/webpack.prod.sw.config.ts --mode production --progress --hide-modules", "build:client": "cross-env NODE_ENV=production TS_NODE_PROJECT=\"tsconfig-build.json\" webpack --config ./core/build/webpack.prod.client.config.ts --mode production --progress --hide-modules", "build:server": "cross-env NODE_ENV=production TS_NODE_PROJECT=\"tsconfig-build.json\" webpack --config ./core/build/webpack.prod.server.config.ts --mode production --progress --hide-modules", "build": "rimraf dist && yarn generate-files && npm-run-all -p build:*", "test:unit": "jest -c test/unit/jest.conf.js", "test:unit:watch": "jest -c test/unit/jest.conf.js --watch", "test:e2e": "cypress open", "test:e2e:ci": "cypress run", "lint": "cross-env NODE_ENV=production eslint --ext .js,.vue,.ts core src --fix", "lerna": "lerna" }, "resolutions": { "vue-gtm": "2.2.0" }, "devDependencies": { "@babel/core": "^7.9.0", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/polyfill": "^7.8.3", "@babel/preset-env": "^7.9.0", "@types/jest": "^25.1.3", "@types/node": "^13.7.7", "@typescript-eslint/eslint-plugin": "^1.7.1-alpha.17", "@typescript-eslint/parser": "^1.7.1-alpha.17", "@vue/test-utils": "^1.0.0-beta.29", "app-root-path": "^2.0.1", "autoprefixer": "^8.6.2", "babel-core": "^7.0.0-bridge.0", "babel-eslint": "^9.0.0", "babel-jest": "^24.1.0", "babel-loader": "^8.0.6", "babel-plugin-dynamic-import-node": "^2.2.0", "case-sensitive-paths-webpack-plugin": "^2.1.2", "command-exists": "^1.2.2", "commander": "^2.18.0", "css-loader": "^1.0.0", "cypress": "^3.1.5", "d3-dsv": "^1.0.8", "detect-installed": "^2.0.4", "empty-dir": "^1.0.0", "eslint": "^5.0.0", "eslint-config-standard": "^12.0.0", "eslint-friendly-formatter": "^4.0.1", "eslint-loader": "^2.0.0", "eslint-plugin-import": "^2.13.0", "eslint-plugin-node": "^6.0.1", "eslint-plugin-promise": "^3.7.0", "eslint-plugin-standard": "^3.1.0", "eslint-plugin-vue": "^5.2.2", "eslint-plugin-vue-storefront": "^0.0.1", "file-loader": "^1.1.11", "fs-exists-sync": "^0.1.0", "html-webpack-plugin": "^3.2.0", "husky": "^2.6.0", "inquirer": "^3.3.0", "is-windows": "^1.0.1", "jest": "^25.1.0", "jest-fetch-mock": "^3.0.1", "jest-serializer-vue": "^2.0.2", "jsonfile": "^4.0.0", "lerna": "^3.14.1", "lint-staged": "^8.2.1", "mkdirp": "^0.5.1", "node-sass": "^4.12.0", "npm-run-all": "^4.1.5", "phantomjs-prebuilt": "^2.1.10", "postcss-flexbugs-fixes": "^4.1.0", "postcss-loader": "^3.0.0", "print-message": "^2.1.0", "rimraf": "^2.6.0", "sass-loader": "^7.1.0", "shelljs": "^0.8.1", "sw-precache-webpack-plugin": "^0.11.5", "ts-jest": "^25.2.1", "ts-loader": "^5.3.0", "typescript": "^3.1.6", "url-loader": "^1.1.2", "url-parse": "^1.4.4", "vue-eslint-parser": "^2.0.3", "vue-jest": "^3.0.5", "vue-loader": "^15.4.2", "vue-ssr-webpack-plugin": "^3.0.0", "vue-template-compiler": "^2.6.11", "webpack": "^4.25.1", "webpack-bundle-analyzer": "^3.3.2", "webpack-cli": "^3.3.11", "webpack-dev-middleware": "^3.4.0", "webpack-hot-middleware": "^2.24.3", "webpack-merge": "^4.2.2" }, "browserslist": { "development": [ "last 2 chrome versions", "last 2 firefox versions", "last 2 edge versions", "> 5%" ], "production": [ ">5%", "last 4 versions", "Firefox ESR" ] }, "workspaces": [ "core", "core/i18n", "src/extensions/*", "src/modules/*", "src/trace/*", "src/themes/*", "docs", "core/modules/*", "test/unit", "packages/*" ] } ```

Would appreciate any thoughts on this.

UPDATE: I discovered that the mere non-existence of the dependencies from VSF in the package.json caused an error when refreshing the page, I can't imagine why but it seems to work when I add those back in (even with a yarn install of anything, just their presence in the package.json file sorts it out)