Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Aug 10, 2024
1 parent 91f38bf commit 0edd826
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions scripts/create-nx-sandbox-projects.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fs from 'fs';
import * as path from 'path';
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
import { dirname, join } from 'node:path';

import * as templates from '../code/lib/cli-storybook/src/sandbox-templates';

Expand Down Expand Up @@ -31,7 +31,7 @@ const projectJson = (name: string, framework: string, tags: string[]) => ({
});
Object.entries(allTemplates).forEach(([key, value]) => {
const p = key.replaceAll('/', '-');
const full = path.join(process.cwd(), '../code/sandbox', p, 'project.json');
const full = join(process.cwd(), '../code/sandbox', p, 'project.json');

console.log(full);
const framework = value.expected.framework.replace('@storybook/', '');
Expand All @@ -44,7 +44,7 @@ Object.entries(allTemplates).forEach(([key, value]) => {
];
ensureDirectoryExistence(full);
console.log(full);
fs.writeFileSync(
writeFileSync(
full,
'// auto-generated from scripts/create-nx-sandbox-projects.ts\n' +
JSON.stringify(projectJson(key, framework, tags), null, 2),
Expand All @@ -55,10 +55,10 @@ Object.entries(allTemplates).forEach(([key, value]) => {
});

function ensureDirectoryExistence(filePath: string): void {
const dirname = path.dirname(filePath);
if (fs.existsSync(dirname)) {
const dir = dirname(filePath);
if (existsSync(dir)) {
return;
}
ensureDirectoryExistence(dirname);
fs.mkdirSync(dirname);
ensureDirectoryExistence(dir);
mkdirSync(dir);
}
2 changes: 1 addition & 1 deletion scripts/release/__tests__/version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ describe('Version', () => {
{ spaces: 2 }
);
expect(execaCommand).toHaveBeenCalledWith('yarn install --mode=update-lockfile', {
cwd: path.join(CODE_DIR_PATH),
cwd: join(CODE_DIR_PATH),
cleanup: true,
stdio: undefined,
});
Expand Down

0 comments on commit 0edd826

Please sign in to comment.