Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix create-module and promote-module #660

Merged
merged 3 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion utils/create-component/createComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ inquirer
const react = targets.includes('React');
const componentPath = path.join(cwd, unstable ? `modules/_labs/${name}` : `modules/${name}`);

console.log(name, unstable, targets, componentPath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to keep this console.log?

NicholasBoll marked this conversation as resolved.
Show resolved Hide resolved

NicholasBoll marked this conversation as resolved.
Show resolved Hide resolved
if (!fs.existsSync(componentPath)) {
mkdirp(componentPath);
mkdirp.sync(componentPath);
}

css && createModule(componentPath, 'css', createCssModule, answers);
Expand Down
2 changes: 1 addition & 1 deletion utils/create-component/createCssModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (modulePath, name, description, unstable) => {

console.log('\nCreating '.underline + `${moduleName}\n`.blue.underline);

mkdirp(modulePath);
mkdirp.sync(modulePath);

const titleCaseName = getTitleCaseName(name);
const storyPath = unstable ? `Labs/CSS/${titleCaseName}` : `CSS/${titleCaseName}`;
Expand Down
2 changes: 1 addition & 1 deletion utils/create-component/createReactModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = (modulePath, name, description, unstable) => {

console.log('\nCreating ' + `${moduleName}\n`.blue.underline);

mkdirp(modulePath);
mkdirp.sync(modulePath);

const pascalCaseName = getPascalCaseName(name);
const titleCaseName = getTitleCaseName(name);
Expand Down
4 changes: 1 addition & 3 deletions utils/create-component/writeModuleFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ module.exports = (files, modulePath) => {

console.log('Creating ' + `.${filePath.replace(cwd, '')}`.cyan);

mkdirp(getDirName(filePath), function(err) {
if (err) return cb(err);

mkdirp(getDirName(filePath)).then(() => {
fs.writeFileSync(filePath, file.contents);
});
});
Expand Down
2 changes: 1 addition & 1 deletion utils/css-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const postcssConfig = require('../.postcssrc.js');
const nodeModules = path.resolve(__dirname, '../node_modules');

// Make the build directory if it doesn't exist
mkdirp(outputDir);
mkdirp.sync(outputDir);

const postcssPlugins = Object.keys(postcssConfig.plugins).map(plugin => {
const name = plugin;
Expand Down
2 changes: 1 addition & 1 deletion utils/js-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const outputDir = path.join(cwd, 'dist');
const outputFile = path.join(outputDir, path.basename(sourceFile));

// Make the build directory if it doesn't exist
mkdirp(outputDir);
mkdirp.sync(outputDir);

// Standard bundle
const inputOptions = {
Expand Down
2 changes: 1 addition & 1 deletion utils/promote-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ inquirer.prompt(questions).then(answers => {
const destPath = path.join(cwd, `modules/${component}`);

if (!fs.existsSync(destPath)) {
mkdirp(destPath);
mkdirp.sync(destPath);
}

if (fs.existsSync(`${destPath}/${target}`)) {
Expand Down