Skip to content

Commit

Permalink
v2.0.0 (#65)
Browse files Browse the repository at this point in the history
* refactor(Nav): remove ReactTransitionGroup; adjust styles to accommodate

* build(deps): bump semver from 5.7.1 to 5.7.2

Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](npm/node-semver@v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: remove useModal hook from source

* fix(utils): fix castToBool file extension

* Squashed commit of the following:

commit fcdacac
Merge: 269e50b 902637a
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Tue Jul 11 10:00:20 2023 -0700

    1.0.0

commit 902637a
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Tue Jul 11 09:59:00 2023 -0700

    1.0.0

commit 269e50b
Author: Andrew Rubin <30575213+andrewrubin@users.noreply.github.com>
Date:   Tue Jul 11 09:57:10 2023 -0700

    Release/1.0.0 (#52)

    * docs: Update of tweeter link #30

    * feature: clickable path aliases

    * fix(image helpers): add -webkit prefix to @image-set SASS mixin.

    * fix(sitemap): ignore default locale's root path

    * feat(Nav): add focus boundary for togglable menu

    * Separate package JSON config from other potential configs (#44)

    * chore: replace placeholder CLI description

    * feat(CLI): specify "package" property in project configs

    * feat(CLI): remove opinionated properties from allowed entries in custom package JSON config

    * fix(Nav): rename undefined CSS module

    * fix: adds nvmrc

    * fix: removes test folder

    * fix: adds vscode settings to template

    * fix: formats files

    * feature: improves classname util

    * fix: ensures only strings are accepts

    * docs(CLI): specify "CLI" in the CLI readme contribution notes, as that may be a source of confusion

    * docs: update per all the new corgi updates

    * 1.0.0-beta.0

    * docs 1.0.0

    * fix(CLI: project template): fix undefined HomeLayout

    * fix: aliases and eslint

    * fix: import settings

    * add Marlon to CLI contributors

    * docs: update subpath alias blurb

    ---------

    Co-authored-by: Michal Hoffman <michal.z.hoffman@gmail.com>
    Co-authored-by: Marlon Marcello <marlon.marcello@gmail.com>

commit f119f83
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Tue Jul 11 09:47:29 2023 -0700

    fix(CLI): fix error handling on nested Component paths

commit f782d46
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Tue Jul 11 09:21:22 2023 -0700

    docs: update subpath alias blurb

commit 1a37a5e
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Tue Jul 11 09:16:18 2023 -0700

    add Marlon to CLI contributors

commit 01a7467
Author: Marlon Marcello <marlon.marcello@gmail.com>
Date:   Mon Jul 10 17:46:27 2023 -0700

    fix: import settings

commit 3a4974e
Author: Marlon Marcello <marlon.marcello@gmail.com>
Date:   Mon Jul 10 17:25:58 2023 -0700

    fix: aliases and eslint

commit 32126da
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Fri Jul 7 17:46:57 2023 -0700

    fix(CLI: project template): fix undefined HomeLayout

commit 94486da
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Fri Jul 7 17:32:19 2023 -0700

    docs 1.0.0

commit 86e4f8b
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Fri Jul 7 17:31:23 2023 -0700

    1.0.0-beta.0

commit b34a814
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Fri Jul 7 17:27:45 2023 -0700

    docs: update per all the new corgi updates

commit 0ec7702
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Fri Jul 7 16:25:39 2023 -0700

    docs(CLI): specify "CLI" in the CLI readme contribution notes, as that may be a source of confusion

commit 5157576
Merge: 84359e9 9684683
Author: Andrew Rubin <arubin78@gmail.com>
Date:   Fri Jul 7 16:17:29 2023 -0700

    Merge branch 'dev' into release/1.0.0

commit 84359e9
Author: Marlon Marcello <marlon.marcello@gmail.com>
Date:   Fri Jun 23 17:34:29 2023 -0700

    fix: formats files

commit e084c65
Author: Marlon Marcello <marlon.marcello@gmail.com>
Date:   Fri Jun 23 17:26:14 2023 -0700

    fix: adds vscode settings to template

commit e90a405
Author: Marlon Marcello <marlon.marcello@gmail.com>
Date:   Fri Jun 23 17:23:15 2023 -0700

    fix: removes test folder

commit e93af02
Author: Marlon Marcello <marlon.marcello@gmail.com>
Date:   Fri Jun 23 17:22:56 2023 -0700

    fix: adds nvmrc

* cli v1.0.1

* fix: eslint alias group (#57)

* fix: eslint alias group

* version

* feature: warning missing NEXT_PUBLIC_URL env

* 1.0.2

* Update package.json

* fix(hooks): remove useModal from barrel file

* fix(Page): remove scrollbar from main content

* cli v1.0.2

* Bugfix/nav accessibility (#64)

* feat(Nav): add new ARIA attrs; convert menus to <ul>

* fix(ReducedMotionButton): add missing ARIA attr

* fix(Nav): remove aria-expanded from Nav list

* fix: ensures locale config is source of truth (#63)

* fix: ensures config is used instead of files

* refactor(locale config): organize file, derive locale strings from Map

---------

Co-authored-by: Andrew Rubin <arubin78@gmail.com>

* 0.1.0

* 0.0.2

* cli v1.1.0

* fix: swaps the script names back to NextJS standard (#68)

* fix: swaps the script names back to NextJS standard

* fix: start now serves ssg

* feature: adds spacing classes (#67)

* feature: adds spacing classes

* feat(style utils): add child-spacing utils

---------

Co-authored-by: Andrew Rubin <arubin78@gmail.com>

* feature: adds spacing classes (#67)

* feature: adds spacing classes

* feat(style utils): add child-spacing utils

---------

Co-authored-by: Andrew Rubin <arubin78@gmail.com>

* chore(Nav): remove RTG styles

* chore(PageTransition): remove component

* feat(Nav): pass toggleability bool

* fix(breakpoints): add MQs for breakpoint snipe

* docs(LocaleContext): remove outdated comments

* fix: vulnerability in package

* fix: vulnerability in package

* chore(project template): remove pageSlug from page props

* feature: modulify yml files (#72)

* feature: uses webpack loader for yaml modules

* fix: small improvement to array check

---------

Co-authored-by: Andrew Rubin <arubin78@gmail.com>

* Feature/cli-jsx-and-indexing (#74)

* chore(CLI): update page template to JSX ext

* feat(CLI): update component template to use JSX, index file

* refactor(CLI): make kebab case converter more robust (#75)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marlon Ugocioni Marcello <marlon.marcello@gmail.com>
  • Loading branch information
3 people authored Sep 5, 2023
1 parent b3a9f5d commit d1c7db6
Show file tree
Hide file tree
Showing 37 changed files with 5,957 additions and 3,237 deletions.
8 changes: 6 additions & 2 deletions cli/bin/commands/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ const component = async (names) => {

// Bootstrap all necessary component files, based on the corgi templates
const template = await readFile(
path.join(__dirname, "../../templates/component/component.js"),
path.join(__dirname, "../../templates/component/component.jsx"),
{ encoding: "utf8" }
);
const stylesheet = await readFile(
path.join(__dirname, "../../templates/component/component.module.scss"),
{ encoding: "utf8" }
);
const indexFile = await readFile(
path.join(__dirname, "../../templates/component/index.js"),
{ encoding: "utf8" }
);

await createComponents(names, template, stylesheet);
await createComponents(names, template, stylesheet, indexFile);
};

export default component;
3 changes: 1 addition & 2 deletions cli/bin/commands/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import createPages from "../../lib/create-pages.js";
import handleNamingErrors, {
NAME_TYPES,
} from "../../lib/handle-naming-errors.js";
import log from "../../lib/log.js";

const __dirname = url.fileURLToPath(new URL(".", import.meta.url));

Expand All @@ -18,7 +17,7 @@ const page = async (names, options) => {

// Bootstrap all necessary page files, based on the corgi page and locale templates
const pageTemplate = await readFile(
path.join(__dirname, "../../templates/page.js"),
path.join(__dirname, "../../templates/page.jsx"),
{ encoding: "utf8" }
);
const localeTemplate = await readFile(
Expand Down
4 changes: 2 additions & 2 deletions cli/lib/check-existing.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { existsSync } from "fs";

import log from "./log.js"
import prompt from "./prompt.js";
import { getQuestion, pascalToKebab } from "./utils.js";
import { getQuestion, makeKebabCase } from "./utils.js";

// Async iterator lets us wait for the user's input on each question
async function* askQuestions(dirNames, type) {
for (const name of dirNames) {
const slug = pascalToKebab(name);
const slug = makeKebabCase(name);

if (existsSync(`${type.location}/${slug}`)) {
const input = await prompt(
Expand Down
13 changes: 9 additions & 4 deletions cli/lib/create-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { mkdir, writeFile } from "fs/promises";
import log from "./log.js";
import { assembleDirectoryPath } from "./utils.js"

async function* makeComponents(names, template, stylesheet) {
async function* makeComponents(names, template, stylesheet, indexFile) {
for (const input of names) {
const { name, slug, directory } = assembleDirectoryPath({
pathToDir: "./src/components",
Expand All @@ -14,16 +14,21 @@ async function* makeComponents(names, template, stylesheet) {
.replaceAll("COMPONENT_SLUG", slug)
.replaceAll("COMPONENT_NAME", name);

const indexFileContent = indexFile
.replaceAll("COMPONENT_SLUG", slug)
.replaceAll("COMPONENT_NAME", name);

await mkdir(directory, { recursive: true });
await writeFile(`${directory}/${slug}.js`, componentContent);
await writeFile(`${directory}/${slug}.jsx`, componentContent);
await writeFile(`${directory}/${slug}.module.scss`, stylesheet);
await writeFile(`${directory}/index.js`, indexFileContent);

yield name;
}
}

const createComponents = async (names, template, stylesheet) => {
for await (const component of makeComponents(names, template, stylesheet)) {
const createComponents = async (names, template, stylesheet, indexFile) => {
for await (const component of makeComponents(names, template, stylesheet, indexFile)) {
log("ok", `${component}: created component`)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/create-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function* makePages(pageNames, pageTemplateUTF8) {
.replaceAll("PAGE_NAME", name);

await mkdir(directory, { recursive: true });
writeFile(`${directory}/index.js`, pageContent);
writeFile(`${directory}/index.jsx`, pageContent);
yield name;
}
}
Expand Down
10 changes: 7 additions & 3 deletions cli/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ import CONSTS from "../consts.js";
export const getQuestion = (id) =>
CONSTS.QUESTIONS.find((q) => q.id === id).text;

export const pascalToKebab = (str) =>
str.replace(/([a-z09])([A-Z])/g, "$1-$2").toLowerCase();
// Very thorough kebab-casing regex replacer from StackOverflow user ABabin:
// https://stackoverflow.com/a/67243723
export const makeKebabCase = (str) => str.replace(
/[A-Z]+(?![a-z])|[A-Z]/g,
(match, offset) => (offset ? "-" : "") + match.toLowerCase()
)

const throwDirectoryPathError = (arg, example) => {
throw new Error(
Expand All @@ -18,7 +22,7 @@ export const assembleDirectoryPath = ({ pathToDir, inputName } = {}) => {

const parts = inputName.split("/");
const name = parts.pop();
const slug = pascalToKebab(name);
const slug = makeKebabCase(name);
const subDirectory = parts.join("/");

const directory = `${pathToDir}/${subDirectory ? subDirectory + "/" : ""}${slug}`
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wethegit/corgi",
"version": "1.0.2",
"version": "1.1.0",
"description": "Command line interface for use with the corgi framework.",
"main": "bin/index.js",
"bin": {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions cli/templates/component/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { COMPONENT_NAME } from "./COMPONENT_SLUG"
4 changes: 2 additions & 2 deletions cli/templates/page.js → cli/templates/page.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { setupPaths, setupProps } from "@local/utils"
import { PageProvider } from "@local/context"
import { useLocale } from "@local/hooks"
import { setupPaths, setupProps } from "@local/utils"

const LOCALE_FOLDER = "PAGE_SLUG"

Expand All @@ -19,7 +19,7 @@ const PAGE_NAME = ({}) => {
)
}

export const getStaticPaths = () => setupPaths(LOCALE_FOLDER)
export const getStaticPaths = async () => setupPaths(LOCALE_FOLDER)
export const getStaticProps = async (ctx) => setupProps(ctx, LOCALE_FOLDER)

export default PAGE_NAME
8 changes: 8 additions & 0 deletions cli/templates/project/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ const nextConfig = {
...config.resolve.alias,
"@local/*": resolve("src/*"),
}

config.resolve.fallback = { fs: false }

// insert js-yaml-loader
config.module.rules.push({
test: /\.ya?ml$/,
use: 'js-yaml-loader',
})

return config
},
}
Expand Down
6 changes: 4 additions & 2 deletions cli/templates/project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
"mash-watch": "node mash.mjs --watch",
"postbuild": "next-sitemap && next export",
"preflight": "npm run mash-build-all && next build",
"start": "npm run mash-watch & next dev -p 8080"
"dev": "npm run mash-watch & next dev -p 8080",
"start": "serve ./out -p 8080"
},
"dependencies": {
"@wethegit/react-hooks": "~0.0.8",
"next": "~12.1.0",
"next-compose-plugins": "~2.2.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-transition-group": "^4.4.2"
"js-yaml-loader": "~1.2.2"
},
"devDependencies": {
"@squoosh/lib": "^0.4.0",
Expand All @@ -37,6 +38,7 @@
"eslint-config-prettier": "~8.3.0",
"eslint-plugin-import": "~2.27.5",
"eslint-import-resolver-alias": "^1.1.2",
"serve": "~14.2.0",
"stylelint": "~14.5.1",
"stylelint-config-standard-scss": "~3.0.0",
"stylelint-order": "~5.0.0"
Expand Down
1 change: 0 additions & 1 deletion cli/templates/project/src/components/app/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { AppContextProviders } from "./app-context-providers"
export { Page } from "./page"
export { PageTransition } from "./page-transition"

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function ReducedMotionButton() {
castToBool(prefersReducedMotion) && styles.rmButtonSelected,
])}
onClick={() => togglePrefersReducedMotion()}
aria-pressed={prefersReducedMotion}
>
<span className={styles.rmButtonIcon}></span>
<span className={styles.rmButtonLabel}>
Expand Down

This file was deleted.

Loading

0 comments on commit d1c7db6

Please sign in to comment.