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

fix: Fix create component scripts #929

Merged
merged 2 commits into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Copy link
Member Author

Choose a reason for hiding this comment

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

Adjust path to storybook utils based on whether or not this is a Labs module. Labs modules sit one level deeper in the folder structure since they're placed in the _labs folder alongside the non-Labs modules.

import ${pascalCaseName} from '../index';

export default withSnapshotsEnabled({
Expand Down