|
1 | 1 | #!/usr/bin/env zx |
2 | | -import { cp, mkdir, writeFile, stat } from 'fs/promises'; |
3 | | -import { pathExists } from 'fs-extra'; |
| 2 | +import { cp, mkdir, stat, writeFile } from 'fs/promises'; |
4 | 3 | import { exit } from 'process'; |
5 | 4 |
|
| 5 | +import { pathExists } from 'fs-extra'; |
6 | 6 | import { $, cd } from 'zx'; |
7 | 7 |
|
8 | 8 | import { getDeploymentVersion } from './get-deployment-version.mjs'; |
@@ -64,24 +64,23 @@ try { |
64 | 64 | ); |
65 | 65 | // # Create final tgz |
66 | 66 | await cp('./README.md', './deploy/pre-pack/README.md'); |
67 | | - |
68 | | - await cp('./node_modules', './deploy/pre-pack/node_modules', { recursive: true }); |
69 | 67 | // Install production dependencies |
70 | 68 |
|
71 | 69 | console.log('Installing dependencies...'); |
72 | 70 |
|
73 | 71 | $.verbose = true; |
74 | | - await $`npm --prefix ./deploy/pre-pack prune --omit=dev`; |
75 | | - await $`npm --prefix ./deploy/pre-pack install --omit=dev`; |
| 72 | + |
| 73 | + await cd('./deploy/pre-pack'); |
| 74 | + |
| 75 | + await $`npm install --omit=dev`; |
76 | 76 |
|
77 | 77 | // Ensure that we don't have any dev dependencies left |
78 | 78 | console.log('Installed dependencies:'); |
79 | | - await $`npm --prefix ./deploy/pre-pack ls --omit=dev --depth=0`; |
| 79 | + await $`npm ls --omit=dev --depth=0`; |
80 | 80 |
|
81 | 81 | console.log('Dependencies installed, packing...'); |
82 | 82 |
|
83 | 83 | // Now we'll pack everything in the pre-pack directory to the release directory |
84 | | - await cd('./deploy/pre-pack'); |
85 | 84 | const tarballPath = `../release/unraid-api-${deploymentVersion}.tgz`; |
86 | 85 | await $`tar -czf ${tarballPath} .`; |
87 | 86 | // Ensure the tarball exists |
|
90 | 89 | process.exit(1); |
91 | 90 | } |
92 | 91 | const packageSize = Math.round((await stat(tarballPath)).size / 1024 / 1024); |
93 | | - console.log( |
94 | | - `Package created at: ${tarballPath} with size ${packageSize} MB` |
95 | | - ); |
| 92 | + console.log(`Package created at: ${tarballPath} with size ${packageSize} MB`); |
96 | 93 | } catch (error) { |
97 | 94 | // Error with a command |
98 | 95 | if (Object.keys(error).includes('stderr')) { |
|
0 commit comments