march-hare 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1
- package/dist/action/index.d.ts +2 -2
- package/dist/action/utils.d.ts +2 -2
- package/dist/actions/index.d.ts +2 -2
- package/dist/actions/types.d.ts +3 -3
- package/dist/actions/utils.d.ts +3 -3
- package/dist/app/index.d.ts +7 -7
- package/dist/app/types.d.ts +5 -5
- package/dist/boundary/components/broadcast/index.d.ts +2 -2
- package/dist/boundary/components/broadcast/types.d.ts +1 -1
- package/dist/boundary/components/consumer/components/partition/index.d.ts +1 -1
- package/dist/boundary/components/consumer/components/partition/types.d.ts +1 -1
- package/dist/boundary/components/consumer/index.d.ts +5 -5
- package/dist/boundary/components/consumer/types.d.ts +1 -1
- package/dist/boundary/components/consumer/utils.d.ts +1 -1
- package/dist/boundary/components/env/index.d.ts +3 -27
- package/dist/boundary/components/env/types.d.ts +24 -2
- package/dist/boundary/components/env/utils.d.ts +1 -1
- package/dist/boundary/components/scope/index.d.ts +2 -2
- package/dist/boundary/components/scope/types.d.ts +1 -1
- package/dist/boundary/components/scope/utils.d.ts +1 -1
- package/dist/boundary/components/sharing/index.d.ts +1 -1
- package/dist/boundary/components/tap/index.d.ts +3 -3
- package/dist/boundary/components/tap/types.d.ts +2 -2
- package/dist/boundary/components/tap/utils.d.ts +1 -1
- package/dist/boundary/components/tasks/index.d.ts +2 -2
- package/dist/boundary/components/tasks/utils.d.ts +1 -1
- package/dist/boundary/index.d.ts +1 -1
- package/dist/boundary/types.d.ts +2 -2
- package/dist/cache/index.d.ts +2 -2
- package/dist/cache/types.d.ts +1 -1
- package/dist/cli/bin/mh.js +10 -0
- package/dist/cli/lib/banner/index.js +14 -0
- package/dist/cli/lib/commands/app/index.js +37 -0
- package/dist/cli/lib/commands/feature/index.js +55 -0
- package/dist/cli/lib/commands/index.js +89 -0
- package/dist/cli/lib/commands/init/index.js +29 -0
- package/dist/cli/lib/commands/shared/index.js +56 -0
- package/dist/cli/lib/index.js +56 -0
- package/dist/cli/lib/parser/index.js +24 -0
- package/dist/cli/lib/prompt/index.js +61 -0
- package/dist/cli/lib/runner/index.js +46 -0
- package/dist/cli/lib/runner/types.js +1 -0
- package/dist/cli/lib/runner/utils.js +60 -0
- package/dist/cli/lib/types.js +1 -0
- package/dist/cli/lib/utils.js +20 -0
- package/dist/cli/templates/app/action/actions.ts.ejs.t +10 -0
- package/dist/cli/templates/app/action/types.ts.ejs.t +7 -0
- package/dist/cli/templates/app/integration/index.integration.tsx.ejs.t +13 -0
- package/dist/cli/templates/app/page/actions.ts.ejs.t +14 -0
- package/dist/cli/templates/app/page/index.tsx.ejs.t +20 -0
- package/dist/cli/templates/app/page/styles.ts.ejs.t +35 -0
- package/dist/cli/templates/app/page/types.ts.ejs.t +12 -0
- package/dist/cli/templates/feature/action/actions.ts.ejs.t +10 -0
- package/dist/cli/templates/feature/action/types.ts.ejs.t +7 -0
- package/dist/cli/templates/feature/multicast/types.ts.ejs.t +7 -0
- package/dist/cli/templates/feature/presentational/index.tsx.ejs.t +14 -0
- package/dist/cli/templates/feature/presentational/types.ts.ejs.t +12 -0
- package/dist/cli/templates/feature/presentational/utils.ts.ejs.t +8 -0
- package/dist/cli/templates/feature/stateful/actions.ts.ejs.t +16 -0
- package/dist/cli/templates/feature/stateful/index.tsx.ejs.t +19 -0
- package/dist/cli/templates/feature/stateful/types.ts.ejs.t +16 -0
- package/dist/cli/templates/feature/stateful/utils.ts.ejs.t +8 -0
- package/dist/cli/templates/feature/unit/index.test.tsx.ejs.t +21 -0
- package/dist/cli/templates/init/new/README.md.ejs.t +48 -0
- package/dist/cli/templates/init/new/eslint.config.js.ejs.t +88 -0
- package/dist/cli/templates/init/new/gitignore.ejs.t +9 -0
- package/dist/cli/templates/init/new/index.html.ejs.t +18 -0
- package/dist/cli/templates/init/new/package.json.ejs.t +54 -0
- package/dist/cli/templates/init/new/playwright.config.ts.ejs.t +17 -0
- package/dist/cli/templates/init/new/prettierrc.ejs.t +8 -0
- package/dist/cli/templates/init/new/src.app.index.tsx.ejs.t +14 -0
- package/dist/cli/templates/init/new/src.app.pages.home.actions.ts.ejs.t +16 -0
- package/dist/cli/templates/init/new/src.app.pages.home.index.tsx.ejs.t +30 -0
- package/dist/cli/templates/init/new/src.app.pages.home.integration.tsx.ejs.t +28 -0
- package/dist/cli/templates/init/new/src.app.pages.home.styles.ts.ejs.t +45 -0
- package/dist/cli/templates/init/new/src.app.pages.home.types.ts.ejs.t +12 -0
- package/dist/cli/templates/init/new/src.app.utils.ts.ejs.t +9 -0
- package/dist/cli/templates/init/new/src.features.greet.actions.ts.ejs.t +20 -0
- package/dist/cli/templates/init/new/src.features.greet.index.test.tsx.ejs.t +21 -0
- package/dist/cli/templates/init/new/src.features.greet.index.tsx.ejs.t +24 -0
- package/dist/cli/templates/init/new/src.features.greet.types.ts.ejs.t +18 -0
- package/dist/cli/templates/init/new/src.features.greet.utils.ts.ejs.t +8 -0
- package/dist/cli/templates/init/new/src.index.tsx.ejs.t +8 -0
- package/dist/cli/templates/init/new/src.shared.components.button.index.test.tsx.ejs.t +13 -0
- package/dist/cli/templates/init/new/src.shared.components.button.index.tsx.ejs.t +10 -0
- package/dist/cli/templates/init/new/src.shared.components.button.types.ts.ejs.t +6 -0
- package/dist/cli/templates/init/new/src.shared.resources.index.ts.ejs.t +4 -0
- package/dist/cli/templates/init/new/src.shared.theme.index.ts.ejs.t +51 -0
- package/dist/cli/templates/init/new/src.shared.types.index.ts.ejs.t +23 -0
- package/dist/cli/templates/init/new/src.test-setup.ts.ejs.t +10 -0
- package/dist/cli/templates/init/new/src.vite-env.d.ts.ejs.t +4 -0
- package/dist/cli/templates/init/new/tests.home.e2e.ts.ejs.t +14 -0
- package/dist/cli/templates/init/new/tsconfig.json.ejs.t +29 -0
- package/dist/cli/templates/init/new/vite.config.ts.ejs.t +17 -0
- package/dist/cli/templates/init/new/vitest.config.ts.ejs.t +24 -0
- package/dist/cli/templates/shared/component/index.tsx.ejs.t +9 -0
- package/dist/cli/templates/shared/component/types.ts.ejs.t +8 -0
- package/dist/cli/templates/shared/resource/index.ts.ejs.t +15 -0
- package/dist/cli/templates/shared/resource/types.ts.ejs.t +10 -0
- package/dist/cli/templates/shared/type-broadcast/types.ts.ejs.t +7 -0
- package/dist/cli/templates/shared/type-payload/types.ts.ejs.t +9 -0
- package/dist/cli/templates/shared/unit-component/index.test.tsx.ejs.t +13 -0
- package/dist/cli/templates/shared/unit-resource/index.test.ts.ejs.t +15 -0
- package/dist/cli/templates/shared/unit-util/index.test.ts.ejs.t +11 -0
- package/dist/cli/templates/shared/util/index.ts.ejs.t +6 -0
- package/dist/coalesce/index.d.ts +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/error/types.d.ts +1 -1
- package/dist/error/utils.d.ts +1 -1
- package/dist/index.d.ts +16 -16
- package/dist/march-hare.js.map +1 -1
- package/dist/march-hare.umd.cjs.map +1 -1
- package/dist/resource/index.d.ts +4 -4
- package/dist/resource/types.d.ts +3 -3
- package/dist/resource/utils.d.ts +4 -4
- package/dist/scope/index.d.ts +3 -3
- package/dist/scope/types.d.ts +2 -2
- package/dist/scope/utils.d.ts +2 -2
- package/dist/shared/index.d.ts +4 -4
- package/dist/types/index.d.ts +5 -5
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/types.d.ts +1 -1
- package/dist/utils/utils.d.ts +1 -1
- package/dist/with/index.d.ts +3 -3
- package/dist/with/types.d.ts +2 -2
- package/dist/with/utils.d.ts +3 -3
- package/package.json +18 -4
- package/src/cli/README.md +314 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: vitest.config.ts
|
|
3
|
+
---
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
import { defineConfig } from "vitest/config";
|
|
6
|
+
import react from "@vitejs/plugin-react";
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [react()],
|
|
10
|
+
resolve: {
|
|
11
|
+
alias: {
|
|
12
|
+
"@app": resolve(__dirname, "src/app"),
|
|
13
|
+
"@features": resolve(__dirname, "src/features"),
|
|
14
|
+
"@shared": resolve(__dirname, "src/shared"),
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
test: {
|
|
18
|
+
environment: "happy-dom",
|
|
19
|
+
include: ["src/**/*.test.{ts,tsx}", "src/**/*.integration.{ts,tsx}"],
|
|
20
|
+
setupFiles: ["./src/test-setup.ts"],
|
|
21
|
+
clearMocks: true,
|
|
22
|
+
restoreMocks: true,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: src/shared/components/<%= name %>/index.tsx
|
|
3
|
+
---
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import type { Props } from "./types.ts";
|
|
6
|
+
|
|
7
|
+
export function <%= pascalName %>({ children, ...rest }: Props): React.ReactElement {
|
|
8
|
+
return <div {...rest}>{children}</div>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: src/shared/resources/<%= name %>/index.ts
|
|
3
|
+
---
|
|
4
|
+
import { shared } from "march-hare";
|
|
5
|
+
import ky from "ky";
|
|
6
|
+
import { type Envs } from "@shared/types/index.ts";
|
|
7
|
+
import { <%= pascalName %> } from "./types.ts";
|
|
8
|
+
|
|
9
|
+
export const fetch = shared.Resource<Envs, <%= pascalName %>.Response>((context) =>
|
|
10
|
+
ky
|
|
11
|
+
.get(`${context.env.apiBase}/<%= name %>`, {
|
|
12
|
+
signal: context.controller.signal,
|
|
13
|
+
})
|
|
14
|
+
.json<<%= pascalName %>.Response>(),
|
|
15
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: src/shared/components/<%= name %>/index.test.tsx
|
|
3
|
+
---
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import { render } from "@testing-library/react";
|
|
6
|
+
import { <%= pascalName %> } from "./index.tsx";
|
|
7
|
+
|
|
8
|
+
describe("<%= pascalName %>", () => {
|
|
9
|
+
it("renders without crashing", () => {
|
|
10
|
+
render(<<%= pascalName %> />);
|
|
11
|
+
expect(document.body).toBeInTheDocument();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: src/shared/resources/<%= name %>/index.test.ts
|
|
3
|
+
---
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import { fetch } from "./index.ts";
|
|
6
|
+
|
|
7
|
+
describe("resource.<%= name %>", () => {
|
|
8
|
+
it("exposes a fetcher handle", () => {
|
|
9
|
+
expect(typeof fetch).toBe("function");
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("returns null on the first sync call (cache miss)", () => {
|
|
13
|
+
expect(fetch.get()).toBeNull();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: src/shared/utils/<%= name %>/index.test.ts
|
|
3
|
+
---
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import { <%= camel(name) %> } from "./index.ts";
|
|
6
|
+
|
|
7
|
+
describe("<%= camel(name) %>", () => {
|
|
8
|
+
it("returns a string", () => {
|
|
9
|
+
expect(typeof <%= camel(name) %>("hello")).toBe("string");
|
|
10
|
+
});
|
|
11
|
+
});
|
package/dist/coalesce/index.d.ts
CHANGED
package/dist/context/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Actions, Context as ContextHandle, Model, Props } from '../types/index';
|
|
1
|
+
import { Actions, Context as ContextHandle, Model, Props } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Returns a stable, typed controller handle up-front — before a
|
|
4
4
|
* model is declared via `context.useActions(...)`. Use this when an
|
package/dist/error/types.d.ts
CHANGED
package/dist/error/utils.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { App } from './app/index';
|
|
2
|
-
export type { AppHandle } from './app/index';
|
|
3
|
-
export { Action } from './action/index';
|
|
4
|
-
export { Distribution, Lifecycle } from './types/index';
|
|
5
|
-
export { With } from './with/index';
|
|
6
|
-
export { Boundary } from './boundary/index';
|
|
7
|
-
export { Cache } from './cache/index';
|
|
8
|
-
export { Reason, Aborted } from './error/index';
|
|
9
|
-
export { annotate } from './annotate/index';
|
|
1
|
+
export { App } from './app/index.js';
|
|
2
|
+
export type { AppHandle } from './app/index.js';
|
|
3
|
+
export { Action } from './action/index.js';
|
|
4
|
+
export { Distribution, Lifecycle } from './types/index.js';
|
|
5
|
+
export { With } from './with/index.js';
|
|
6
|
+
export { Boundary } from './boundary/index.js';
|
|
7
|
+
export { Cache } from './cache/index.js';
|
|
8
|
+
export { Reason, Aborted } from './error/index.js';
|
|
9
|
+
export { annotate } from './annotate/index.js';
|
|
10
10
|
export { Operation, Op, State } from 'immertation';
|
|
11
|
-
export * as utils from './utils/index';
|
|
12
|
-
export * as shared from './shared/index';
|
|
13
|
-
export type { Fault } from './error/index';
|
|
14
|
-
export type { Adapter } from './cache/index';
|
|
11
|
+
export * as utils from './utils/index.js';
|
|
12
|
+
export * as shared from './shared/index.js';
|
|
13
|
+
export type { Fault } from './error/index.js';
|
|
14
|
+
export type { Adapter } from './cache/index.js';
|
|
15
15
|
export type { Box } from 'immertation';
|
|
16
|
-
export type { Pk, Maybe, Handler, Handlers } from './types/index';
|
|
17
|
-
export type { Envless } from './boundary/components/env/
|
|
18
|
-
export type { Tap, Taps } from './boundary/components/tap/types';
|
|
16
|
+
export type { Pk, Maybe, Handler, Handlers } from './types/index.js';
|
|
17
|
+
export type { Envless } from './boundary/components/env/types.js';
|
|
18
|
+
export type { Tap, Taps } from './boundary/components/tap/types.js';
|