1 | const stat = require('fs').stat;
|
2 |
|
3 | stat('lib', (error, statResult) => {
|
4 | if (error || !statResult.isDirectory()) {
|
5 | console.warn(
|
6 | '-'.repeat(85) + '\n' +
|
7 | 'Built output not found. It looks like you might be attempting to install Roc\n' +
|
8 | 'from GitHub. Roc sources need to be transpiled before use. We will now make a\n' +
|
9 | 'best-efforts attempt to transpile the code. This will only work if your development\n' +
|
10 | 'environment is set up appropriately, most importantly that babel is available.\n' +
|
11 | '-'.repeat(85)
|
12 | );
|
13 |
|
14 | try {
|
15 | const execSync = require('child_process').execSync;
|
16 | execSync('npm run build', { stdio: 'inherit' });
|
17 | } catch (e) {
|
18 | console.error(
|
19 | '-'.repeat(85) + '\n' +
|
20 | 'Failed to build Roc automatically. Please install Roc from\n' +
|
21 | 'npm, or clone the repo locally and build the library manually.\n' +
|
22 | '-'.repeat(85)
|
23 | );
|
24 | throw e;
|
25 | }
|
26 | }
|
27 | });
|