@akinon/next 1.126.16 → 1.126.17

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,15 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.126.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 0fe8ab7: ZERO-5209: Close the theme editor's package and CLI gaps on the v1 line
8
+
9
+ - `@akinon/pz-list-hover-image` is published on the v1 line, registered in the plugin list and in `PluginModule` (`Component.ListHoverImage`), and offered by `projectzero --plugins`. Until now `pz-install-plugins` asked for `@akinon/pz-list-hover-image@<@akinon/next version>`, which never existed for 1.x, so the plugin could not be installed on a v1 project.
10
+ - `projectzero codemod --codemod=composable-auth` is available on the v1 CLI. It moves the login page into an `auth/(login)` route group and mounts the theme editor's login slot there. It leaves a project without `@akinon/pz-theme` (or with one older than 2.0.41) untouched instead of writing a layout that cannot build.
11
+ - `@akinon/pz-theme` and `@akinon/theme-contract` are transpiled by `withPzConfig`, and `pz-postinstall` no longer removes `@akinon/pz-theme` when it is missing from `src/plugins.js`, as on main. Brands that added both packages to `transpilePackages` by hand can drop that override. Keep `'pz-theme'` in `src/plugins.js` unless `tailwind.config.js` lists pz-theme's sources itself: that entry is also what puts them in Tailwind's `content`.
12
+
3
13
  ## 1.126.16
4
14
 
5
15
  ### Patch Changes
@@ -0,0 +1,81 @@
1
+ import fs from 'fs';
2
+ import os from 'os';
3
+ import path from 'path';
4
+
5
+ /**
6
+ * The theme editor packages (@akinon/pz-theme, @akinon/theme-contract) ship
7
+ * TypeScript sources and are released from main only, so a v1 brand gets them
8
+ * at a 2.x version next to a 1.x core. These pin what the core does for them,
9
+ * as on main: transpile both, and keep pz-theme through `pz-postinstall`.
10
+ */
11
+ describe('withPzConfig transpilePackages', () => {
12
+ const withPzConfig = require('../with-pz-config.js');
13
+
14
+ it.each([
15
+ '@akinon/next',
16
+ '@akinon/pz-theme',
17
+ '@akinon/theme-contract',
18
+ '@akinon/pz-list-hover-image'
19
+ ])('transpiles %s', (name) => {
20
+ expect(withPzConfig({}).transpilePackages).toContain(name);
21
+ });
22
+ });
23
+
24
+ describe('pz-install-plugins', () => {
25
+ let baseDir: string;
26
+ let execSync: jest.Mock;
27
+
28
+ const run = (dependencies: Record<string, string>, plugins: string[]) => {
29
+ fs.writeFileSync(
30
+ path.join(baseDir, 'package.json'),
31
+ JSON.stringify({ name: 'brand', dependencies })
32
+ );
33
+ fs.writeFileSync(
34
+ path.join(baseDir, 'src', 'plugins.js'),
35
+ `module.exports = ${JSON.stringify(plugins)};`
36
+ );
37
+
38
+ jest.isolateModules(() => {
39
+ jest.doMock('child_process', () => ({ execSync }));
40
+ jest.doMock('../utils/find-base-dir', () => () => baseDir);
41
+ require('../bin/pz-install-plugins.js');
42
+ });
43
+
44
+ return execSync.mock.calls.map(([command]) => command);
45
+ };
46
+
47
+ beforeEach(() => {
48
+ baseDir = fs.mkdtempSync(path.join(os.tmpdir(), 'pz-install-plugins-'));
49
+ fs.mkdirSync(path.join(baseDir, 'src'));
50
+ execSync = jest.fn();
51
+ });
52
+
53
+ afterEach(() => {
54
+ fs.rmSync(baseDir, { recursive: true, force: true });
55
+ });
56
+
57
+ it('keeps @akinon/pz-theme when src/plugins.js does not list it', () => {
58
+ const commands = run(
59
+ {
60
+ '@akinon/next': '1.126.17',
61
+ '@akinon/pz-otp': '1.126.17',
62
+ '@akinon/pz-theme': '2.0.143'
63
+ },
64
+ []
65
+ );
66
+
67
+ expect(commands).toEqual(['yarn remove @akinon/pz-otp']);
68
+ });
69
+
70
+ // A plugin is installed at the core's own version, which is why
71
+ // pz-list-hover-image needs a 1.x release before a v1 brand can add it.
72
+ it('installs pz-list-hover-image at the core version', () => {
73
+ const commands = run({ '@akinon/next': '1.126.17' }, [
74
+ 'pz-list-hover-image'
75
+ ]);
76
+
77
+ expect(commands).toEqual([
78
+ 'yarn add @akinon/pz-list-hover-image@1.126.17 --exact --ignore-scripts'
79
+ ]);
80
+ });
81
+ });
@@ -26,7 +26,7 @@ try {
26
26
  process.exit(1);
27
27
  }
28
28
 
29
- const protectedPackages = ['@akinon/next', 'next'];
29
+ const protectedPackages = ['@akinon/next', '@akinon/pz-theme', 'next'];
30
30
 
31
31
  const pluginsToRemove = Object.keys(packageJson.dependencies || {}).filter(
32
32
  (dep) =>
@@ -27,7 +27,8 @@ enum Plugin {
27
27
  MasterpassRest = 'pz-masterpass-rest',
28
28
  SimilarProducts = 'pz-similar-products',
29
29
  Haso = 'pz-haso',
30
- GooglePay = 'pz-google-pay'
30
+ GooglePay = 'pz-google-pay',
31
+ ListHoverImage = 'pz-list-hover-image'
31
32
  }
32
33
 
33
34
  export enum Component {
@@ -68,7 +69,8 @@ export enum Component {
68
69
  ImageSearchButton = 'ImageSearchButton',
69
70
  HeaderImageSearchFeature = 'HeaderImageSearchFeature',
70
71
  HasoPaymentGateway = 'HasoPaymentGateway',
71
- GooglePay = 'GooglePay'
72
+ GooglePay = 'GooglePay',
73
+ ListHoverImage = 'ListHoverImage'
72
74
  }
73
75
 
74
76
  const PluginComponents = new Map([
@@ -123,7 +125,8 @@ const PluginComponents = new Map([
123
125
  [Plugin.Hepsipay, [Component.Hepsipay]],
124
126
  [Plugin.MasterpassRest, [Component.MasterpassRest]],
125
127
  [Plugin.Haso, [Component.HasoPaymentGateway]],
126
- [Plugin.GooglePay, [Component.GooglePay]]
128
+ [Plugin.GooglePay, [Component.GooglePay]],
129
+ [Plugin.ListHoverImage, [Component.ListHoverImage]]
127
130
  ]);
128
131
 
129
132
  const getPlugin = (component: Component) => {
@@ -202,6 +205,8 @@ export default function PluginModule({
202
205
  promise = import(`${'@akinon/pz-haso'}`);
203
206
  } else if (plugin === Plugin.GooglePay) {
204
207
  promise = import(`${'@akinon/pz-google-pay'}`);
208
+ } else if (plugin === Plugin.ListHoverImage) {
209
+ promise = import(`${'@akinon/pz-list-hover-image'}`);
205
210
  }
206
211
  } catch (error) {
207
212
  logger.error(error);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "1.126.16",
4
+ "version": "1.126.17",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "set-cookie-parser": "2.6.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@akinon/eslint-plugin-projectzero": "1.126.16",
38
+ "@akinon/eslint-plugin-projectzero": "1.126.17",
39
39
  "@babel/core": "7.26.10",
40
40
  "@babel/preset-env": "7.26.9",
41
41
  "@babel/preset-typescript": "7.27.0",
package/plugins.js CHANGED
@@ -23,5 +23,6 @@ module.exports = [
23
23
  'pz-masterpass-rest',
24
24
  'pz-similar-products',
25
25
  'pz-haso',
26
- 'pz-google-pay'
26
+ 'pz-google-pay',
27
+ 'pz-list-hover-image'
27
28
  ];
package/with-pz-config.js CHANGED
@@ -5,7 +5,12 @@ const deepMerge = require('./utils/deep-merge');
5
5
  const defaultConfig = {
6
6
  experimental: { instrumentationHook: true },
7
7
  reactStrictMode: true,
8
- transpilePackages: ['@akinon/next', ...pzPlugins.map((p) => `@akinon/${p}`)],
8
+ transpilePackages: [
9
+ '@akinon/next',
10
+ '@akinon/pz-theme',
11
+ '@akinon/theme-contract',
12
+ ...pzPlugins.map((p) => `@akinon/${p}`)
13
+ ],
9
14
  skipTrailingSlashRedirect: true,
10
15
  poweredByHeader: false,
11
16
  cacheMaxMemorySize: 0,