| 46 | } |
| 47 | |
| 48 | function build() { |
| 49 | |
| 50 | fromDir(path.join(__dirname, 'src'), '.js', copyCurrentDirectoryToDist); |
| 51 | fromDir(path.join(__dirname, 'src'), '.tsx', copyCurrentDirectoryToDist); |
| 52 | |
| 53 | try { |
| 54 | const output = cp.spawnSync('next', ['build']); |
| 55 | console.log(output.stdout.toString()); |
| 56 | } catch (e) { |
| 57 | console.log(e); |
| 58 | } finally { |
| 59 | console.log('cleanup'); |
| 60 | fromDir(path.join(__dirname, 'src'), '.js.original', resetToOriginalState); |
| 61 | fromDir(path.join(__dirname, 'src'), '.tsx.original', resetToOriginalState); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | function fromDir(startPath: any, filter: any, callback: any) { |
| 66 | |