olly-molly 0.2.18 ā 0.2.20
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/bin/cli.js +18 -9
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -88,6 +88,11 @@ function getLocalVersion() {
|
|
|
88
88
|
|
|
89
89
|
const CUSTOM_PROFILES_DIR = path.join(APP_DIR, 'custom-profiles');
|
|
90
90
|
|
|
91
|
+
function hasProductionBuild(standaloneServerPath) {
|
|
92
|
+
return fs.existsSync(path.join(APP_DIR, '.next', 'BUILD_ID')) ||
|
|
93
|
+
fs.existsSync(standaloneServerPath);
|
|
94
|
+
}
|
|
95
|
+
|
|
91
96
|
function backupUserData() {
|
|
92
97
|
const backupDir = path.join(os.tmpdir(), 'olly-molly-backup');
|
|
93
98
|
fs.mkdirSync(backupDir, { recursive: true });
|
|
@@ -142,6 +147,7 @@ async function main() {
|
|
|
142
147
|
const localVersion = getLocalVersion();
|
|
143
148
|
const npmVersion = await getNpmVersion();
|
|
144
149
|
const prebuiltUrl = getPrebuiltUrl(npmVersion);
|
|
150
|
+
const standaloneServerPath = path.join(APP_DIR, '.next', 'standalone', 'server.js');
|
|
145
151
|
|
|
146
152
|
async function downloadApp() {
|
|
147
153
|
if (prebuiltUrl) {
|
|
@@ -183,8 +189,14 @@ async function main() {
|
|
|
183
189
|
execSync('npm install --omit=dev', { cwd: APP_DIR, stdio: 'inherit' });
|
|
184
190
|
}
|
|
185
191
|
|
|
192
|
+
if (usedPrebuilt && !fs.existsSync(standaloneServerPath)) {
|
|
193
|
+
usedPrebuilt = false;
|
|
194
|
+
needsInstall = true;
|
|
195
|
+
needsBuild = true;
|
|
196
|
+
}
|
|
197
|
+
|
|
186
198
|
// Build
|
|
187
|
-
if (needsBuild || !
|
|
199
|
+
if (needsBuild || !hasProductionBuild(standaloneServerPath)) {
|
|
188
200
|
console.log('\nšØ Building...\n');
|
|
189
201
|
execSync('npm run build', { cwd: APP_DIR, stdio: 'inherit' });
|
|
190
202
|
}
|
|
@@ -204,19 +216,16 @@ async function main() {
|
|
|
204
216
|
|
|
205
217
|
let server;
|
|
206
218
|
if (usedPrebuilt) {
|
|
207
|
-
|
|
208
|
-
if (!fs.existsSync(serverPath)) {
|
|
209
|
-
throw new Error('Prebuilt bundle missing .next/standalone/server.js');
|
|
210
|
-
}
|
|
211
|
-
server = spawn('node', [serverPath], {
|
|
219
|
+
server = spawn('node', [standaloneServerPath], {
|
|
212
220
|
cwd: APP_DIR,
|
|
213
221
|
stdio: 'inherit',
|
|
214
222
|
env: { ...process.env, PORT: '1234' },
|
|
215
|
-
shell:
|
|
223
|
+
shell: false
|
|
216
224
|
});
|
|
217
225
|
} else {
|
|
218
|
-
|
|
219
|
-
|
|
226
|
+
const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
227
|
+
server = spawn(npxCmd, ['next', 'start', '--port', '1234'], {
|
|
228
|
+
cwd: APP_DIR, stdio: 'inherit', shell: false
|
|
220
229
|
});
|
|
221
230
|
}
|
|
222
231
|
|