create-harper 1.9.2 → 1.10.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.
@@ -6,6 +6,7 @@ export const renameFiles = {
6
6
  '_env': '.env',
7
7
  '_env.example': '.env.example',
8
8
  _aiignore: '.aiignore',
9
+ _claude: '.claude',
9
10
  _github: '.github',
10
11
  _gitignore: '.gitignore',
11
12
  _nvmrc: '.nvmrc',
package/lib/init.js CHANGED
@@ -76,7 +76,7 @@ export async function init() {
76
76
  // Write out the contents based on all prior steps.
77
77
  const cwd = process.cwd();
78
78
  const root = path.join(cwd, targetDir);
79
- scaffoldProject(root, projectName, packageName, template, envVars);
79
+ scaffoldProject(root, projectName, packageName, template, envVars, pkgManager);
80
80
 
81
81
  // Log out the next steps.
82
82
  installAndOptionallyStart(root, pkgManager, immediate, args.skipInstall, selectedSkills, selectedAgents);
@@ -12,8 +12,9 @@ import { crawlTemplateDir } from '../fs/crawlTemplateDir.js';
12
12
  * @param {string} packageName - The name for the package.json.
13
13
  * @param {string} template - The template name to use.
14
14
  * @param {import('./getEnvVars.js').EnvVars} [envVars] - Environment variables to substitute.
15
+ * @param {string} [pkgManager] - The package manager that invoked us (e.g. npm, pnpm, yarn, bun). Defaults to npm.
15
16
  */
16
- export function scaffoldProject(root, projectName, packageName, template, envVars) {
17
+ export function scaffoldProject(root, projectName, packageName, template, envVars, pkgManager) {
17
18
  fs.mkdirSync(root, { recursive: true });
18
19
  prompts.log.step(`Scaffolding project in ${root}...`);
19
20
 
@@ -21,6 +22,7 @@ export function scaffoldProject(root, projectName, packageName, template, envVar
21
22
  'your-project-name-here': projectName || 'your-project-name-here',
22
23
  'your-package-name-here': packageName || 'your-package-name-here',
23
24
  'your-fabric.harper.fast-cluster-url-here': envVars?.target || 'your-fabric.harper.fast-cluster-url-here',
25
+ 'your-package-manager-here': pkgManager || 'npm',
24
26
  '\n\t"repository": "github:HarperFast/create-harper",': '',
25
27
  };
26
28
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-harper",
3
3
  "description": "Scaffold a new Harper project in JavaScript or TypeScript.",
4
- "version": "1.9.2",
4
+ "version": "1.10.1",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "exports": {
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "harper",
6
+ "runtimeExecutable": "your-package-manager-here",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 9926
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "harper",
6
+ "runtimeExecutable": "your-package-manager-here",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 9926
9
+ }
10
+ ]
11
+ }
@@ -3,8 +3,26 @@ import { StrictMode } from 'react';
3
3
  import { renderToString } from 'react-dom/server';
4
4
 
5
5
  /**
6
- * Server render entry. The Vite Harper plugin calls this for HTML navigations and injects the
7
- * returned markup into the `<!--ssr-outlet-->` placeholder in index.html.
6
+ * Server render entry. The Vite Harper plugin calls this (awaiting it) for HTML navigations and
7
+ * injects the returned markup into the `<!--ssr-outlet-->` placeholder in index.html.
8
+ *
9
+ * To render with data already in place (no client-side fetch), read from Harper right here. The
10
+ * `tables` registry is the same live, process-wide object available everywhere in Harper — the SSR
11
+ * entry can reach it via `import { tables } from 'harper'` because Harper symlinks
12
+ * `node_modules/harper` to the running install (and `vite.config.js` keeps `harper` external). Make
13
+ * `render` async and query a table, e.g.:
14
+ *
15
+ * import { tables } from 'harper';
16
+ *
17
+ * // The template's App takes no props — update App.jsx to accept `product`.
18
+ * export async function render(url) {
19
+ * const product = await tables.Product.get(idFromUrl(url));
20
+ * return renderToString(
21
+ * <StrictMode>
22
+ * <App product={product} />
23
+ * </StrictMode>,
24
+ * );
25
+ * }
8
26
  *
9
27
  * @param {string} _url The request URL — use it to drive routing/data loading per request.
10
28
  * @returns {string}
@@ -12,6 +12,13 @@ export default defineConfig({
12
12
  '@': path.resolve(import.meta.dirname, './src'),
13
13
  },
14
14
  },
15
+ ssr: {
16
+ // Keep `harper` external so the SSR entry resolves it to Harper's running runtime instead of
17
+ // bundling it. `node_modules/harper` is symlinked to the running install, and symlinked deps
18
+ // aren't reliably auto-externalized for SSR — this is what lets `import { tables } from 'harper'`
19
+ // in entry-server read live data. See src/entry-server.jsx.
20
+ external: ['harper'],
21
+ },
15
22
  build: {
16
23
  outDir: 'dist',
17
24
  emptyOutDir: true,
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "harper",
6
+ "runtimeExecutable": "your-package-manager-here",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 9926
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "harper",
6
+ "runtimeExecutable": "your-package-manager-here",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 9926
9
+ }
10
+ ]
11
+ }
@@ -3,8 +3,26 @@ import { StrictMode } from 'react';
3
3
  import { renderToString } from 'react-dom/server';
4
4
 
5
5
  /**
6
- * Server render entry. The Vite Harper plugin calls this for HTML navigations and injects the
7
- * returned markup into the `<!--ssr-outlet-->` placeholder in index.html.
6
+ * Server render entry. The Vite Harper plugin calls this (awaiting it) for HTML navigations and
7
+ * injects the returned markup into the `<!--ssr-outlet-->` placeholder in index.html.
8
+ *
9
+ * To render with data already in place (no client-side fetch), read from Harper right here. The
10
+ * `tables` registry is the same live, process-wide object available everywhere in Harper — the SSR
11
+ * entry can reach it via `import { tables } from 'harper'` because Harper symlinks
12
+ * `node_modules/harper` to the running install (and `vite.config.ts` keeps `harper` external). Make
13
+ * `render` async and query a table, e.g.:
14
+ *
15
+ * import { tables } from 'harper';
16
+ *
17
+ * // The template's App takes no props — update App.tsx to accept `product`.
18
+ * export async function render(url: string): Promise<string> {
19
+ * const product = await tables.Product.get(idFromUrl(url));
20
+ * return renderToString(
21
+ * <StrictMode>
22
+ * <App product={product} />
23
+ * </StrictMode>,
24
+ * );
25
+ * }
8
26
  *
9
27
  * @param _url The request URL — use it to drive routing/data loading per request.
10
28
  */
@@ -12,6 +12,13 @@ export default defineConfig({
12
12
  '@': path.resolve(import.meta.dirname, './src'),
13
13
  },
14
14
  },
15
+ ssr: {
16
+ // Keep `harper` external so the SSR entry resolves it to Harper's running runtime instead of
17
+ // bundling it. `node_modules/harper` is symlinked to the running install, and symlinked deps
18
+ // aren't reliably auto-externalized for SSR — this is what lets `import { tables } from 'harper'`
19
+ // in entry-server read live data. See src/entry-server.tsx.
20
+ external: ['harper'],
21
+ },
15
22
  build: {
16
23
  outDir: 'dist',
17
24
  emptyOutDir: true,
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "harper",
6
+ "runtimeExecutable": "your-package-manager-here",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 9926
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "harper",
6
+ "runtimeExecutable": "your-package-manager-here",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 9926
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "harper",
6
+ "runtimeExecutable": "your-package-manager-here",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 9926
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "harper",
6
+ "runtimeExecutable": "your-package-manager-here",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 9926
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "harper",
6
+ "runtimeExecutable": "your-package-manager-here",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 9926
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "harper",
6
+ "runtimeExecutable": "your-package-manager-here",
7
+ "runtimeArgs": ["run", "dev"],
8
+ "port": 9926
9
+ }
10
+ ]
11
+ }