Skip to content

Commit

Permalink
fix: Fix create component scripts (Workday#929)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesfan committed Dec 10, 2020
1 parent b3ee342 commit 42b9235
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions utils/create-component/createComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const inquirer = require('inquirer');
const exec = require('child_process');
const {exec} = require('child_process');

require('colors');

Expand Down Expand Up @@ -95,7 +95,7 @@ const createModule = (componentPath, target, moduleGenerator, answers, unstable)
const modulePath = path.join(componentPath, target);

if (fs.existsSync(modulePath)) {
const moduleName = `Module @workday/canvas-kit-${unstable ? 'labs-' : ''}${target}-${name}`;
const moduleName = `@workday/canvas-kit-${unstable ? 'labs-' : ''}${target}-${name}`;
console.log(`\nModule ${moduleName} already exists. Skipping.`.yellow);
} else {
moduleGenerator(modulePath, name, description, unstable, publicModule, category);
Expand Down
3 changes: 2 additions & 1 deletion utils/create-component/createCssModule.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path');
const mkdirp = require('mkdirp');
const exec = require('child_process');
const {exec} = require('child_process');

require('colors');

const writeModuleFiles = require('./writeModuleFiles');
Expand Down
5 changes: 3 additions & 2 deletions utils/create-component/createReactModule.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const mkdirp = require('mkdirp');
const exec = require('child_process');
const {exec} = require('child_process');

require('colors');

const writeModuleFiles = require('./writeModuleFiles');
Expand Down Expand Up @@ -49,7 +50,7 @@ module.exports = (modulePath, name, description, unstable, public, category) =>
},
testingStories: {
path: 'stories/stories_VisualTesting.tsx',
contents: testingStories(testingStoryPath, pascalCaseName, rootPath),
contents: testingStories(testingStoryPath, pascalCaseName, rootPath, unstable),
},
ssr: {
path: 'spec/SSR.spec.tsx',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// React stories template

module.exports = (storyPath, pascalCaseName, rootPath) => `
module.exports = (storyPath, pascalCaseName, rootPath, unstable) => `
/// <reference path="${rootPath}/../typings.d.ts" />
/** @jsx jsx */
import {jsx} from '@emotion/core';
import {StaticStates} from '@workday/canvas-kit-labs-react-core';
import {ComponentStatesTable, permutateProps, withSnapshotsEnabled} from '../../../../utils/storybook';
import {ComponentStatesTable, permutateProps, withSnapshotsEnabled} from '../../../../${unstable ? '../' : ''}utils/storybook';
import ${pascalCaseName} from '../index';
export default withSnapshotsEnabled({
Expand Down

0 comments on commit 42b9235

Please sign in to comment.