Skip to content

Commit

Permalink
chore: remove unnecessary symlink step
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinschaul committed Jun 25, 2024
1 parent 307c130 commit 2a869e1
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 20 deletions.
3 changes: 1 addition & 2 deletions bin/buildStorybook.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from "node:path";
import { spawn } from "node:child_process";
import { copyJumpStartTools, spawnWithIO, symlinkStarters } from "./util";
import { copyJumpStartTools, spawnWithIO } from "./util";
import updateStories from "../src/util/updateStories";
import updateScreenshots from "../src/util/updateScreenshots";
const root = join(import.meta.dirname, "../");
Expand Down Expand Up @@ -40,7 +40,6 @@ const buildStorybook = async (opts: BuildStorybookOpts) => {
console.log(`Using startersDir: ${opts.startersDir}`);

const toolsRoot = copyJumpStartTools(root, opts.startersDir);
symlinkStarters(toolsRoot, opts.startersDir);

// Rewrite stories now
console.log("Updating stories");
Expand Down
3 changes: 1 addition & 2 deletions bin/storybook.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from "node:path";
import { watch } from "chokidar";
import { copyJumpStartTools, spawnWithIO, symlinkStarters } from "./util";
import { copyJumpStartTools, spawnWithIO } from "./util";
import updateStories from "../src/util/updateStories";
import { Command } from "commander";
import updateScreenshots from "../src/util/updateScreenshots";
Expand All @@ -16,7 +16,6 @@ const storybook = async (opts: StorybookOpts, command: Command) => {
console.log(`Using startersDir: ${opts.startersDir}`);

const toolsRoot = copyJumpStartTools(root, opts.startersDir);
symlinkStarters(toolsRoot, opts.startersDir);

// Rewrite stories now and any time a change is made to the starters
console.log("Updating stories");
Expand Down
5 changes: 0 additions & 5 deletions bin/updateReadme.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { join } from "node:path";
import { symlinkStarters } from "./util";
import updateReadme from "../src/util/updateReadme";
const root = join(import.meta.dirname, "../");

type UpdateReadmeOpts = {
startersDir: string;
Expand All @@ -10,8 +7,6 @@ type UpdateReadmeOpts = {
const task = async (opts: UpdateReadmeOpts) => {
console.log(`Using startersDir: ${opts.startersDir}`);

symlinkStarters(root, opts.startersDir);

updateReadme(opts.startersDir);
console.log(`Readme updated`)
};
Expand Down
12 changes: 1 addition & 11 deletions bin/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from "node:path";
import { SpawnOptions, spawn } from "node:child_process";
import { cpSync, rmSync, symlinkSync, unlinkSync } from "node:fs";
import { cpSync, rmSync } from "node:fs";

export function getToolsRoot(startersDir: string) {
return join(startersDir, "./.build/jump-start-tools");
Expand All @@ -15,16 +15,6 @@ export function copyJumpStartTools(root: string, startersDir: string) {
cpSync(root, toolsRoot, { recursive: true });
return toolsRoot;
}
export function symlinkStarters(root: string, startersDir: string) {
// Add a symlink to where the starters exist (But
// first, remove the symlink if it already exists)
const symlinkPath = join(root, "./src/starters");
console.log(`Symlinking ${startersDir} to ${symlinkPath}`);
try {
unlinkSync(symlinkPath);
} catch (e: any) {}
symlinkSync(startersDir, symlinkPath);
}

export function spawnWithIO(command: string, args: string[], options: SpawnOptions) {
console.log("Starting server");
Expand Down

0 comments on commit 2a869e1

Please sign in to comment.