Skip to content

Commit

Permalink
fix(nuxt3-module): remove package.json parser (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucmus authored May 16, 2023
1 parent fec1e1e commit ed35e37
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-seas-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/nuxt3-module": patch
---

Package.json parser removed
7 changes: 1 addition & 6 deletions packages/nuxt3-module/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,5 @@ export default defineBuildConfig({
cjsBridge: true,
},
declaration: true,
externals: [
"@nuxt/schema",
"@nuxt/kit",
"@shopware-pwa/composables-next",
"package-json-parser",
],
externals: ["@nuxt/schema", "@nuxt/kit", "@shopware-pwa/composables-next"],
});
1 change: 0 additions & 1 deletion packages/nuxt3-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@nuxt/devtools": "^0.4.6",
"@nuxt/schema": "^3.4.3",
"eslint-config-shopware": "workspace:*",
"package-json-parser": "^2.2.0",
"tsconfig": "workspace:*",
"typescript": "^5.0.4",
"unbuild": "^1.2.1"
Expand Down
12 changes: 7 additions & 5 deletions packages/nuxt3-module/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Nuxt } from "@nuxt/schema";
import { resolve, dirname } from "path";
import { fileURLToPath } from "node:url";
import { promises as fs, constants as FS_CONSTANTS } from "node:fs";
import packageJson from "package-json-parser";

type DEPENDENCY = "@shopware-pwa/api-client" | "@shopware-pwa/composables-next";

Expand All @@ -16,15 +15,18 @@ export async function isDependencyInstalledLocally(
) {
try {
const projectPackageJsonPath = resolve(rootDir, "package.json");
const packageJsonDefinition = packageJson.json(projectPackageJsonPath);
const packageJson = JSON.parse(
await fs.readFile(projectPackageJsonPath, "utf8")
);

if (
packageJsonDefinition?.dependencies?.[dependency] ||
packageJsonDefinition?.devDependencies?.[dependency]
packageJson?.dependencies?.[dependency] ||
packageJson?.devDependencies?.[dependency]
) {
return true;
}
} catch (error) {
console.error("nuxt3-module: unable to check local dependencies");
console.error("nuxt3-module: unable to check local dependencies", error);
}
return false;
}
Expand Down
11 changes: 1 addition & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 comments on commit ed35e37

@vercel
Copy link

@vercel vercel bot commented on ed35e37 May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

frontends-demo – ./templates/vue-demo-store

frontends-demo-git-main-shopware-frontends.vercel.app
frontends-demo-shopware-frontends.vercel.app
frontends-demo.vercel.app

@vercel
Copy link

@vercel vercel bot commented on ed35e37 May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.