Skip to content

Commit 6d9ce48

Browse files
author
Nick Balestra
committed
inquirer wip
1 parent 25ec240 commit 6d9ce48

File tree

8 files changed

+31
-11
lines changed

8 files changed

+31
-11
lines changed

packages/create-cycle-app/src/initQuestions.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ const initQuestions = [
77
type: 'list',
88
name: 'language',
99
default: 0,
10-
choices: ['JavaScript', 'TypeScript'],
10+
choices: [
11+
{
12+
name: 'JavaScript',
13+
value: 'javascript'
14+
},
15+
{
16+
name: 'TypeScript',
17+
value: 'typescript'
18+
}
19+
],
1120
message: 'Which language do you want to use to write your cycle app?'
1221
},
1322
{

packages/create-cycle-app/test/unit/initQuestions.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('initQuedstion module', () => {
1212
})
1313
test('should prompt for question if no custom flavor is provided', () => {
1414
const callback = jest.fn()
15-
const answer = {language: 'JavaScript', streamLib: 'xstream'}
15+
const answer = {language: 'javascript', streamLib: 'xstream'}
1616
inquirer.prompt.mockReturnValue({
1717
then: jest.fn(answers => callback(answer))
1818
})

packages/cycle-scripts/configs/webpack.config.dev.js renamed to packages/cycle-scripts/configs/javascript/webpack.config.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = {
2525
// of CSS changes), or refresh the page (in case of JS changes). When you
2626
// make a syntax error, this client will display a syntax error overlay.
2727
// Note: instead of the default WebpackDevServer client, we use a custom one
28-
// to bring better experience for Create React App users. You can replace
28+
// to bring better experience from Create React App users. You can replace
2929
// the line below with these two lines if you prefer the stock client:
3030
// require.resolve('webpack-dev-server/client') + '?/',
3131
// require.resolve('webpack/hot/dev-server'),

packages/cycle-scripts/configs/webpack.config.prod.js renamed to packages/cycle-scripts/configs/javascript/webpack.config.prod.js

File renamed without changes.

packages/cycle-scripts/scripts/build.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ process.env.NODE_ENV = 'production'
3737
const fs = require('fs-extra')
3838
const chalk = require('chalk')
3939
const webpack = require('webpack')
40-
const config = require('../configs/webpack.config.prod')
4140
const path = require('path')
4241

4342
const buildPath = path.join(process.cwd(), 'build')
4443
const publicPath = path.join(process.cwd(), 'public')
44+
const ccaConfig = require(path.join(process.cwd(), 'package.json'))['create-cycle-app']
45+
const config = require(path.join('../configs/', ccaConfig.language, 'webpack.config.dev'))
4546

4647
// Remove all content but keep the directory so that
4748
// if you're in it, you don't end up in Trash

packages/cycle-scripts/scripts/init.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ function setup (appPath, appName, verbose, originalDirectory, options) {
124124
'eject': 'cycle-scripts eject'
125125
}
126126

127+
appPackage['create-cycle-app'] = options
128+
127129
fs.writeFileSync(
128130
appPackageJson,
129131
JSON.stringify(appPackage, null, 2)
@@ -152,10 +154,7 @@ function setup (appPath, appName, verbose, originalDirectory, options) {
152154

153155
fs.copySync(path.join(ownPath, 'template/src', language), path.join(appPath, 'src'))
154156

155-
// for each file in template/src load them, replace and write them
156-
157-
// for each library
158-
157+
// TODO
159158
// patchGitignore(appPath)
160159

161160
const dependecyList = depsToInstall
@@ -189,5 +188,5 @@ module.exports = function init (appPath, appName, verbose, originalDirectory, op
189188
if (options) {
190189
return setup(appPath, appName, verbose, originalDirectory, options)
191190
}
192-
return initQuestions(anwers => setup(appPath, appName, verbose, originalDirectory, anwers))
191+
return initQuestions(answers => setup(appPath, appName, verbose, originalDirectory, answers))
193192
}

packages/cycle-scripts/scripts/initQuestions.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ const initQuestions = [
77
type: 'list',
88
name: 'language',
99
default: 0,
10-
choices: ['JavaScript', 'TypeScript'],
10+
choices: [
11+
{
12+
name: 'JavaScript',
13+
value: 'javascript'
14+
},
15+
{
16+
name: 'TypeScript',
17+
value: 'typescript'
18+
}
19+
],
1120
message: 'Which language do you want to use to write your cycle app?'
1221
},
1322
{

packages/cycle-scripts/scripts/start.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@
3434

3535
const WebpackDevServer = require('webpack-dev-server')
3636
const chalk = require('chalk')
37+
const path = require('path')
3738

38-
const config = require('../configs/webpack.config.dev')
3939
const devServerConfig = require('../configs/webpackDevServer.config')
4040
const createWebpackCompiler = require('./utils/createWebpackCompiler')
4141
const openBrowser = require('react-dev-utils/openBrowser')
42+
const ccaConfig = require(path.join(process.cwd(), 'package.json'))['create-cycle-app']
4243

44+
const config = require(path.join('../configs/', ccaConfig.language, 'webpack.config.dev'))
4345
process.env.NODE_ENV = 'development'
4446

4547
const cli = 'npm'

0 commit comments

Comments
 (0)