UNPKG

sharyn

Version:

Combines all the other packages under one.

85 lines (73 loc) 4.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); 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; var _checkSetup = require("@sharyn/check-setup"); var _shared = require("./shared"); // flow-disable-next-line var pathToSharynWebpackConfig = (0, _checkSetup.pathCascade)('node_modules/@sharyn/webpack-config', 'node_modules/sharyn/webpack-config'); var pathToGlobalSetup = './src/_testing/global-setup.js'; var hasGlobalSetup = (0, _checkSetup.hasFile)(pathToGlobalSetup); var pathToGlobalTeardown = './src/_testing/global-teardown.js'; var hasGlobalTeardown = (0, _checkSetup.hasFile)(pathToGlobalTeardown); var dockerWaitPg = function dockerWaitPg(containerName) { return "until docker run --rm --link ".concat(containerName, ":pg --net sharyn-net postgres:latest pg_isready -U postgres -h pg; do sleep 1; done"); }; var binDir = null; var prefix = function prefix(command) { return "".concat(binDir || './node_modules/.bin/').concat(command); }; var nodemon = prefix('nodemon -w src -i dist -x "babel-node src/_server/server.js"'); var migrate = prefix("knex --knexfile ".concat(_shared.knexConfigPath || '', " --cwd . migrate:latest")); var webpackProd = prefix("webpack --mode=production --progress ".concat(pathToSharynWebpackConfig ? "--config ".concat(pathToSharynWebpackConfig) : '')); var webpackStats = prefix("webpack --mode=production --progress --json ".concat(pathToSharynWebpackConfig ? "--config ".concat(pathToSharynWebpackConfig) : '', " > webpack-stats.json")); var jestOptions = "".concat(hasGlobalSetup ? "--globalSetup ".concat(pathToGlobalSetup) : '', " ").concat(hasGlobalTeardown ? "--globalTeardown ".concat(pathToGlobalTeardown) : ''); var nodeLocalProd = prefix('cross-env NODE_ENV=production ENV_TYPE=local-production node lib/_server/server.js'); exports.nodeLocalProd = nodeLocalProd; var DOCKER_UP = 'docker-compose up -d db redis'; exports.DOCKER_UP = DOCKER_UP; var dockerDownTest = function dockerDownTest(id) { return "docker rm -f ".concat(id); }; exports.dockerDownTest = dockerDownTest; var DOCKER_UP_TEST = 'docker-compose up -d db-test redis-test'; exports.DOCKER_UP_TEST = DOCKER_UP_TEST; var DOCKER_WAIT_PG = dockerWaitPg('db'); exports.DOCKER_WAIT_PG = DOCKER_WAIT_PG; var DOCKER_WAIT_PG_TEST = dockerWaitPg('db-test'); exports.DOCKER_WAIT_PG_TEST = DOCKER_WAIT_PG_TEST; var babel = prefix('babel src -d lib --ignore **/*.test.js'); exports.babel = babel; var dbMigr = migrate; exports.dbMigr = dbMigr; var dbSeed = prefix("knex --knexfile ".concat(_shared.knexConfigPath || '', " --cwd . seed:run")); exports.dbSeed = dbSeed; var dbMigrTest = "".concat(prefix('cross-env NODE_ENV=test'), " ").concat(migrate); exports.dbMigrTest = dbMigrTest; var herokuLocalProd = prefix('cross-env NODE_ENV=production ENV_TYPE=local-production heroku local'); exports.herokuLocalProd = herokuLocalProd; var lint = prefix('eslint src --fix --ext .js,.jsx'); exports.lint = lint; var typecheck = prefix('flow'); exports.typecheck = typecheck; var testUnit = prefix("jest .unit.test.js --testEnvironment node ".concat(jestOptions)); exports.testUnit = testUnit; var testE2E = prefix("jest .e2e.test.js --preset jest-puppeteer --runInBand ".concat(jestOptions)); exports.testE2E = testE2E; var rmBundle = prefix('rimraf dist/js/bundle.js'); // Add .cache when switching back to Parcel exports.rmBundle = rmBundle; var rmLibAndBundle = prefix('rimraf lib dist/js/bundle.js'); // Add .cache when switching back to Parcel exports.rmLibAndBundle = rmLibAndBundle; var clientWatch = prefix("webpack-dev-server --mode=development --progress --hot ".concat(pathToSharynWebpackConfig ? "--config ".concat(pathToSharynWebpackConfig) : '')); exports.clientWatch = clientWatch; var clientBuild = "".concat(prefix('cross-env NODE_ENV=production'), " ").concat(webpackProd); exports.clientBuild = clientBuild; var stats = "".concat(prefix('cross-env NODE_ENV=production'), " ").concat(webpackStats); exports.stats = stats; var serverWatch = nodemon; exports.serverWatch = serverWatch; var serverWatchSsrOnly = "".concat(prefix('cross-env SSR_ONLY=true'), " ").concat(nodemon); exports.serverWatchSsrOnly = serverWatchSsrOnly; var serverWatchNoSsr = "".concat(prefix('cross-env NO_SSR=true'), " ").concat(nodemon); exports.serverWatchNoSsr = serverWatchNoSsr;