lwr 0.10.0-alpha.8 → 0.10.0
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/build/cjs/cli/commands/build.cjs +16 -2
- package/build/cjs/cli/commands/cli.cjs +1 -1
- package/build/cjs/cli/commands/dev.cjs +2 -2
- package/build/cjs/cli/commands/preview.cjs +1 -1
- package/build/es/cli/commands/build.js +17 -2
- package/build/es/cli/commands/cli.js +1 -1
- package/build/es/cli/commands/dev.js +2 -2
- package/build/es/cli/commands/preview.js +1 -1
- package/build/es/index.d.ts +1 -1
- package/package.json +10 -10
|
@@ -37,7 +37,11 @@ function createBuildCommand() {
|
|
|
37
37
|
import_shared_utils.logger.info("[build] Building lwr application");
|
|
38
38
|
const {rootDir, config, output, mode, clean, target, minify, routes, modules, locales} = cmd.optsWithGlobals();
|
|
39
39
|
const outputDir = output ? output : (0, import_utils.getDefaultBuildDirectory)(rootDir, config, target);
|
|
40
|
-
const aConfig = (0, import_config.loadConfig)();
|
|
40
|
+
const aConfig = (0, import_config.loadConfig)({rootDir, lwrConfigFile: config});
|
|
41
|
+
let ssrFunctionNodeVersion;
|
|
42
|
+
if (target === "mrt") {
|
|
43
|
+
ssrFunctionNodeVersion = getSuggestedNodeVersion();
|
|
44
|
+
}
|
|
41
45
|
if (clean) {
|
|
42
46
|
import_shared_utils.logger.info(`[build] Clearing output directory: ${outputDir}`);
|
|
43
47
|
import_fs_extra.default.rmSync(outputDir, {recursive: true, force: true});
|
|
@@ -134,7 +138,7 @@ function createBuildCommand() {
|
|
|
134
138
|
],
|
|
135
139
|
ssrShared: [],
|
|
136
140
|
ssrParameters: {
|
|
137
|
-
ssrFunctionNodeVersion
|
|
141
|
+
ssrFunctionNodeVersion,
|
|
138
142
|
proxyConfigs: []
|
|
139
143
|
}
|
|
140
144
|
};
|
|
@@ -155,3 +159,13 @@ function createBuildCommand() {
|
|
|
155
159
|
}
|
|
156
160
|
});
|
|
157
161
|
}
|
|
162
|
+
var MRT_VERSIONS = [16, 18];
|
|
163
|
+
function getSuggestedNodeVersion() {
|
|
164
|
+
const nodeVersion = process.version;
|
|
165
|
+
const majorVersion = parseInt(nodeVersion.slice(1).split(".")[0]);
|
|
166
|
+
if (!MRT_VERSIONS.includes(majorVersion)) {
|
|
167
|
+
import_shared_utils.logger.error(`Node Version ${nodeVersion} is not one of LWR Lambda's supported versions ${MRT_VERSIONS.join(", ")}`);
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
return `${majorVersion}.x`;
|
|
171
|
+
}
|
|
@@ -34,7 +34,7 @@ var import_getVersion = __toModule(require("../utils/getVersion.cjs"));
|
|
|
34
34
|
function createCLI() {
|
|
35
35
|
const cli = new import_commander.Command("lwr");
|
|
36
36
|
cli.description("LWR command line");
|
|
37
|
-
cli.addOption(new import_commander.Option("-c, --config <file>", `[string] use specified lwr.config.json file`).default("lwr.config.json")).addOption(new import_commander.Option("--rootDir <directory>", `[string] use specified root directory`).default("."));
|
|
37
|
+
cli.addOption(new import_commander.Option("-c, --config <file>", `[string] use specified lwr.config.json file`).default("lwr.config.json")).addOption(new import_commander.Option("--rootDir <directory>", `[string] use specified root directory`).default(process.cwd(), '"."'));
|
|
38
38
|
cli.addCommand((0, import_dev.createDevCommand)());
|
|
39
39
|
cli.addCommand((0, import_build.createBuildCommand)());
|
|
40
40
|
cli.addCommand((0, import_preview.createPreviewCommand)());
|
|
@@ -33,9 +33,9 @@ var import_utils = __toModule(require("../utils.cjs"));
|
|
|
33
33
|
function createDevCommand() {
|
|
34
34
|
return new import_commander.Command("dev").description("Starts an LWR server (defaults to dev mode)").addOption((0, import_utils.getPortOption)()).addOption((0, import_utils.getModeOption)().default("dev")).option("-o, --open", `[boolean] open browser on startup`, false).action(async (options, cmd) => {
|
|
35
35
|
const {createServer} = await Promise.resolve().then(() => __toModule(require("@lwrjs/core")));
|
|
36
|
-
const {port, mode, open} = cmd.optsWithGlobals();
|
|
36
|
+
const {port, mode, rootDir, config, open} = cmd.optsWithGlobals();
|
|
37
37
|
try {
|
|
38
|
-
const server = createServer({port, serverMode: mode});
|
|
38
|
+
const server = createServer({port, serverMode: mode, rootDir, lwrConfigFile: config});
|
|
39
39
|
await server.listen(async ({serverMode, port: port2}) => {
|
|
40
40
|
console.log(import_chalk.default.green(`Running LWR at: http://localhost:${port2} | mode: ${serverMode}`));
|
|
41
41
|
if (open) {
|
|
@@ -57,7 +57,7 @@ function createPreviewCommand() {
|
|
|
57
57
|
}
|
|
58
58
|
} else {
|
|
59
59
|
const {createServer} = await Promise.resolve().then(() => __toModule(require("@lwrjs/core")));
|
|
60
|
-
const server = createServer({port, serverMode});
|
|
60
|
+
const server = createServer({port, serverMode, rootDir, lwrConfigFile: config});
|
|
61
61
|
const internalServer = server.getInternalServer();
|
|
62
62
|
if (import_fs_extra.default.existsSync(dir)) {
|
|
63
63
|
import_shared_utils.logger.info("Using prebuilt content from directory: " + dir);
|
|
@@ -19,7 +19,12 @@ export function createBuildCommand() {
|
|
|
19
19
|
logger.info('[build] Building lwr application');
|
|
20
20
|
const { rootDir, config, output, mode, clean, target, minify, routes, modules, locales } = cmd.optsWithGlobals();
|
|
21
21
|
const outputDir = output ? output : getDefaultBuildDirectory(rootDir, config, target);
|
|
22
|
-
const aConfig = loadConfig(
|
|
22
|
+
const aConfig = loadConfig({ rootDir, lwrConfigFile: config });
|
|
23
|
+
let ssrFunctionNodeVersion;
|
|
24
|
+
if (target === 'mrt') {
|
|
25
|
+
// Check the node version (to fail early)
|
|
26
|
+
ssrFunctionNodeVersion = getSuggestedNodeVersion();
|
|
27
|
+
}
|
|
23
28
|
if (clean) {
|
|
24
29
|
logger.info(`[build] Clearing output directory: ${outputDir}`);
|
|
25
30
|
fs.rmSync(outputDir, { recursive: true, force: true });
|
|
@@ -146,7 +151,7 @@ export function createBuildCommand() {
|
|
|
146
151
|
ssrShared: [],
|
|
147
152
|
// Additional parameters that configure Express app behavior.
|
|
148
153
|
ssrParameters: {
|
|
149
|
-
ssrFunctionNodeVersion
|
|
154
|
+
ssrFunctionNodeVersion,
|
|
150
155
|
proxyConfigs: [],
|
|
151
156
|
},
|
|
152
157
|
};
|
|
@@ -175,4 +180,14 @@ export function createBuildCommand() {
|
|
|
175
180
|
}
|
|
176
181
|
});
|
|
177
182
|
}
|
|
183
|
+
const MRT_VERSIONS = [16, 18];
|
|
184
|
+
function getSuggestedNodeVersion() {
|
|
185
|
+
const nodeVersion = process.version;
|
|
186
|
+
const majorVersion = parseInt(nodeVersion.slice(1).split('.')[0]);
|
|
187
|
+
if (!MRT_VERSIONS.includes(majorVersion)) {
|
|
188
|
+
logger.error(`Node Version ${nodeVersion} is not one of LWR Lambda's supported versions ${MRT_VERSIONS.join(', ')}`);
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
return `${majorVersion}.x`;
|
|
192
|
+
}
|
|
178
193
|
//# sourceMappingURL=build.js.map
|
|
@@ -6,7 +6,7 @@ import { getVersion } from '../utils/getVersion.js';
|
|
|
6
6
|
export function createCLI() {
|
|
7
7
|
const cli = new Command('lwr');
|
|
8
8
|
cli.description('LWR command line');
|
|
9
|
-
cli.addOption(new Option('-c, --config <file>', `[string] use specified lwr.config.json file`).default('lwr.config.json')).addOption(new Option('--rootDir <directory>', `[string] use specified root directory`).default('.'));
|
|
9
|
+
cli.addOption(new Option('-c, --config <file>', `[string] use specified lwr.config.json file`).default('lwr.config.json')).addOption(new Option('--rootDir <directory>', `[string] use specified root directory`).default(process.cwd(), '"."'));
|
|
10
10
|
cli.addCommand(createDevCommand());
|
|
11
11
|
cli.addCommand(createBuildCommand());
|
|
12
12
|
cli.addCommand(createPreviewCommand());
|
|
@@ -10,9 +10,9 @@ export function createDevCommand() {
|
|
|
10
10
|
.option('-o, --open', `[boolean] open browser on startup`, false)
|
|
11
11
|
.action(async (options, cmd) => {
|
|
12
12
|
const { createServer } = await import('@lwrjs/core');
|
|
13
|
-
const { port, mode, open } = cmd.optsWithGlobals();
|
|
13
|
+
const { port, mode, rootDir, config, open } = cmd.optsWithGlobals();
|
|
14
14
|
try {
|
|
15
|
-
const server = createServer({ port, serverMode: mode });
|
|
15
|
+
const server = createServer({ port, serverMode: mode, rootDir, lwrConfigFile: config });
|
|
16
16
|
await server.listen(async ({ serverMode, port }) => {
|
|
17
17
|
console.log(chalk.green(`Running LWR at: http://localhost:${port} | mode: ${serverMode}`));
|
|
18
18
|
if (open) {
|
|
@@ -48,7 +48,7 @@ export function createPreviewCommand() {
|
|
|
48
48
|
else {
|
|
49
49
|
// Not mrt, just launch LWR server
|
|
50
50
|
const { createServer } = await import('@lwrjs/core');
|
|
51
|
-
const server = createServer({ port, serverMode });
|
|
51
|
+
const server = createServer({ port, serverMode, rootDir, lwrConfigFile: config });
|
|
52
52
|
const internalServer = server.getInternalServer();
|
|
53
53
|
// TODO we could just run a static server vs running LWR services here
|
|
54
54
|
if (fs.existsSync(dir)) {
|
package/build/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createServer, generateStaticSite } from '@lwrjs/core';
|
|
2
2
|
export { DiagnosticsError } from '@lwrjs/diagnostics';
|
|
3
3
|
export type { LwrApp } from '@lwrjs/core';
|
|
4
|
-
export type { AbstractModuleId, AssetProvider, ClientBootstrapConfig, CompiledView, FsModuleEntry, GlobalData, HandlerContext, HooksPlugin, Json, LocalizedViewRequest, LwrAppBootstrapConfig, LwrAppEmitter, LwrAppObserver, LwrErrorRoute, LwrGlobalConfig, LwrRoute, ModuleCompiled, ModuleEntry, ModuleProvider, ModuleSource, NormalizedLwrGlobalConfig, ProviderAppConfig, ProviderContext, PublicModuleRegistry, PublicResourceRegistry, PublicViewRegistry, PublicAssetRegistry, ResourceDefinition, ResourceIdentifier, ResourceProvider, RouteHandlerFunction, RouteHandlerView, RouteHandlerViewApi, RouteHandlerViewResponse, RuntimeEnvironment, RuntimeParams, ViewIdentity, ViewParams, ViewProvider, ViewRequest, ViewResponse, Watcher,
|
|
4
|
+
export type { AbstractModuleId, AssetProvider, AssetTransformPlugin, ClientBootstrapConfig, CompiledView, FsModuleEntry, GlobalData, HandlerContext, HooksPlugin, Json, LocalizedViewRequest, LwrAppBootstrapConfig, LwrAppEmitter, LwrAppObserver, LwrErrorRoute, LwrGlobalConfig, LwrRoute, ModuleCompiled, ModuleEntry, ModuleProvider, ModuleSource, NormalizedLwrGlobalConfig, ProviderAppConfig, ProviderContext, PublicModuleRegistry, PublicResourceRegistry, PublicViewRegistry, PublicAssetRegistry, ResourceDefinition, ResourceIdentifier, ResourceProvider, RouteHandlerFunction, RouteHandlerView, RouteHandlerViewApi, RouteHandlerViewResponse, RuntimeEnvironment, RuntimeParams, ViewIdentity, ViewParams, ViewProvider, ViewRequest, ViewResponse, Watcher, } from '@lwrjs/types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|
|
20
20
|
"types": "build/es/index.d.ts",
|
|
21
|
-
"version": "0.10.0
|
|
21
|
+
"version": "0.10.0",
|
|
22
22
|
"module": "build/es/index.js",
|
|
23
23
|
"main": "build/cjs/index.cjs",
|
|
24
24
|
"files": [
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@lwrjs/config": "0.10.0
|
|
45
|
-
"@lwrjs/core": "0.10.0
|
|
46
|
-
"@lwrjs/diagnostics": "0.10.0
|
|
47
|
-
"@lwrjs/shared-utils": "0.10.0
|
|
48
|
-
"@lwrjs/tools": "0.10.0
|
|
44
|
+
"@lwrjs/config": "0.10.0",
|
|
45
|
+
"@lwrjs/core": "0.10.0",
|
|
46
|
+
"@lwrjs/diagnostics": "0.10.0",
|
|
47
|
+
"@lwrjs/shared-utils": "0.10.0",
|
|
48
|
+
"@lwrjs/tools": "0.10.0",
|
|
49
49
|
"chalk": "^4.1.0",
|
|
50
50
|
"commander": "^10.0.0",
|
|
51
|
-
"fs-extra": "^11.1.
|
|
51
|
+
"fs-extra": "^11.1.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@commander-js/extra-typings": "^10.0.2",
|
|
55
|
-
"@lwrjs/types": "0.10.0
|
|
55
|
+
"@lwrjs/types": "0.10.0"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
|
-
"node": ">=16.0.0
|
|
58
|
+
"node": ">=16.0.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "e6deaeef3db8aa079acefed508897eca19b3218a"
|
|
61
61
|
}
|