Skip to content

Commit

Permalink
Got linking going
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Jul 29, 2022
1 parent 1bb7c83 commit 0b8b190
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion scripts/example.ts
Expand Up @@ -9,6 +9,7 @@ import { exec } from '../code/lib/cli/src/repro-generators/scripts';
const frameworks = ['react', 'angular'];
const addons = ['a11y', 'storysource'];
const examplesDir = path.resolve(__dirname, '../examples');
const codeDir = path.resolve(__dirname, '../code');

async function getOptions() {
return getOptionsOrPrompt('yarn example', {
Expand Down Expand Up @@ -75,6 +76,13 @@ const steps = {
hasArgument: true,
options: {},
},
link: {
command: 'link',
description: 'Linking packages',
icon: '🔗',
hasArgument: true,
options: { local: {} },
},
build: {
command: 'build',
description: 'Building example',
Expand All @@ -92,7 +100,7 @@ const steps = {
async function main() {
const optionValues = await getOptions();

const { framework, forceDelete, forceReuse, dryRun } = optionValues;
const { framework, forceDelete, forceReuse, link, dryRun } = optionValues;
const cwd = path.join(examplesDir, framework as string);

const exists = await pathExists(cwd);
Expand Down Expand Up @@ -132,6 +140,15 @@ async function main() {
}

// TODO copy stories

if (link) {
await executeCLIStep(steps.link, {
argument: cwd,
cwd: codeDir,
dryRun,
optionValues: { local: true },
});
}
}

const { start } = optionValues;
Expand Down

0 comments on commit 0b8b190

Please sign in to comment.