Skip to content

Commit

Permalink
Merge branch 'next' into improve-notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld authored Apr 3, 2024
2 parents 983e7a7 + fbd2aaf commit 63254fd
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 43 deletions.
4 changes: 2 additions & 2 deletions code/frameworks/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@
"loader-utils": "^3.2.1",
"node-polyfill-webpack-plugin": "^2.0.1",
"pnp-webpack-plugin": "^1.7.0",
"postcss": "^8.4.21",
"postcss-loader": "^7.0.2",
"postcss": "^8.4.38",
"postcss-loader": "^8.1.1",
"react-refresh": "^0.14.0",
"resolve-url-loader": "^5.0.0",
"sass-loader": "^12.4.0",
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ command('migrate [migration]')
.option('-l --list', 'List available migrations')
.option('-g --glob <glob>', 'Glob for files upon which to apply the migration', '**/*.js')
.option('-p --parser <babel | babylon | flow | ts | tsx>', 'jscodeshift parser')
.option('-c, --config-dir <dir-name>', 'Directory where to load Storybook configurations from')
.option(
'-n --dry-run',
'Dry run: verify the migration exists and show the files to which it will be applied'
Expand All @@ -142,7 +143,6 @@ command('migrate [migration]')
list,
rename,
parser,
logger: consoleLogger,
}).catch((err) => {
logger.error(err);
process.exit(1);
Expand Down
29 changes: 24 additions & 5 deletions code/lib/cli/src/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,40 @@ import { getStorybookVersionSpecifier } from './helpers';

const logger = console;

export async function migrate(migration: any, { glob, dryRun, list, rename, parser }: any) {
type CLIOptions = {
glob: string;
configDir?: string;
dryRun?: boolean;
list?: string[];
/**
* Rename suffix of matching files after codemod has been applied, e.g. ".js:.ts"
*/
rename?: string;
/**
* jscodeshift parser
*/
parser?: 'babel' | 'babylon' | 'flow' | 'ts' | 'tsx';
};

export async function migrate(
migration: any,
{ glob, dryRun, list, rename, parser, configDir: userSpecifiedConfigDir }: CLIOptions
) {
if (list) {
listCodemods().forEach((key: any) => logger.log(key));
} else if (migration) {
if (migration === 'mdx-to-csf' && !dryRun) {
const packageManager = JsPackageManagerFactory.getPackageManager();

const [packageJson, storybookVersion] = await Promise.all([
//
packageManager.retrievePackageJson(),
getCoercedStorybookVersion(packageManager),
]);
const { configDir: inferredConfigDir, mainConfig: mainConfigPath } =
getStorybookInfo(packageJson);
const configDir = inferredConfigDir || '.storybook';
const { configDir: inferredConfigDir, mainConfig: mainConfigPath } = getStorybookInfo(
packageJson,
userSpecifiedConfigDir
);
const configDir = userSpecifiedConfigDir || inferredConfigDir || '.storybook';

// GUARDS
if (!storybookVersion) {
Expand Down
57 changes: 22 additions & 35 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5956,8 +5956,8 @@ __metadata:
next: "npm:^14.1.0"
node-polyfill-webpack-plugin: "npm:^2.0.1"
pnp-webpack-plugin: "npm:^1.7.0"
postcss: "npm:^8.4.21"
postcss-loader: "npm:^7.0.2"
postcss: "npm:^8.4.38"
postcss-loader: "npm:^8.1.1"
react-refresh: "npm:^0.14.0"
resolve-url-loader: "npm:^5.0.0"
sass-loader: "npm:^12.4.0"
Expand Down Expand Up @@ -12021,23 +12021,6 @@ __metadata:
languageName: node
linkType: hard

"cosmiconfig@npm:^8.3.5":
version: 8.3.6
resolution: "cosmiconfig@npm:8.3.6"
dependencies:
import-fresh: "npm:^3.3.0"
js-yaml: "npm:^4.1.0"
parse-json: "npm:^5.2.0"
path-type: "npm:^4.0.0"
peerDependencies:
typescript: ">=4.9.5"
peerDependenciesMeta:
typescript:
optional: true
checksum: 10c0/0382a9ed13208f8bfc22ca2f62b364855207dffdb73dc26e150ade78c3093f1cf56172df2dd460c8caf2afa91c0ed4ec8a88c62f8f9cd1cf423d26506aa8797a
languageName: node
linkType: hard

"cosmiconfig@npm:^9.0.0":
version: 9.0.0
resolution: "cosmiconfig@npm:9.0.0"
Expand Down Expand Up @@ -22657,7 +22640,7 @@ __metadata:
languageName: node
linkType: hard

"postcss-loader@npm:8.1.1":
"postcss-loader@npm:8.1.1, postcss-loader@npm:^8.1.1":
version: 8.1.1
resolution: "postcss-loader@npm:8.1.1"
dependencies:
Expand All @@ -22677,20 +22660,6 @@ __metadata:
languageName: node
linkType: hard

"postcss-loader@npm:^7.0.2":
version: 7.3.4
resolution: "postcss-loader@npm:7.3.4"
dependencies:
cosmiconfig: "npm:^8.3.5"
jiti: "npm:^1.20.0"
semver: "npm:^7.5.4"
peerDependencies:
postcss: ^7.0.0 || ^8.0.1
webpack: ^5.0.0
checksum: 10c0/1bf7614aeea9ad1f8ee6be3a5451576c059391688ea67f825aedc2674056369597faeae4e4a81fe10843884c9904a71403d9a54197e1f560e8fbb9e61f2a2680
languageName: node
linkType: hard

"postcss-media-query-parser@npm:^0.2.3":
version: 0.2.3
resolution: "postcss-media-query-parser@npm:0.2.3"
Expand Down Expand Up @@ -22828,7 +22797,7 @@ __metadata:
languageName: node
linkType: hard

"postcss@npm:8.4.35, postcss@npm:^8.2.14, postcss@npm:^8.4.21, postcss@npm:^8.4.23, postcss@npm:^8.4.27, postcss@npm:^8.4.32, postcss@npm:^8.4.33, postcss@npm:^8.4.35":
"postcss@npm:8.4.35, postcss@npm:^8.2.14, postcss@npm:^8.4.23, postcss@npm:^8.4.27, postcss@npm:^8.4.32, postcss@npm:^8.4.33, postcss@npm:^8.4.35":
version: 8.4.35
resolution: "postcss@npm:8.4.35"
dependencies:
Expand All @@ -22849,6 +22818,17 @@ __metadata:
languageName: node
linkType: hard

"postcss@npm:^8.4.38":
version: 8.4.38
resolution: "postcss@npm:8.4.38"
dependencies:
nanoid: "npm:^3.3.7"
picocolors: "npm:^1.0.0"
source-map-js: "npm:^1.2.0"
checksum: 10c0/955407b8f70cf0c14acf35dab3615899a2a60a26718a63c848cf3c29f2467b0533991b985a2b994430d890bd7ec2b1963e36352b0774a19143b5f591540f7c06
languageName: node
linkType: hard

"preact@npm:^10.5.13":
version: 10.19.3
resolution: "preact@npm:10.19.3"
Expand Down Expand Up @@ -25794,6 +25774,13 @@ __metadata:
languageName: node
linkType: hard

"source-map-js@npm:^1.2.0":
version: 1.2.0
resolution: "source-map-js@npm:1.2.0"
checksum: 10c0/7e5f896ac10a3a50fe2898e5009c58ff0dc102dcb056ed27a354623a0ece8954d4b2649e1a1b2b52ef2e161d26f8859c7710350930751640e71e374fe2d321a4
languageName: node
linkType: hard

"source-map-loader@npm:5.0.0":
version: 5.0.0
resolution: "source-map-loader@npm:5.0.0"
Expand Down

0 comments on commit 63254fd

Please sign in to comment.