Skip to content

Commit 37fee85

Browse files
authored
Merge pull request #233 from mgusmano/ext-react-6.7.x
theme
2 parents d1789bb + ab21a14 commit 37fee85

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

packages/ext-react/bin/ext-react.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,9 @@ const generateTheme = config => {
100100
'--framework', 'ext',
101101
'--name', config.name
102102
], { cwd: path.join('.', 'ext-react'), silent: true });
103-
104103
proc.once('exit', code => code > 0 ? reject(`Generating package failed with code: ${code}`) : resolve());
105104
proc.stdout.pipe(process.stdout);
106105
proc.stderr.pipe(process.stderr);
107-
108106
return proc;
109107
}).then(updatePackageJson.bind(null, config));
110108
}
@@ -129,15 +127,12 @@ const updatePackageJson = config => {
129127
return new Promise((resolve, reject) => {
130128
fs.writeFile(packageJsonPath, cjson.stringify(data, null, 4), err => {
131129
if(err) return reject(`Could not write package.json for theme named: ${config.name}`);
132-
133130
return resolve();
134131
});
135132
});
136133
});
137134
}
138135

139-
140-
141136
/**
142137
* Applies a theme based on `name` property in config object to current app by writing to a .sencharc file.
143138
*/
@@ -185,15 +180,15 @@ switch(args._.join(' ')) {
185180
.then(generateTheme.bind(null, args))
186181
.then((args.apply ? applyTheme.bind(null, args) : Promise.resolve([])))
187182
.then(() => {
188-
//update app.json with new theme name
183+
console.log(`Theme created at: ext-react/packages/${args.name}`);
184+
//this is done too early
189185
const appJsonPath = path.join('.', 'build', 'ext-react', 'app.json');
190186
if (fs.existsSync(appJsonPath)) {
191187
var data = fs.readFileSync(appJsonPath, 'utf-8')
192188
var appJson = cjson.parse(data)
193189
appJson.theme = args.name
194-
fs.writeFileSync(appJsonPath, cjson.stringify(appJson, null, 2))
190+
fs.writeFileSync(appJsonPath, JSON.stringify(appJson, null, 4))
195191
}
196-
console.log(`Theme created at: ext-react/packages/${args.name}`);
197192
})
198193
.catch(error => {
199194
console.error('Error encountered.', error);
@@ -204,7 +199,6 @@ switch(args._.join(' ')) {
204199
console.error('Missing required argument: --name');
205200
return printUsage();
206201
}
207-
208202
return applyTheme(args);
209203
}
210204
default: {

0 commit comments

Comments
 (0)