@@ -44,8 +44,7 @@ function createIndexHtml(path, appName) {
4444 }
4545 }
4646 const filePath : string = `${ dir } /index.html` ;
47- const data : string = `
48- <!DOCTYPE html>
47+ const data : string = `<!DOCTYPE html>
4948<html>
5049 <head>
5150 <meta charset="UTF-8" />
@@ -67,8 +66,7 @@ function createIndexHtml(path, appName) {
6766}
6867export const createIndexTsx = ( path , appName ) => {
6968 const filePath = `${ path } /${ appName } /src/index.tsx` ;
70- const data = `
71- import React from 'react';
69+ const data = `import React from 'react';
7270import ReactDOM from 'react-dom';
7371import App from './components/App';
7472import './default.css';
@@ -84,16 +82,15 @@ ReactDOM.render(<App />, document.getElementById('root'));
8482} ;
8583export const createDefaultCSS = ( path , appName , components ) => {
8684 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+ ` ;
9794 components . forEach ( comp => {
9895 data += compToCSS ( comp ) ;
9996 } ) ;
@@ -117,8 +114,7 @@ export const createPackage = (path, appName, test) => {
117114 "@types/enzyme-adapter-react-16": "^1.0.6",
118115 "ts-jest": "^27.0.5",
119116 "enzyme-to-json": "^3.6.2"` ;
120- const data = `
121- {
117+ const data = `{
122118 "name": "reactype",
123119 "version": "1.0.0",
124120 "description": "",
@@ -186,8 +182,7 @@ export const createPackage = (path, appName, test) => {
186182} ;
187183export const createWebpack = ( path , appName ) => {
188184 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
191186var path = require('path');
192187module.exports = {
193188 entry: './src/index.tsx',
@@ -241,8 +236,7 @@ module.exports = {
241236} ;
242237export const createBabel = ( path , appName ) => {
243238 const filePath = `${ path } /${ appName } /.babelrc` ;
244- const data = `
245- {
239+ const data = `{
246240 "presets": ["@babel/env", "@babel/react", "@babel/typescript"]
247241}
248242` ;
@@ -256,21 +250,20 @@ export const createBabel = (path, appName) => {
256250} ;
257251export const createTsConfig = ( path , appName ) => {
258252 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+ }
274267` ;
275268 window . api . writeFile ( filePath , data , err => {
276269 if ( err ) {
@@ -282,8 +275,7 @@ export const createTsConfig = (path, appName) => {
282275} ;
283276export const createTsLint = ( path , appName ) => {
284277 const filePath = `${ path } /${ appName } /tslint.json` ;
285- const data = `
286- {
278+ const data = `{
287279 "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
288280 "tslint.autoFixOnSave": true,
289281 "linterOptions": {
@@ -312,8 +304,7 @@ export const createTsLint = (path, appName) => {
312304} ;
313305export const createServer = ( path , appName ) => {
314306 const filePath = `${ path } /${ appName } /server/server.js` ;
315- const data = `
316- const express = require('express');
307+ const data = `const express = require('express');
317308const path = require('path');
318309const app = express();
319310app.get('/testDev', (req, res) => {
@@ -349,23 +340,22 @@ export const createContext = (path, appName) => {
349340 cached [ ele . key ] = ele . value ;
350341 }
351342 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();
355345
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+ }
361351
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+ ` ;
369359 window . api . writeFileSync ( filePath , data , err => {
370360 if ( err ) {
371361 console . log ( 'server file error:' , err . message ) ;
0 commit comments