@opennextjs/aws 4.1.11 → 4.1.12
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/dist/build/helper.d.ts +3 -0
- package/dist/build/helper.js +8 -1
- package/dist/index.js +6 -20
- package/dist/utils/args.d.ts +20 -0
- package/dist/utils/args.js +44 -0
- package/package.json +1 -1
package/dist/build/helper.d.ts
CHANGED
|
@@ -66,7 +66,10 @@ export type { SemverOp } from "../utils/semver.js";
|
|
|
66
66
|
export { compareSemver } from "../utils/semver.js";
|
|
67
67
|
/**
|
|
68
68
|
* Check if a Next.js version is supported by the Next.js team.
|
|
69
|
+
*
|
|
69
70
|
* Major versions are supported for 2 years following their initial release.
|
|
71
|
+
* A major version is also considered supported as long as it is the Active or Maintenance LTS,
|
|
72
|
+
* that is until the second next major version is released (i.e. 15 is supported until 17 is released).
|
|
70
73
|
*
|
|
71
74
|
* @param version - The Next.js version to check (semver format)
|
|
72
75
|
* @returns true if the version is currently supported, false otherwise
|
package/dist/build/helper.js
CHANGED
|
@@ -235,7 +235,10 @@ const NEXT_RELEASE_DATES = {
|
|
|
235
235
|
};
|
|
236
236
|
/**
|
|
237
237
|
* Check if a Next.js version is supported by the Next.js team.
|
|
238
|
+
*
|
|
238
239
|
* Major versions are supported for 2 years following their initial release.
|
|
240
|
+
* A major version is also considered supported as long as it is the Active or Maintenance LTS,
|
|
241
|
+
* that is until the second next major version is released (i.e. 15 is supported until 17 is released).
|
|
239
242
|
*
|
|
240
243
|
* @param version - The Next.js version to check (semver format)
|
|
241
244
|
* @returns true if the version is currently supported, false otherwise
|
|
@@ -245,10 +248,14 @@ export function isNextVersionSupported(version) {
|
|
|
245
248
|
if (!match) {
|
|
246
249
|
return false;
|
|
247
250
|
}
|
|
248
|
-
const
|
|
251
|
+
const major = Number(match[0]);
|
|
252
|
+
const releaseDateStr = NEXT_RELEASE_DATES[major];
|
|
249
253
|
if (!releaseDateStr) {
|
|
250
254
|
return false;
|
|
251
255
|
}
|
|
256
|
+
if (!NEXT_RELEASE_DATES[major + 2]) {
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
252
259
|
const releaseDate = new Date(releaseDateStr);
|
|
253
260
|
const supportEndDate = new Date(releaseDate);
|
|
254
261
|
supportEndDate.setFullYear(supportEndDate.getFullYear() + 2);
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { build } from "./build.js";
|
|
3
|
+
import { parseArgs } from "./utils/args.js";
|
|
3
4
|
const command = process.argv[2];
|
|
4
5
|
if (command !== "build")
|
|
5
6
|
printHelp();
|
|
6
|
-
const args = parseArgs();
|
|
7
|
-
if (
|
|
7
|
+
const args = parseArgs(process.argv.slice(2));
|
|
8
|
+
if (args.help)
|
|
8
9
|
printHelp();
|
|
9
|
-
await build(args
|
|
10
|
-
function parseArgs() {
|
|
11
|
-
return process.argv.slice(2).reduce((acc, key, ind, self) => {
|
|
12
|
-
if (key.startsWith("--")) {
|
|
13
|
-
if (self[ind + 1] && self[ind + 1].startsWith("-")) {
|
|
14
|
-
acc[key] = undefined;
|
|
15
|
-
}
|
|
16
|
-
else if (self[ind + 1]) {
|
|
17
|
-
acc[key] = self[ind + 1];
|
|
18
|
-
// eslint-disable-next-line sonarjs/elseif-without-else
|
|
19
|
-
}
|
|
20
|
-
else if (!self[ind + 1]) {
|
|
21
|
-
acc[key] = undefined;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return acc;
|
|
25
|
-
}, {});
|
|
26
|
-
}
|
|
10
|
+
await build(args.configPath, args.nodeExternals, args.dangerouslyUseUnsupportedNextVersion);
|
|
27
11
|
function printHelp() {
|
|
28
12
|
console.log(`Unknown command
|
|
29
13
|
|
|
@@ -33,6 +17,8 @@ You can use a custom config path here
|
|
|
33
17
|
npx open-next build --config-path ./path/to/open-next.config.ts
|
|
34
18
|
You can configure externals for the esbuild compilation of the open-next.config.ts file
|
|
35
19
|
npx open-next build --node-externals aws-sdk,sharp,sqlite3
|
|
20
|
+
You can build with a Next.js version that is not supported by the Next.js team anymore
|
|
21
|
+
npx open-next build --dangerously-use-unsupported-next-version
|
|
36
22
|
`);
|
|
37
23
|
process.exit(1);
|
|
38
24
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CliArgs {
|
|
2
|
+
/** Value of `--config-path` */
|
|
3
|
+
configPath?: string;
|
|
4
|
+
/** Value of `--node-externals` */
|
|
5
|
+
nodeExternals?: string;
|
|
6
|
+
/** Whether `--help` is present */
|
|
7
|
+
help: boolean;
|
|
8
|
+
/** Whether `--dangerously-use-unsupported-next-version` is present */
|
|
9
|
+
dangerouslyUseUnsupportedNextVersion: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parses the command line arguments of the `open-next` CLI.
|
|
13
|
+
*
|
|
14
|
+
* Boolean flags (i.e. `--help`) are `true` when present and never consume the following argument.
|
|
15
|
+
* Other flags take the following argument as their value unless it starts with `-`.
|
|
16
|
+
*
|
|
17
|
+
* @param argv - The CLI arguments, without the node executable and script path (i.e. `process.argv.slice(2)`)
|
|
18
|
+
* @returns The parsed arguments
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseArgs(argv: string[]): CliArgs;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flags that do not take a value. They are `true` when present and never consume the next argument.
|
|
3
|
+
*/
|
|
4
|
+
const BOOLEAN_FLAGS = new Set([
|
|
5
|
+
"--help",
|
|
6
|
+
"--dangerously-use-unsupported-next-version",
|
|
7
|
+
]);
|
|
8
|
+
/**
|
|
9
|
+
* Parses the command line arguments of the `open-next` CLI.
|
|
10
|
+
*
|
|
11
|
+
* Boolean flags (i.e. `--help`) are `true` when present and never consume the following argument.
|
|
12
|
+
* Other flags take the following argument as their value unless it starts with `-`.
|
|
13
|
+
*
|
|
14
|
+
* @param argv - The CLI arguments, without the node executable and script path (i.e. `process.argv.slice(2)`)
|
|
15
|
+
* @returns The parsed arguments
|
|
16
|
+
*/
|
|
17
|
+
export function parseArgs(argv) {
|
|
18
|
+
const flags = new Set();
|
|
19
|
+
const values = {};
|
|
20
|
+
for (let i = 0; i < argv.length; i++) {
|
|
21
|
+
const key = argv[i];
|
|
22
|
+
if (!key.startsWith("--")) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (BOOLEAN_FLAGS.has(key)) {
|
|
26
|
+
flags.add(key);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const next = argv[i + 1];
|
|
30
|
+
if (next && !next.startsWith("-")) {
|
|
31
|
+
values[key] = next;
|
|
32
|
+
i++;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
values[key] = undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
configPath: values["--config-path"],
|
|
40
|
+
nodeExternals: values["--node-externals"],
|
|
41
|
+
help: flags.has("--help"),
|
|
42
|
+
dangerouslyUseUnsupportedNextVersion: flags.has("--dangerously-use-unsupported-next-version"),
|
|
43
|
+
};
|
|
44
|
+
}
|