@akinon/projectzero 1.82.0-rc.16 → 1.82.0-rc.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @akinon/projectzero
2
2
 
3
+ ## 1.82.0-rc.18
4
+
5
+ ## 1.82.0-rc.17
6
+
7
+ ### Minor Changes
8
+
9
+ - e2583ac2: ZERO-3282: Switch to execSync for synchronous execution, enhance file checks, and add error page replacement script
10
+
3
11
  ## 1.82.0-rc.16
4
12
 
5
13
  ### Minor Changes
@@ -1,5 +1,54 @@
1
1
  # projectzeronext
2
2
 
3
+ ## 1.82.0-rc.18
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [e4761d2]
8
+ - @akinon/next@1.82.0-rc.18
9
+ - @akinon/pz-akifast@1.82.0-rc.18
10
+ - @akinon/pz-b2b@1.82.0-rc.18
11
+ - @akinon/pz-basket-gift-pack@1.82.0-rc.18
12
+ - @akinon/pz-bkm@1.82.0-rc.18
13
+ - @akinon/pz-checkout-gift-pack@1.82.0-rc.18
14
+ - @akinon/pz-click-collect@1.82.0-rc.18
15
+ - @akinon/pz-credit-payment@1.82.0-rc.18
16
+ - @akinon/pz-gpay@1.82.0-rc.18
17
+ - @akinon/pz-masterpass@1.82.0-rc.18
18
+ - @akinon/pz-one-click-checkout@1.82.0-rc.18
19
+ - @akinon/pz-otp@1.82.0-rc.18
20
+ - @akinon/pz-pay-on-delivery@1.82.0-rc.18
21
+ - @akinon/pz-saved-card@1.82.0-rc.18
22
+ - @akinon/pz-tabby-extension@1.82.0-rc.18
23
+ - @akinon/pz-tamara-extension@1.82.0-rc.18
24
+
25
+ ## 1.82.0-rc.17
26
+
27
+ ### Minor Changes
28
+
29
+ - e2c6d426: ZERO-2935: Add @sentry/nextjs dependency to akinon-next and remove from projectzeronext
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [e2c6d426]
34
+ - Updated dependencies [70bc0aed]
35
+ - @akinon/next@1.82.0-rc.17
36
+ - @akinon/pz-akifast@1.82.0-rc.17
37
+ - @akinon/pz-b2b@1.82.0-rc.17
38
+ - @akinon/pz-basket-gift-pack@1.82.0-rc.17
39
+ - @akinon/pz-bkm@1.82.0-rc.17
40
+ - @akinon/pz-checkout-gift-pack@1.82.0-rc.17
41
+ - @akinon/pz-click-collect@1.82.0-rc.17
42
+ - @akinon/pz-credit-payment@1.82.0-rc.17
43
+ - @akinon/pz-gpay@1.82.0-rc.17
44
+ - @akinon/pz-masterpass@1.82.0-rc.17
45
+ - @akinon/pz-one-click-checkout@1.82.0-rc.17
46
+ - @akinon/pz-otp@1.82.0-rc.17
47
+ - @akinon/pz-pay-on-delivery@1.82.0-rc.17
48
+ - @akinon/pz-saved-card@1.82.0-rc.17
49
+ - @akinon/pz-tabby-extension@1.82.0-rc.17
50
+ - @akinon/pz-tamara-extension@1.82.0-rc.17
51
+
3
52
  ## 1.82.0-rc.16
4
53
 
5
54
  ### Minor Changes
@@ -26,7 +26,10 @@ const withPwaConfig = withPWA({
26
26
 
27
27
  const sentryConfig = {
28
28
  silent: true,
29
- dryRun: !process.env.SENTRY_DSN
29
+ dryRun: !process.env.SENTRY_DSN,
30
+ org: 'akinon'
31
+ // project: 'enter_your_project_name_here',
32
+ // authToken: 'enter_your_auth_token_here'
30
33
  };
31
34
 
32
35
  const enhancedConfig = withPzConfig(nextConfig);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "1.82.0-rc.16",
3
+ "version": "1.82.0-rc.18",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -22,26 +22,25 @@
22
22
  "prestart": "pz-prestart"
23
23
  },
24
24
  "dependencies": {
25
- "@akinon/next": "1.82.0-rc.16",
26
- "@akinon/pz-akifast": "1.82.0-rc.16",
27
- "@akinon/pz-b2b": "1.82.0-rc.16",
28
- "@akinon/pz-basket-gift-pack": "1.82.0-rc.16",
29
- "@akinon/pz-bkm": "1.82.0-rc.16",
30
- "@akinon/pz-checkout-gift-pack": "1.82.0-rc.16",
31
- "@akinon/pz-click-collect": "1.82.0-rc.16",
32
- "@akinon/pz-credit-payment": "1.82.0-rc.16",
33
- "@akinon/pz-gpay": "1.82.0-rc.16",
34
- "@akinon/pz-masterpass": "1.82.0-rc.16",
35
- "@akinon/pz-one-click-checkout": "1.82.0-rc.16",
36
- "@akinon/pz-otp": "1.82.0-rc.16",
37
- "@akinon/pz-pay-on-delivery": "1.82.0-rc.16",
38
- "@akinon/pz-saved-card": "1.82.0-rc.16",
39
- "@akinon/pz-tabby-extension": "1.82.0-rc.16",
40
- "@akinon/pz-tamara-extension": "1.82.0-rc.16",
25
+ "@akinon/next": "1.82.0-rc.18",
26
+ "@akinon/pz-akifast": "1.82.0-rc.18",
27
+ "@akinon/pz-b2b": "1.82.0-rc.18",
28
+ "@akinon/pz-basket-gift-pack": "1.82.0-rc.18",
29
+ "@akinon/pz-bkm": "1.82.0-rc.18",
30
+ "@akinon/pz-checkout-gift-pack": "1.82.0-rc.18",
31
+ "@akinon/pz-click-collect": "1.82.0-rc.18",
32
+ "@akinon/pz-credit-payment": "1.82.0-rc.18",
33
+ "@akinon/pz-gpay": "1.82.0-rc.18",
34
+ "@akinon/pz-masterpass": "1.82.0-rc.18",
35
+ "@akinon/pz-one-click-checkout": "1.82.0-rc.18",
36
+ "@akinon/pz-otp": "1.82.0-rc.18",
37
+ "@akinon/pz-pay-on-delivery": "1.82.0-rc.18",
38
+ "@akinon/pz-saved-card": "1.82.0-rc.18",
39
+ "@akinon/pz-tabby-extension": "1.82.0-rc.18",
40
+ "@akinon/pz-tamara-extension": "1.82.0-rc.18",
41
41
  "@hookform/resolvers": "2.9.0",
42
42
  "@next/third-parties": "14.1.0",
43
43
  "@react-google-maps/api": "2.17.1",
44
- "@sentry/nextjs": "8.35.0",
45
44
  "dayjs": "1.11.5",
46
45
  "lossless-json": "2.0.5",
47
46
  "next": "14.2.25",
@@ -62,7 +61,7 @@
62
61
  "yup": "0.32.11"
63
62
  },
64
63
  "devDependencies": {
65
- "@akinon/eslint-plugin-projectzero": "1.82.0-rc.16",
64
+ "@akinon/eslint-plugin-projectzero": "1.82.0-rc.18",
66
65
  "@semantic-release/changelog": "6.0.2",
67
66
  "@semantic-release/exec": "6.0.3",
68
67
  "@semantic-release/git": "10.0.1",
@@ -1,11 +1,7 @@
1
1
  'use client';
2
2
 
3
- import { useLocalization } from '@akinon/next/hooks';
4
- import { Button, Link } from '@theme/components';
5
- import { ROUTES } from '@theme/routes';
6
- import { useEffect, useState } from 'react';
7
- import * as Sentry from '@sentry/nextjs';
8
- import { ClientLogType } from '@akinon/next/sentry';
3
+ import { useSentryUncaughtErrors } from '@akinon/next/hooks';
4
+ import PzErrorPage from '@akinon/next/views/error-page';
9
5
 
10
6
  export default function ErrorPage({
11
7
  error,
@@ -14,103 +10,8 @@ export default function ErrorPage({
14
10
  error: Error & { digest?: string; isServerError?: boolean };
15
11
  reset: () => void;
16
12
  }) {
17
- const [isServerError, setIsServerError] = useState<boolean>(false);
13
+ // DO NOT REMOVE THIS LINE TO REPORT UNCAUGHT ERRORS TO SENTRY
14
+ useSentryUncaughtErrors(error);
18
15
 
19
- useEffect(() => {
20
- Sentry.withScope(function (scope) {
21
- scope.setLevel('fatal');
22
- scope.setTags({
23
- APP_TYPE: 'ProjectZeroNext',
24
- TYPE: 'Client',
25
- LOG_TYPE: ClientLogType.UNCAUGHT_ERROR_PAGE
26
- });
27
- scope.setExtra('error', error);
28
-
29
- const error_ = new Error('FATAL: Uncaught client error');
30
- error_.name = 'UNCAUGHT_ERROR_PAGE';
31
-
32
- Sentry.captureException(error_, {
33
- fingerprint: ['UNCAUGHT_ERROR_PAGE', error.digest]
34
- });
35
- });
36
- }, [error]);
37
-
38
- useEffect(() => {
39
- if ('isServerError' in error) {
40
- setIsServerError(true);
41
- return;
42
- }
43
-
44
- setIsServerError(!!error.digest);
45
- }, [error]);
46
-
47
- return isServerError ? (
48
- <ServerErrorUI />
49
- ) : (
50
- <ClientErrorUI error={error} reset={reset} />
51
- );
52
- }
53
-
54
- function ClientErrorUI({
55
- error,
56
- reset
57
- }: {
58
- error: Error & { digest?: string };
59
- reset: () => void;
60
- }) {
61
- const { t } = useLocalization();
62
-
63
- const errorMessage = error?.message || 'Unknown error';
64
-
65
- return (
66
- <section className="text-center px-6 my-14 md:px-0 md:m-14">
67
- <div className="text-4xl font-bold md:text-6xl text-red-500">Oops!</div>
68
- <h1 className="text-lg md:text-xl mt-4">
69
- {t('common.client_error.title')}
70
- </h1>
71
- <p className="text-lg md:text-xl mt-2">
72
- {t('common.client_error.description')}
73
- </p>
74
-
75
- <div className="mt-4 mx-auto max-w-lg">
76
- <p className="text-xs text-gray-600 font-mono bg-gray-100 p-3 rounded overflow-auto text-left">
77
- <span className="font-semibold">Error:</span> {errorMessage}
78
- </p>
79
- </div>
80
-
81
- <div className="mt-6 flex flex-col gap-4 items-center justify-center">
82
- <Link href={ROUTES.HOME} className="text-lg underline">
83
- {t('common.client_error.link_text')}
84
- </Link>
85
- <Button onClick={reset} className="text-lg w-28">
86
- {t('common.try_again')}
87
- </Button>
88
- </div>
89
- </section>
90
- );
91
- }
92
-
93
- function ServerErrorUI() {
94
- const { t } = useLocalization();
95
-
96
- const reloadPage = () => {
97
- window.location.reload();
98
- };
99
-
100
- return (
101
- <section className="text-center px-6 my-14 md:px-0 md:m-14">
102
- <div className="text-7xl font-bold md:text-8xl">500</div>
103
- <h1 className="text-lg md:text-xl"> {t('common.page_500.title')} </h1>
104
- <p className="text-lg md:text-xl"> {t('common.page_500.description')} </p>
105
- <Link href={ROUTES.HOME} className="text-lg underline">
106
- {t('common.page_500.link_text')}
107
- </Link>
108
-
109
- <div className="mt-6 flex flex-col gap-4 items-center justify-center">
110
- <Button onClick={reloadPage} className="text-lg w-28">
111
- {t('common.try_again')}
112
- </Button>
113
- </div>
114
- </section>
115
- );
16
+ return <PzErrorPage error={error} reset={reset} />;
116
17
  }
@@ -0,0 +1,30 @@
1
+ const path = require('path');
2
+ const { execSync } = require('child_process');
3
+
4
+ const codemodScripts = [
5
+ path.resolve(__dirname, 'remove-sentry-dependency.js'),
6
+ path.resolve(__dirname, 'remove-sentry-configs.js'),
7
+ path.resolve(__dirname, 'replace-error-page.js')
8
+ ];
9
+
10
+ const transform = () => {
11
+ const workingDir = path.resolve(process.cwd());
12
+
13
+ codemodScripts.forEach((script) => {
14
+ try {
15
+ execSync(
16
+ `jscodeshift --ignore-pattern="**/node_modules/**" -t ${script} ${workingDir} --extensions=json,ts,tsx,js,jsx,properties,md`,
17
+ {
18
+ cwd: workingDir,
19
+ stdio: 'inherit'
20
+ }
21
+ );
22
+ } catch (e) {
23
+ console.error(e);
24
+ }
25
+ });
26
+ };
27
+
28
+ module.exports = {
29
+ transform
30
+ };
@@ -0,0 +1,14 @@
1
+ const fs = require('fs');
2
+
3
+ const transform = (fileInfo, api, options) => {
4
+ const filePath = fileInfo.path;
5
+ const regex = /sentry\.\w+\.config\.(ts|js)$|sentry\.properties$/i;
6
+
7
+ if (regex.test(filePath) && fs.existsSync(filePath)) {
8
+ fs.unlinkSync(filePath);
9
+ }
10
+
11
+ return fileInfo.source;
12
+ };
13
+
14
+ module.exports = transform;
@@ -0,0 +1,25 @@
1
+ const transform = (fileInfo, api, options) => {
2
+ if (fileInfo.path.endsWith('package.json')) {
3
+ const packageJson = JSON.parse(fileInfo.source);
4
+
5
+ if (
6
+ packageJson.dependencies &&
7
+ packageJson.dependencies['@sentry/nextjs']
8
+ ) {
9
+ delete packageJson.dependencies['@sentry/nextjs'];
10
+ }
11
+
12
+ if (
13
+ packageJson.devDependencies &&
14
+ packageJson.devDependencies['@sentry/nextjs']
15
+ ) {
16
+ delete packageJson.devDependencies['@sentry/nextjs'];
17
+ }
18
+
19
+ return JSON.stringify(packageJson, null, 2);
20
+ }
21
+
22
+ return fileInfo.source;
23
+ };
24
+
25
+ module.exports = transform;
@@ -0,0 +1,32 @@
1
+ const fs = require('fs');
2
+
3
+ const template = `
4
+ 'use client';
5
+
6
+ import { useSentryUncaughtErrors } from '@akinon/next/hooks';
7
+ import PzErrorPage from '@akinon/next/views/error-page';
8
+
9
+ export default function ErrorPage({
10
+ error,
11
+ reset
12
+ }: {
13
+ error: Error & { digest?: string; isServerError?: boolean };
14
+ reset: () => void;
15
+ }) {
16
+ // DO NOT REMOVE THIS LINE TO REPORT UNCAUGHT ERRORS TO SENTRY
17
+ useSentryUncaughtErrors(error);
18
+
19
+ return <PzErrorPage error={error} reset={reset} />;
20
+ }
21
+
22
+ `;
23
+
24
+ const transform = (fileInfo, api, options) => {
25
+ const filePath = fileInfo.path;
26
+
27
+ if (filePath.endsWith('error.tsx')) {
28
+ fs.writeFileSync(filePath, template, { encoding: 'utf8' });
29
+ }
30
+ };
31
+
32
+ module.exports = transform;
@@ -0,0 +1,18 @@
1
+ import path from 'path';
2
+
3
+ const yargs = require('yargs/yargs');
4
+ const { hideBin } = require('yargs/helpers');
5
+ const args = yargs(hideBin(process.argv)).argv;
6
+
7
+ export default () => {
8
+ const workingDir = path.resolve(process.cwd());
9
+ const codemodName = args.codemod;
10
+ const codemodPath = path.resolve(
11
+ __dirname,
12
+ `../../codemods/${codemodName}/index.js`
13
+ );
14
+
15
+ const codemod = require(codemodPath);
16
+
17
+ codemod.transform();
18
+ };
package/commands/index.ts CHANGED
@@ -4,6 +4,7 @@ import addLanguage from './add-language';
4
4
  import removeLanguage from './remove-language';
5
5
  import defaultLanguage from './default-language';
6
6
  import plugins from './plugins';
7
+ import codemod from './codemod';
7
8
 
8
9
  export default {
9
10
  commerceUrl,
@@ -11,5 +12,6 @@ export default {
11
12
  addLanguage,
12
13
  removeLanguage,
13
14
  defaultLanguage,
14
- plugins
15
+ plugins,
16
+ codemod
15
17
  };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ 'use client';
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const hooks_1 = require("@akinon/next/hooks");
8
+ const error_page_1 = __importDefault(require("@akinon/next/views/error-page"));
9
+ function ErrorPage({ error, reset }) {
10
+ // DO NOT REMOVE THIS LINE TO REPORT UNCAUGHT ERRORS TO SENTRY
11
+ (0, hooks_1.useSentryUncaughtErrors)(error);
12
+ return React.createElement(error_page_1.default, { error: error, reset: reset });
13
+ }
14
+ exports.default = ErrorPage;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const yargs = require('yargs/yargs');
8
+ const { hideBin } = require('yargs/helpers');
9
+ const args = yargs(hideBin(process.argv)).argv;
10
+ exports.default = () => {
11
+ const workingDir = path_1.default.resolve(process.cwd());
12
+ const codemodName = args.codemod;
13
+ const codemodPath = path_1.default.resolve(__dirname, `../../codemods/${codemodName}/index.js`);
14
+ const codemod = require(codemodPath);
15
+ codemod.transform();
16
+ };
@@ -9,11 +9,13 @@ const add_language_1 = __importDefault(require("./add-language"));
9
9
  const remove_language_1 = __importDefault(require("./remove-language"));
10
10
  const default_language_1 = __importDefault(require("./default-language"));
11
11
  const plugins_1 = __importDefault(require("./plugins"));
12
+ const codemod_1 = __importDefault(require("./codemod"));
12
13
  exports.default = {
13
14
  commerceUrl: commerce_url_1.default,
14
15
  create: create_1.default,
15
16
  addLanguage: add_language_1.default,
16
17
  removeLanguage: remove_language_1.default,
17
18
  defaultLanguage: default_language_1.default,
18
- plugins: plugins_1.default
19
+ plugins: plugins_1.default,
20
+ codemod: codemod_1.default
19
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.82.0-rc.16",
3
+ "version": "1.82.0-rc.18",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {
@@ -1,16 +0,0 @@
1
- import { initSentry } from '@akinon/next/sentry';
2
-
3
- async function initializeSentry() {
4
- const response = await fetch('/api/sentry', { next: { revalidate: 0 } });
5
- const data = await response.json();
6
-
7
- const options = {
8
- dsn: data.dsn,
9
- integrations: [],
10
- tracesSampleRate: 1.0
11
- };
12
-
13
- initSentry('Client', options);
14
- }
15
-
16
- initializeSentry();
@@ -1,4 +0,0 @@
1
- defaults.url=https://sentry.io/
2
- defaults.org=akinon
3
- defaults.project=console--zero-pwa
4
- cli.executable=node_modules/@sentry/cli/bin/sentry-cli
@@ -1,12 +0,0 @@
1
- import 'server-only';
2
- import { DynamicWidgetContainer } from '../dynamic-widget-renderer';
3
-
4
- export default async function WidgetPlaceholder({ slug }: { slug: string }) {
5
- return (
6
- <>
7
- <DynamicWidgetContainer />
8
- </>
9
- );
10
-
11
- return <div>WidgetPlaceholder</div>;
12
- }