Skip to content

Commit

Permalink
Meta: Improve code generator.
Browse files Browse the repository at this point in the history
  • Loading branch information
filiphsps committed Dec 8, 2023
1 parent 5233770 commit f7503b9
Show file tree
Hide file tree
Showing 14 changed files with 348 additions and 260 deletions.
5 changes: 5 additions & 0 deletions .changeset/cyan-gorillas-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@nordcom/nordstar': patch
---

Improve internal tooling.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"clean:packages": "turbo clean --filter=!@nordcom/nordstar-docs --filter=!@nordcom/nordstar-storybook",
"clean:docs": "turbo clean --filter=@nordcom/nordstar-docs",
"clean:storybook": "turbo clean --filter=@nordcom/nordstar-storybook",
"create:component": "plop component",
"create:package": "plop package",
"create": "plop --plopfile ./plop/plopfile.js",
"create:component": "plop --plopfile ./plop/plopfile.js component",
"version": "changeset version",
"postversion": "npm install",
"version:unstable": "changeset version --snapshot unstable",
Expand Down Expand Up @@ -98,6 +98,7 @@
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-unused-imports": "3.0.0",
"husky": "8.0.3",
"inquirer-directory": "2.2.0",
"jsdom": "23.0.1",
"lint-staged": "15.2.0",
"plop": "4.0.0",
Expand All @@ -109,6 +110,7 @@
"react-dom": "18.2.0",
"rimraf": "5.0.5",
"sass": "1.69.5",
"strip-ansi": "7.1.0",
"turbo": "1.11.1",
"typescript": "5.3.3",
"vite": "5.0.6",
Expand Down
2 changes: 2 additions & 0 deletions plop/component/src/{{componentName}}.test.tsx.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import '@testing-library/jest-dom';

import { describe, expect, it } from 'vitest';

import { {{capitalize componentName}} } from '../src';
Expand Down
10 changes: 4 additions & 6 deletions plop/component/src/{{componentName}}.tsx.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ export type {{capitalize componentName}}Props = {
as?: As;
};

const {{capitalize componentName}} = forwardRef<'div', {{capitalize componentName}}Props>(
({ as: Tag = 'div', className, ...props }, ref) => {
const classes = `${styles.container}${className ? ` ${className}` : ''}`;
const {{capitalize componentName}} = forwardRef<'div', {{capitalize componentName}}Props>(({ as: Tag = 'div', className, ...props }, ref) => {
const classes = `${styles.container}${className ? ` ${className}` : ''}`;

return <Tag ref={ref} {...props} className={classes} />;
}
);
return <Tag ref={ref} {...props} className={classes} />;
});

{{capitalize componentName}}.displayName = 'Nordstar.{{capitalize componentName}}';

Expand Down
6 changes: 3 additions & 3 deletions plop/component/tsconfig.json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"rootDir": "./src",
"outDir": "dist"
},
"exclude": ["node_modules", "dist", "src/**/*.test.*", "src/**/*.stories.*"],
"extends": "../../../tsconfig.json",
"include": ["src", "index.ts", "../../../@types/declaration.d.ts"]
"exclude": ["node_modules", "dist", "**/*.test.*", "**/*.stories.*"],
"extends": "../../tsconfig.json",
"include": ["./src/**/*.ts", "./**/*.tsx", "../../../@types/declaration.d.ts"]
}
9 changes: 0 additions & 9 deletions plop/package/README.md.hbs

This file was deleted.

74 changes: 0 additions & 74 deletions plop/package/package.json.hbs

This file was deleted.

Empty file removed plop/package/src/index.ts.hbs
Empty file.
11 changes: 0 additions & 11 deletions plop/package/tsconfig.json.hbs

This file was deleted.

43 changes: 0 additions & 43 deletions plop/package/vite.config.ts.hbs

This file was deleted.

16 changes: 16 additions & 0 deletions plop/page/{{lowerCase name}}/page.tsx.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Heading, View } from '@nordcom/nordstar';
import type { Metadata } from 'next';

export type {{name}}PageProps = {};

export const metadata: Metadata = {
title: '{{name}} Page'
};

export default async function {{name}}Page({}: {{name}}PageProps) {
return (
<View>
<Heading>TODO</Heading>
</View>
);
}
Loading

1 comment on commit f7503b9

@vercel
Copy link

@vercel vercel bot commented on f7503b9 Dec 8, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

nordstar – ./docs

nordstar.nordcom.io
nordstar.vercel.app
nordstar-nordcom.vercel.app
nordstar-git-master-nordcom.vercel.app

Please sign in to comment.