From 9be47f85274093ee22cdf4467908c16c02135cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20van=20Br=C3=BCgge?= Date: Mon, 10 Apr 2017 13:36:34 +0200 Subject: [PATCH] Remove template/config folder structure --- .../cycle-scripts/configs/{flavor.js => dependencies.js} | 4 ++++ packages/cycle-scripts/scripts/init/setup.js | 8 ++++---- .../config/{javascript/flavor.js => javascript.js} | 9 +-------- .../config/{typescript/flavor.js => typescript.js} | 9 +-------- 4 files changed, 10 insertions(+), 20 deletions(-) rename packages/cycle-scripts/configs/{flavor.js => dependencies.js} (83%) rename packages/cycle-scripts/template/config/{javascript/flavor.js => javascript.js} (80%) rename packages/cycle-scripts/template/config/{typescript/flavor.js => typescript.js} (87%) diff --git a/packages/cycle-scripts/configs/flavor.js b/packages/cycle-scripts/configs/dependencies.js similarity index 83% rename from packages/cycle-scripts/configs/flavor.js rename to packages/cycle-scripts/configs/dependencies.js index c3c6a57..85790ad 100644 --- a/packages/cycle-scripts/configs/flavor.js +++ b/packages/cycle-scripts/configs/dependencies.js @@ -2,6 +2,10 @@ module.exports = { basics: [ '@cycle/dom@17.1.0' ], + language: { + javascript: [], + typescript: [] + }, streamLib: { xstream: [ '@cycle/run@3.1.0', diff --git a/packages/cycle-scripts/scripts/init/setup.js b/packages/cycle-scripts/scripts/init/setup.js index 901a991..d7402f6 100644 --- a/packages/cycle-scripts/scripts/init/setup.js +++ b/packages/cycle-scripts/scripts/init/setup.js @@ -5,7 +5,7 @@ const path = require('path') const chalk = require('chalk') const spawn = require('cross-spawn') -const dependencies = require('../../configs/flavor'); +const dependencies = require('../../config/flavor') const success = require('./success') module.exports = function setup (appPath, appName, options) { @@ -16,8 +16,7 @@ module.exports = function setup (appPath, appName, options) { // STEP #1 - Create boilerplate files const flavorPath = path.join(appPath, 'node_modules', 'cycle-scripts') - const flavorConfig = require(path.join(flavorPath, 'template/config', language, 'flavor.js')) - const templateStrings = flavorConfig.replacements + const templateStrings = require(path.join(flavorPath, 'template/config', language, 'flavor.js')) const templatePath = path.join(flavorPath, 'template/src', language) // Create ./public directory fs.ensureDirSync(path.join(appPath, 'public')) @@ -72,9 +71,10 @@ module.exports = function setup (appPath, appName, options) { // All the dependency locks and configurations can be found in /configs/flavor.js const basicDependencies = dependencies.basics const streamLibDependencies = dependencies.streamLib[streamLib] + const languageDependencies = dependencies.language[language] const dependenciesToInstall = basicDependencies .concat(streamLibDependencies) - .concat(flavorConfig.dependencies) + .concat(languageDependencies) const dependecyList = dependenciesToInstall .slice(0, (dependenciesToInstall.length - 1)) .join(', ') diff --git a/packages/cycle-scripts/template/config/javascript/flavor.js b/packages/cycle-scripts/template/config/javascript.js similarity index 80% rename from packages/cycle-scripts/template/config/javascript/flavor.js rename to packages/cycle-scripts/template/config/javascript.js index 24d5f52..59aa083 100644 --- a/packages/cycle-scripts/template/config/javascript/flavor.js +++ b/packages/cycle-scripts/template/config/javascript.js @@ -1,6 +1,4 @@ -const dependencies = [] - -const replacements = { +module.exports = { xstream: { run: '@cycle/run', import: 'import xs from \'xstream\'', @@ -17,8 +15,3 @@ const replacements = { stream: 'most' } } - -module.exports = { - dependencies, - replacements -} diff --git a/packages/cycle-scripts/template/config/typescript/flavor.js b/packages/cycle-scripts/template/config/typescript.js similarity index 87% rename from packages/cycle-scripts/template/config/typescript/flavor.js rename to packages/cycle-scripts/template/config/typescript.js index 97e0635..cf5a995 100644 --- a/packages/cycle-scripts/template/config/typescript/flavor.js +++ b/packages/cycle-scripts/template/config/typescript.js @@ -1,6 +1,4 @@ -const dependencies = [] - - const replacements = { +module.exports = { xstream: { run: '@cycle/run', import: 'import xs from \'xstream\'', @@ -23,8 +21,3 @@ const dependencies = [] streamType: 'Stream' } } - -module.exports = { - dependencies, - replacements -}