1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.serverWatchNoSsr = exports.serverWatchSsrOnly = exports.serverWatch = exports.stats = exports.clientBuild = exports.clientWatch = exports.rmLibAndBundle = exports.rmBundle = exports.testE2E = exports.testUnit = exports.typecheck = exports.lint = exports.herokuLocalProd = exports.dbMigrTest = exports.dbSeed = exports.dbMigr = exports.babel = exports.DOCKER_WAIT_PG_TEST = exports.DOCKER_WAIT_PG = exports.DOCKER_UP_TEST = exports.dockerDownTest = exports.DOCKER_UP = exports.nodeLocalProd = void 0;
|
7 |
|
8 | var _checkSetup = require("@sharyn/check-setup");
|
9 |
|
10 | var _shared = require("./shared");
|
11 |
|
12 |
|
13 | var pathToSharynWebpackConfig = (0, _checkSetup.pathCascade)('node_modules/@sharyn/webpack-config', 'node_modules/sharyn/webpack-config');
|
14 | var pathToGlobalSetup = './src/_testing/global-setup.js';
|
15 | var hasGlobalSetup = (0, _checkSetup.hasFile)(pathToGlobalSetup);
|
16 | var pathToGlobalTeardown = './src/_testing/global-teardown.js';
|
17 | var hasGlobalTeardown = (0, _checkSetup.hasFile)(pathToGlobalTeardown);
|
18 |
|
19 | var dockerWaitPg = function dockerWaitPg(containerName) {
|
20 | return "until docker run --rm --link ".concat(containerName, ":pg --net sharyn-net postgres:latest pg_isready -U postgres -h pg; do sleep 1; done");
|
21 | };
|
22 |
|
23 | var binDir = null;
|
24 |
|
25 | var prefix = function prefix(command) {
|
26 | return "".concat(binDir || './node_modules/.bin/').concat(command);
|
27 | };
|
28 |
|
29 | var nodemon = prefix('nodemon -w src -i dist -x "babel-node src/_server/server.js"');
|
30 | var migrate = prefix("knex --knexfile ".concat(_shared.knexConfigPath || '', " --cwd . migrate:latest"));
|
31 | var webpackProd = prefix("webpack --mode=production --progress ".concat(pathToSharynWebpackConfig ? "--config ".concat(pathToSharynWebpackConfig) : ''));
|
32 | var webpackStats = prefix("webpack --mode=production --progress --json ".concat(pathToSharynWebpackConfig ? "--config ".concat(pathToSharynWebpackConfig) : '', " > webpack-stats.json"));
|
33 | var jestOptions = "".concat(hasGlobalSetup ? "--globalSetup ".concat(pathToGlobalSetup) : '', " ").concat(hasGlobalTeardown ? "--globalTeardown ".concat(pathToGlobalTeardown) : '');
|
34 | var nodeLocalProd = prefix('cross-env NODE_ENV=production ENV_TYPE=local-production node lib/_server/server.js');
|
35 | exports.nodeLocalProd = nodeLocalProd;
|
36 | var DOCKER_UP = 'docker-compose up -d';
|
37 | exports.DOCKER_UP = DOCKER_UP;
|
38 |
|
39 | var dockerDownTest = function dockerDownTest(id) {
|
40 | return "docker rm -f ".concat(id);
|
41 | };
|
42 |
|
43 | exports.dockerDownTest = dockerDownTest;
|
44 | var DOCKER_UP_TEST = 'docker-compose up -d db-test redis-test';
|
45 | exports.DOCKER_UP_TEST = DOCKER_UP_TEST;
|
46 | var DOCKER_WAIT_PG = dockerWaitPg('db');
|
47 | exports.DOCKER_WAIT_PG = DOCKER_WAIT_PG;
|
48 | var DOCKER_WAIT_PG_TEST = dockerWaitPg('db-test');
|
49 | exports.DOCKER_WAIT_PG_TEST = DOCKER_WAIT_PG_TEST;
|
50 | var babel = prefix('babel src -d lib');
|
51 | exports.babel = babel;
|
52 | var dbMigr = migrate;
|
53 | exports.dbMigr = dbMigr;
|
54 | var dbSeed = prefix("knex --knexfile ".concat(_shared.knexConfigPath || '', " --cwd . seed:run"));
|
55 | exports.dbSeed = dbSeed;
|
56 | var dbMigrTest = "".concat(prefix('cross-env NODE_ENV=test'), " ").concat(migrate);
|
57 | exports.dbMigrTest = dbMigrTest;
|
58 | var herokuLocalProd = prefix('cross-env NODE_ENV=production ENV_TYPE=local-production heroku local');
|
59 | exports.herokuLocalProd = herokuLocalProd;
|
60 | var lint = prefix('eslint src --fix --ext .js,.jsx');
|
61 | exports.lint = lint;
|
62 | var typecheck = prefix('flow');
|
63 | exports.typecheck = typecheck;
|
64 | var testUnit = prefix("jest --testMatch **/*.unit.test.js --testEnvironment node ".concat(jestOptions));
|
65 | exports.testUnit = testUnit;
|
66 | var testE2E = prefix("jest --preset jest-puppeteer --testMatch **/*.e2e.test.js --runInBand ".concat(jestOptions));
|
67 | exports.testE2E = testE2E;
|
68 | var rmBundle = prefix('rimraf dist/js/bundle.js');
|
69 |
|
70 | exports.rmBundle = rmBundle;
|
71 | var rmLibAndBundle = prefix('rimraf lib dist/js/bundle.js');
|
72 |
|
73 | exports.rmLibAndBundle = rmLibAndBundle;
|
74 | var clientWatch = prefix("webpack-dev-server --mode=development --progress --hot ".concat(pathToSharynWebpackConfig ? "--config ".concat(pathToSharynWebpackConfig) : ''));
|
75 | exports.clientWatch = clientWatch;
|
76 | var clientBuild = "".concat(prefix('cross-env NODE_ENV=production'), " ").concat(webpackProd);
|
77 | exports.clientBuild = clientBuild;
|
78 | var stats = "".concat(prefix('cross-env NODE_ENV=production'), " ").concat(webpackStats);
|
79 | exports.stats = stats;
|
80 | var serverWatch = nodemon;
|
81 | exports.serverWatch = serverWatch;
|
82 | var serverWatchSsrOnly = "".concat(prefix('cross-env SSR_ONLY=true'), " ").concat(nodemon);
|
83 | exports.serverWatchSsrOnly = serverWatchSsrOnly;
|
84 | var serverWatchNoSsr = "".concat(prefix('cross-env NO_SSR=true'), " ").concat(nodemon);
|
85 | exports.serverWatchNoSsr = serverWatchNoSsr; |
\ | No newline at end of file |