elm-pages 3.0.22 → 3.0.24

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.
@@ -180,6 +180,10 @@ async function main() {
180
180
  "Output path for compiled script",
181
181
  "./myscript.mjs"
182
182
  )
183
+ .option(
184
+ "--set-version <version>",
185
+ "Set the version string for the bundled script"
186
+ )
183
187
  .option(
184
188
  "--external <package-or-pattern>",
185
189
  "build site to be served under a base path",
@@ -236,7 +240,8 @@ await renderer.runGenerator(
236
240
  [...process.argv].splice(2),
237
241
  customBackendTask,
238
242
  Elm,
239
- "${moduleName}"
243
+ "${moduleName}",
244
+ "${options.setVersion || "Version not set."}"
240
245
  );
241
246
  `;
242
247
  // source: https://github.com/evanw/esbuild/pull/2067#issuecomment-1073039746
@@ -1,3 +1,3 @@
1
1
  export const compatibilityKey = 22;
2
2
 
3
- export const packageVersion = "3.0.22";
3
+ export const packageVersion = "3.0.24";
@@ -77,12 +77,14 @@ export async function render(
77
77
  * @param {string[]} cliOptions
78
78
  * @param {any} portsFile
79
79
  * @param {string} scriptModuleName
80
+ * @param {string} versionMessage
80
81
  */
81
82
  export async function runGenerator(
82
83
  cliOptions,
83
84
  portsFile,
84
85
  elmModule,
85
- scriptModuleName
86
+ scriptModuleName,
87
+ versionMessage
86
88
  ) {
87
89
  global.isRunningGenerator = true;
88
90
  // const { fs, resetInMemoryFs } = require("./request-cache-fs.js")(true);
@@ -100,7 +102,8 @@ export async function runGenerator(
100
102
  scriptModuleName,
101
103
  "production",
102
104
  "",
103
- true
105
+ true,
106
+ versionMessage
104
107
  );
105
108
  return result;
106
109
  } catch (error) {
@@ -119,6 +122,7 @@ export async function runGenerator(
119
122
  * @param {typeof import("fs") | import("memfs").IFs} fs
120
123
  * @param {boolean} hasFsAccess
121
124
  * @param {string} scriptModuleName
125
+ * @param {string} versionMessage
122
126
  */
123
127
  function runGeneratorAppHelp(
124
128
  cliOptions,
@@ -128,12 +132,22 @@ function runGeneratorAppHelp(
128
132
  scriptModuleName,
129
133
  mode,
130
134
  pagePath,
131
- hasFsAccess
135
+ hasFsAccess,
136
+ versionMessage
132
137
  ) {
133
138
  const isDevServer = mode !== "build";
134
139
  let patternsToWatch = new Set();
135
140
  let app = null;
136
141
  let killApp;
142
+ // Handle version flag with early return
143
+ if (
144
+ cliOptions.length === 1 &&
145
+ (cliOptions[0] === "--version" || cliOptions[0] === "-v")
146
+ ) {
147
+ console.log(versionMessage);
148
+ return Promise.resolve();
149
+ }
150
+
137
151
  return new Promise((resolve, reject) => {
138
152
  const isBytes = pagePath.match(/content\.dat\/?$/);
139
153
 
@@ -141,7 +155,7 @@ function runGeneratorAppHelp(
141
155
  flags: {
142
156
  compatibilityKey,
143
157
  argv: ["", `elm-pages run ${scriptModuleName}`, ...cliOptions],
144
- versionMessage: "1.2.3",
158
+ versionMessage: versionMessage || "",
145
159
  },
146
160
  });
147
161
 
@@ -9,7 +9,7 @@
9
9
  "devDependencies": {
10
10
  "elm-codegen": "^0.6.1",
11
11
  "elm-optimize-level-2": "^0.3.5",
12
- "elm-pages": "3.0.22",
12
+ "elm-pages": "3.0.24",
13
13
  "elm-review": "^2.12.0",
14
14
  "elm-tooling": "^1.15.1",
15
15
  "lamdera": "^0.19.1-1.3.2",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elm-pages",
3
3
  "type": "module",
4
- "version": "3.0.22",
4
+ "version": "3.0.24",
5
5
  "homepage": "https://elm-pages.com",
6
6
  "moduleResolution": "node",
7
7
  "description": "Hybrid Elm framework with full-stack and static routes.",