Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

feat: move dependencies into nuxt-module #1120

Merged
merged 8 commits into from
Sep 22, 2020
Merged
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
4 changes: 4 additions & 0 deletions docs/landing/getting-started/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ The supported API versions of Shopware 6 are v3 and v2. Generally speaking, each

We want Shopware PWA to be in sync with the latest endpoints of Shopware, to be able to ship new features to you as soon as they are released within Shopware.

## Migrate version 0.4.x to 0.5.x - not released yet!

**MIGRATION STEP**: we simplified project upgrade process. Now you can remove `@shopware-pwa/*` dependencies repm your `package.json` file and leave only `@shopware-pwa/nuxt-module`. Thanks to this you change version only in a single place.

## Migrate version 0.3.x to 0.4.x

All changes are documented in our [Changelog](https://github.com/DivanteLtd/shopware-pwa/blob/master/CHANGELOG.md)
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ const command: GluegunCommand = {
await toolbox.cms.invokeRefreshCMS();
await toolbox.languages.invokeRefreshLanguages();

await spawn("yarn nuxt build", {
const result = await spawn("yarn nuxt build", {
stdio: "inherit",
});
if (result.status !== 0) throw new Error("Unable to build project");
},
};

Expand Down
11 changes: 6 additions & 5 deletions packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ module.exports = {
);

// Adding Shopware PWA core dependencies
const coreDevPackages = [
const coreDevPackages = ["@shopware-pwa/nuxt-module"];
const localCoreDevPackages = [
"@shopware-pwa/cli",
"@shopware-pwa/composables",
"@shopware-pwa/helpers",
Expand All @@ -79,7 +80,7 @@ module.exports = {

try {
// - unlink potential linked locally packages
await run(`yarn unlink ${coreDevPackages.join(" ")}`);
await run(`yarn unlink ${localCoreDevPackages.join(" ")}`);
} catch (e) {
// It's just for safety, unlink on fresh project will throw an error so we can catch it here
}
Expand All @@ -94,12 +95,12 @@ module.exports = {
break;
case STAGES.LOCAL:
await run(
`yarn add -D ${coreDevPackages
`yarn add -D ${localCoreDevPackages
.map((dep) => `${dep}@canary`)
.join(" ")}`
);
await run(`npx yalc add -D ${coreDevPackages.join(" ")}`);
await run(`yarn link ${coreDevPackages.join(" ")}`);
await run(`npx yalc add -D ${localCoreDevPackages.join(" ")}`);
await run(`yarn link ${localCoreDevPackages.join(" ")}`);
break;
case STAGES.STABLE:
default:
Expand Down
7 changes: 0 additions & 7 deletions packages/cli/src/extensions/nuxt-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ module.exports = (toolbox: GluegunToolbox) => {
* - dynamically get new versions from template
*/
toolbox.updateNuxtPackageJson = async (stage) => {
const nuxtThemePackage = toolbox.filesystem.read(
path.join(toolbox.defaultThemeLocation, "package.json"),
"json"
);

if (!nuxtThemePackage) throw new Error("Theme package not found!");

await toolbox.patching.update("package.json", (config) => {
config.scripts.lint = "prettier --write '*.{js,vue}'";
config.scripts.dev = "shopware-pwa dev";
Expand Down
6 changes: 6 additions & 0 deletions packages/nuxt-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
"@nuxt/typescript-build": "^2.0.3",
"@nuxt/typescript-runtime": "^2.0.0",
"@nuxt/utils": "^2.14.5",
"@shopware-pwa/cli": "0.4.0",
"@shopware-pwa/commons": "0.4.0",
"@shopware-pwa/composables": "0.4.0",
"@shopware-pwa/default-theme": "0.4.0",
"@shopware-pwa/helpers": "0.4.0",
"@shopware-pwa/shopware-6-client": "0.4.0",
"chokidar": "^3.4.2",
"cookie-universal": "^2.1.4",
"cosmiconfig": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt-module/src/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function useCorePackages(
const pkgPath = path.resolve(path.join("node_modules", packageName));
const pkg = jetpack.read(path.join(pkgPath, "package.json"), "json");

if (pkg.module) {
if (pkg && pkg.module) {
moduleObject.options.alias[pkg.name + "$"] = path.resolve(
pkgPath,
pkg.module
Expand Down