/* Copyright 2020-2026 Lowdefy, Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* The shell's version: the @lowdefy/shell package version, which the shell sends as `x-lowdefy-shell` and compares with an app's `mobile.minShellVersion` (src/version/isShellTooOld.js). Written to src/version/shellVersion.js, which the shell's JavaScript imports (src/config/getShellConfig.js). The version travels in the JavaScript bundle, not the Expo config, so it is the version of the code that runs: an embedded launch reads the Expo config the native build embedded, which a shell running newer JavaScript from Metro has outgrown. Only the version is written, not package.json, which would put every dependency name in the bundle. The file is committed; src/version/shellVersion.test.js fails when it is stale, and `pnpm release:version` rewrites it after the version bump. node scripts/createShellVersion.mjs prints the version node scripts/createShellVersion.mjs --write writes src/version/shellVersion.js Usage: pnpm --filter=@lowdefy/shell shell-version */ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const shellRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const HEADER = `/* Copyright 2020-2026 Lowdefy, Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Generated by scripts/createShellVersion.mjs from package.json. Do not edit. `; function createShellVersion() { const { version } = JSON.parse(fs.readFileSync(path.join(shellRoot, 'package.json'), 'utf8')); return version; } function createShellVersionModule() { return `${HEADER}\nconst shellVersion = ${JSON.stringify( createShellVersion() )};\n\nexport default shellVersion;\n`; } if (process.argv[1] === fileURLToPath(import.meta.url)) { if (process.argv.includes('--write')) { fs.writeFileSync( path.join(shellRoot, 'src/version/shellVersion.js'), createShellVersionModule() ); } else { process.stdout.write(createShellVersion()); } } export default createShellVersion;