@@ -44,8 +44,7 @@ function createIndexHtml(path, appName) {
44
44
}
45
45
}
46
46
const filePath : string = `${ dir } /index.html` ;
47
- const data : string = `
48
- <!DOCTYPE html>
47
+ const data : string = `<!DOCTYPE html>
49
48
<html>
50
49
<head>
51
50
<meta charset="UTF-8" />
@@ -67,8 +66,7 @@ function createIndexHtml(path, appName) {
67
66
}
68
67
export const createIndexTsx = ( path , appName ) => {
69
68
const filePath = `${ path } /${ appName } /src/index.tsx` ;
70
- const data = `
71
- import React from 'react';
69
+ const data = `import React from 'react';
72
70
import ReactDOM from 'react-dom';
73
71
import App from './components/App';
74
72
import './default.css';
@@ -84,16 +82,15 @@ ReactDOM.render(<App />, document.getElementById('root'));
84
82
} ;
85
83
export const createDefaultCSS = ( path , appName , components ) => {
86
84
const filePath = `${ path } /${ appName } /src/default.css` ;
87
- let data = `
88
- #root div {
89
- box-sizing: border-box;
90
- width: 100%;
91
- border: 1px solid rgba(0,0,0,0.25);
92
- padding: 12px;
93
- text-align: center;
94
- font-family: Helvetica, Arial;
95
- }
96
- ` ;
85
+ let data = `#root div {
86
+ box-sizing: border-box;
87
+ width: 100%;
88
+ border: 1px solid rgba(0,0,0,0.25);
89
+ padding: 12px;
90
+ text-align: center;
91
+ font-family: Helvetica, Arial;
92
+ }
93
+ ` ;
97
94
components . forEach ( comp => {
98
95
data += compToCSS ( comp ) ;
99
96
} ) ;
@@ -117,8 +114,7 @@ export const createPackage = (path, appName, test) => {
117
114
"@types/enzyme-adapter-react-16": "^1.0.6",
118
115
"ts-jest": "^27.0.5",
119
116
"enzyme-to-json": "^3.6.2"` ;
120
- const data = `
121
- {
117
+ const data = `{
122
118
"name": "reactype",
123
119
"version": "1.0.0",
124
120
"description": "",
@@ -186,8 +182,7 @@ export const createPackage = (path, appName, test) => {
186
182
} ;
187
183
export const createWebpack = ( path , appName ) => {
188
184
const filePath = `${ path } /${ appName } /webpack.config.js` ;
189
- const data = `
190
- var status = process.env.NODE_ENV; //taken from script so we don't have to flip mode when using development/production
185
+ const data = `var status = process.env.NODE_ENV; //taken from script so we don't have to flip mode when using development/production
191
186
var path = require('path');
192
187
module.exports = {
193
188
entry: './src/index.tsx',
@@ -241,8 +236,7 @@ module.exports = {
241
236
} ;
242
237
export const createBabel = ( path , appName ) => {
243
238
const filePath = `${ path } /${ appName } /.babelrc` ;
244
- const data = `
245
- {
239
+ const data = `{
246
240
"presets": ["@babel/env", "@babel/react", "@babel/typescript"]
247
241
}
248
242
` ;
@@ -256,21 +250,20 @@ export const createBabel = (path, appName) => {
256
250
} ;
257
251
export const createTsConfig = ( path , appName ) => {
258
252
const filePath = `${ path } /${ appName } /tsconfig.json` ;
259
- const data = `
260
- {
261
- "compilerOptions": {
262
- "outDir": "./dist/",
263
- "sourceMap": true,
264
- "noImplicitAny": true,
265
- "module": "commonjs",
266
- "target": "es6",
267
- "jsx": "react",
268
- "lib": ["dom", "es6"],
269
- "moduleResolution": "node",
270
- "esModuleInterop": true
271
- },
272
- "include": ["./src/**/*"]
273
- }
253
+ const data = `{
254
+ "compilerOptions": {
255
+ "outDir": "./dist/",
256
+ "sourceMap": true,
257
+ "noImplicitAny": true,
258
+ "module": "commonjs",
259
+ "target": "es6",
260
+ "jsx": "react",
261
+ "lib": ["dom", "es6"],
262
+ "moduleResolution": "node",
263
+ "esModuleInterop": true
264
+ },
265
+ "include": ["./src/**/*"]
266
+ }
274
267
` ;
275
268
window . api . writeFile ( filePath , data , err => {
276
269
if ( err ) {
@@ -282,8 +275,7 @@ export const createTsConfig = (path, appName) => {
282
275
} ;
283
276
export const createTsLint = ( path , appName ) => {
284
277
const filePath = `${ path } /${ appName } /tslint.json` ;
285
- const data = `
286
- {
278
+ const data = `{
287
279
"extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
288
280
"tslint.autoFixOnSave": true,
289
281
"linterOptions": {
@@ -312,8 +304,7 @@ export const createTsLint = (path, appName) => {
312
304
} ;
313
305
export const createServer = ( path , appName ) => {
314
306
const filePath = `${ path } /${ appName } /server/server.js` ;
315
- const data = `
316
- const express = require('express');
307
+ const data = `const express = require('express');
317
308
const path = require('path');
318
309
const app = express();
319
310
app.get('/testDev', (req, res) => {
@@ -349,23 +340,22 @@ export const createContext = (path, appName) => {
349
340
cached [ ele . key ] = ele . value ;
350
341
}
351
342
const filePath = `${ path } /${ appName } /src/contexts/${ context . name } .js` ;
352
- const data = `
353
- import {createContext, useState} from 'react'
354
- export const ${ context . name } = createContext();
343
+ const data = `import {createContext, useState} from 'react'
344
+ export const ${ context . name } = createContext();
355
345
356
- const ${ context . name } Provider = (props) => {
357
- const [${ context . name } State] = useState(
358
- ${ JSON . stringify ( cached ) }
359
- )
360
- }
346
+ const ${ context . name } Provider = (props) => {
347
+ const [${ context . name } State] = useState(
348
+ ${ JSON . stringify ( cached ) }
349
+ )
350
+ }
361
351
362
- return (
363
- <${ context . name } .Provider value={${ context . name } State}>
364
- {props.children}
365
- </${ context . name } .Provider>
366
- );
367
- export default ${ context . name } Provider
368
- `;
352
+ return (
353
+ <${ context . name } .Provider value={${ context . name } State}>
354
+ {props.children}
355
+ </${ context . name } .Provider>
356
+ );
357
+ export default ${ context . name } Provider
358
+ ` ;
369
359
window . api . writeFileSync ( filePath , data , err => {
370
360
if ( err ) {
371
361
console . log ( 'server file error:' , err . message ) ;
0 commit comments