@akinon/next 1.21.0-rc.3 → 1.21.0-rc.5
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 +12 -0
- package/bin/pz-install-plugins.js +28 -29
- package/middlewares/default.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
1
4
|
const path = require('path');
|
|
5
|
+
const rootDir = path.resolve(process.cwd());
|
|
2
6
|
const spawn = require('cross-spawn');
|
|
7
|
+
const availablePlugins = require('../plugins');
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
const insideNodeModules = __dirname.includes('node_modules');
|
|
6
|
-
return insideNodeModules
|
|
7
|
-
? path.resolve(__dirname, '../../../../')
|
|
8
|
-
: path.resolve(__dirname, '../../../apps/projectzeronext');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const BASE_DIR = findBaseDir();
|
|
9
|
+
let plugins;
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
try {
|
|
12
|
+
plugins = require(path.resolve(rootDir, './src/plugins.js'));
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.error('No plugins.js file found, skipping plugin installation.');
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
const akinonPackageNumber = require(packageJsonPath).dependencies[
|
|
17
|
-
'@akinon/next'
|
|
18
|
-
].replace('^', '');
|
|
19
|
-
//just in case
|
|
18
|
+
let installCmd = [];
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
availablePlugins
|
|
21
|
+
.filter((p) => plugins?.includes(p))
|
|
22
|
+
.forEach((name) => {
|
|
23
|
+
installCmd.push(`@akinon/${name}`);
|
|
24
|
+
});
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
(name) => `@akinon/${name}@${akinonPackageNumber}`
|
|
25
|
-
);
|
|
26
|
+
spawn.sync('yarn', ['cache clean']);
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
for (const plugin of availablePlugins) {
|
|
29
|
+
spawn.sync('yarn', ['remove', `@akinon/${plugin}`]);
|
|
30
|
+
}
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
if (
|
|
33
|
+
installCmd.length > 0 &&
|
|
34
|
+
!fs.existsSync(path.resolve(rootDir, '../../turbo.json'))
|
|
35
|
+
) {
|
|
36
|
+
spawn.sync('yarn', ['add', ...installCmd, '--ignore-scripts'], {
|
|
37
|
+
stdio: 'inherit'
|
|
33
38
|
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
if (installCmd.length > 0) {
|
|
37
|
-
const yarnArgs = ['add', ...installCmd, '--ignore-scripts'];
|
|
38
|
-
|
|
39
|
-
spawn.sync('yarn', yarnArgs, { stdio: 'inherit', cwd: BASE_DIR });
|
|
40
39
|
}
|
package/middlewares/default.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NextFetchEvent, NextMiddleware, NextResponse } from 'next/server';
|
|
2
2
|
import Settings from 'settings';
|
|
3
|
+
import { ROUTES } from 'routes';
|
|
3
4
|
import {
|
|
4
5
|
PzNextRequest,
|
|
5
6
|
withCheckoutProvider,
|
|
@@ -17,7 +18,6 @@ import withLocale from './locale';
|
|
|
17
18
|
import logger from '../utils/log';
|
|
18
19
|
import { user } from '../data/urls';
|
|
19
20
|
import { getUrlPathWithLocale } from '../utils/localization';
|
|
20
|
-
import { ROUTES } from 'projectzeronext/src/routes';
|
|
21
21
|
|
|
22
22
|
const withPzDefault =
|
|
23
23
|
(middleware: NextMiddleware) =>
|
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.21.0-rc.
|
|
4
|
+
"version": "1.21.0-rc.5",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@typescript-eslint/eslint-plugin": "6.7.4",
|
|
33
33
|
"@typescript-eslint/parser": "6.7.4",
|
|
34
34
|
"eslint": "^8.14.0",
|
|
35
|
-
"@akinon/eslint-plugin-projectzero": "1.21.0-rc.
|
|
35
|
+
"@akinon/eslint-plugin-projectzero": "1.21.0-rc.5",
|
|
36
36
|
"eslint-config-prettier": "8.5.0"
|
|
37
37
|
}
|
|
38
38
|
}
|