git ssb

0+

cel-desktop / ssb-pkg



Tree: 8f4b43a09aab9801bf28987edd59c2e366180327

Files: 8f4b43a09aab9801bf28987edd59c2e366180327 / test / test-42-path-related-values / main.js

1401 bytesRaw
1#!/usr/bin/env node
2
3'use strict';
4
5const path = require('path');
6const assert = require('assert');
7const utils = require('../utils.js');
8
9assert(!module.parent);
10assert(__dirname === process.cwd());
11
12const target = process.argv[2] || 'host';
13const input = './project/app.js';
14const output = './deploy/app-x64.exe';
15
16let left, right;
17utils.mkdirp.sync(path.dirname(output));
18
19left = utils.spawn.sync(
20 'node', [ path.basename(input) ],
21 { cwd: path.dirname(input) }
22);
23
24utils.pkg.sync([
25 '--target', target,
26 '--output', output, input
27], { stdio: 'inherit' });
28
29right = utils.spawn.sync(
30 './' + path.basename(output), [],
31 { cwd: path.dirname(output) }
32);
33
34left = JSON.parse(left);
35right = JSON.parse(right);
36
37for (let obj of [ left, right ]) {
38 for (let s in obj) {
39 obj[s] = obj[s].replace('/home/travis/build', '')
40 .replace('/home/travis/.nvm/versions', '')
41 .replace('\\pkg\\test\\test-42-path-related-values', '')
42 .replace('/pkg/test/test-42-path-related-values', '')
43 .replace('app-x64.exe', 'app-x64');
44 }
45}
46
47function pad (s, width) {
48 const p = width > s.length ? width - s.length : 1;
49 return s + ' '.repeat(p);
50}
51
52console.log('-'.repeat(78));
53for (let s in left) {
54 console.log(pad(s, 30), '|', pad(left[s], 36), '|', right[s]);
55}
56console.log('-'.repeat(78));
57
58utils.vacuum.sync(path.dirname(output));
59

Built with git-ssb-web