create-harper 0.5.0 → 0.6.0
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/lib/fs/copyDir.js +12 -3
- package/lib/fs/copyFile.js +28 -0
- package/lib/fs/crawlTemplateDir.js +3 -3
- package/package.json +1 -3
- package/template-react/README.md +40 -8
- package/template-react-ts/README.md +42 -8
- package/template-vanilla/README.md +31 -11
- package/template-vanilla-ts/README.md +33 -11
- package/lib/fs/applyAndWriteTemplateFile.js +0 -16
- package/lib/fs/copy.js +0 -17
- package/template-studio/README.md +0 -34
- package/template-studio/_aiignore +0 -1
- package/template-studio/_gitignore +0 -147
- package/template-studio/config.yaml +0 -24
- package/template-studio/graphql.config.yml +0 -3
- package/template-studio/package.json +0 -14
- package/template-studio/resources/exampleSocket.js +0 -34
- package/template-studio/resources/exampleTable.js +0 -14
- package/template-studio/resources/greeting.js +0 -10
- package/template-studio/schemas/exampleTable.graphql +0 -7
- package/template-studio/web/index.html +0 -28
- package/template-studio/web/index.js +0 -18
- package/template-studio/web/styles.css +0 -57
- package/template-studio-ts/README.md +0 -34
- package/template-studio-ts/_aiignore +0 -1
- package/template-studio-ts/_gitignore +0 -147
- package/template-studio-ts/config.yaml +0 -24
- package/template-studio-ts/graphql.config.yml +0 -3
- package/template-studio-ts/package.json +0 -14
- package/template-studio-ts/resources/exampleSocket.ts +0 -41
- package/template-studio-ts/resources/exampleTable.ts +0 -20
- package/template-studio-ts/resources/greeting.ts +0 -29
- package/template-studio-ts/schemas/exampleTable.graphql +0 -7
- package/template-studio-ts/tsconfig.json +0 -10
- package/template-studio-ts/web/index.html +0 -28
- package/template-studio-ts/web/index.js +0 -18
- package/template-studio-ts/web/styles.css +0 -57
package/lib/fs/copyDir.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { copyFile } from './copyFile.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Recursively copies a directory from source to destination.
|
|
7
7
|
*
|
|
8
8
|
* @param {string} srcDir - The source directory path.
|
|
9
9
|
* @param {string} destDir - The destination directory path.
|
|
10
|
+
* @param {(src: string, dest: string) => boolean} [filter] - An optional filter function that returns true if the file should be included.
|
|
11
|
+
* @param {Record<string, string> | ((content: string, sourcePath: string, targetPath: string) => string)} [substitutions] - A mapping of strings to replace or a function that returns the updated content.
|
|
10
12
|
*/
|
|
11
|
-
export function copyDir(srcDir, destDir) {
|
|
13
|
+
export function copyDir(srcDir, destDir, filter, substitutions) {
|
|
12
14
|
fs.mkdirSync(destDir, { recursive: true });
|
|
13
15
|
for (const file of fs.readdirSync(srcDir)) {
|
|
14
16
|
const srcFile = path.resolve(srcDir, file);
|
|
15
17
|
const destFile = path.resolve(destDir, file);
|
|
16
|
-
|
|
18
|
+
if (filter === undefined || filter(srcFile, destFile)) {
|
|
19
|
+
if (fs.lstatSync(srcFile).isDirectory()) {
|
|
20
|
+
fs.mkdirSync(destFile, { recursive: true });
|
|
21
|
+
copyDir(srcFile, destFile, substitutions);
|
|
22
|
+
} else {
|
|
23
|
+
copyFile(srcFile, destFile, substitutions);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
17
26
|
}
|
|
18
27
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import colors from 'picocolors';
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
gray,
|
|
6
|
+
green,
|
|
7
|
+
} = colors;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Reads a template file, applies string substitutions, and writes the result to a target path.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} sourcePath - The path to the source template file.
|
|
13
|
+
* @param {string} targetPath - The path where the processed file will be written.
|
|
14
|
+
* @param {Record<string, string> | ((content: string, sourcePath: string, targetPath: string) => string)} [substitutions] - A mapping of strings to replace or a function that returns the updated content.
|
|
15
|
+
*/
|
|
16
|
+
export function copyFile(sourcePath, targetPath, substitutions) {
|
|
17
|
+
let updatedContent = fs.readFileSync(sourcePath, 'utf-8');
|
|
18
|
+
if (typeof substitutions === 'function') {
|
|
19
|
+
updatedContent = substitutions(updatedContent, sourcePath, targetPath);
|
|
20
|
+
} else if (substitutions) {
|
|
21
|
+
for (const variableName in substitutions) {
|
|
22
|
+
updatedContent = updatedContent.replaceAll(variableName, substitutions[variableName]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
console.log(' + ' + green(targetPath) + gray(' from ' + sourcePath));
|
|
27
|
+
fs.writeFileSync(targetPath, updatedContent);
|
|
28
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { renameFiles } from '../constants/renameFiles.js';
|
|
4
|
-
import {
|
|
4
|
+
import { copyFile } from './copyFile.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Recursively crawls a template directory and copies files to the target root, applying substitutions and respecting exclusions.
|
|
8
8
|
*
|
|
9
9
|
* @param {string} root - The current target directory.
|
|
10
10
|
* @param {string} dir - The current source directory in the template.
|
|
11
|
-
* @param {Record<string, string>} substitutions - A mapping of strings to replace
|
|
11
|
+
* @param {Record<string, string> | ((content: string) => string)} substitutions - A mapping of strings to replace or a function that returns the updated content.
|
|
12
12
|
* @param {string[]} [excludedFiles] - A list of relative paths to exclude from copying.
|
|
13
13
|
* @param {string} [templateRootDir] - The absolute path to the root of the template directory (internal).
|
|
14
14
|
*/
|
|
@@ -27,7 +27,7 @@ export function crawlTemplateDir(root, dir, substitutions, excludedFiles = [], t
|
|
|
27
27
|
fs.mkdirSync(targetPath, { recursive: true });
|
|
28
28
|
crawlTemplateDir(targetPath, templatePath, substitutions, excludedFiles, templateRootDir);
|
|
29
29
|
} else {
|
|
30
|
-
|
|
30
|
+
copyFile(templatePath, targetPath, substitutions);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-harper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HarperDB",
|
|
@@ -16,8 +16,6 @@
|
|
|
16
16
|
"!lib/**/*.test.js",
|
|
17
17
|
"template-react/",
|
|
18
18
|
"template-react-ts/",
|
|
19
|
-
"template-studio/",
|
|
20
|
-
"template-studio-ts/",
|
|
21
19
|
"template-vanilla/",
|
|
22
20
|
"template-vanilla-ts/"
|
|
23
21
|
],
|
package/template-react/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# your-project-name-here
|
|
2
2
|
|
|
3
|
+
Your new app is now ready for development!
|
|
4
|
+
|
|
5
|
+
Here's what you should do next:
|
|
6
|
+
|
|
3
7
|
## Installation
|
|
4
8
|
|
|
5
|
-
To get started, make sure you have [installed Harper](https://docs.harperdb.io/docs/deployments/install-harper)
|
|
9
|
+
To get started, make sure you have [installed Harper](https://docs.harperdb.io/docs/deployments/install-harper):
|
|
6
10
|
|
|
7
11
|
```sh
|
|
8
12
|
npm install -g harperdb
|
|
@@ -16,26 +20,54 @@ Then you can start your app:
|
|
|
16
20
|
npm run dev
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
### Define Your Schema
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
The [schemas/exampleTable.graphql](./schemas/exampleTable.graphql) is an example table schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
Open your [schemas/exampleTable.graphql](./schemas/exampleTable.graphql) to take a look at an example schema. You can add as many table definitions to a single schema file as you want. You can also create one file per schema.
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
These schemas are the heart of a great Harper app. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have. REST endpoints will get stood up for any table that you `@export`.
|
|
30
|
+
|
|
31
|
+
### Add Custom Endpoints
|
|
32
|
+
|
|
33
|
+
The [resources/greeting.js](./resources/greeting.js) provides a template for defining JavaScript resource classes, for customized application logic in your endpoints.
|
|
26
34
|
|
|
27
|
-
|
|
35
|
+
### View Your Website
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
Pop open [http://localhost:9926](http://localhost:9926) to view [web/index.html](./web/index.html) in your browser.
|
|
38
|
+
|
|
39
|
+
### Use Your API
|
|
40
|
+
|
|
41
|
+
Test your application works by querying the `/Greeting` endpoint:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
curl http://localhost:9926/Greeting
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
You should see the following:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{ "greeting": "Hello, world!" }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Configure Your App
|
|
54
|
+
|
|
55
|
+
Take a look at the [default configuration](./config.yaml), which specifies how files are handled in your application.
|
|
30
56
|
|
|
31
57
|
## Deployment
|
|
32
58
|
|
|
33
59
|
When you are ready, head to [https://fabric.harper.fast/](https://fabric.harper.fast/), log in to your account, and create a cluster.
|
|
34
60
|
|
|
35
|
-
Make sure you've configured your [.env](
|
|
61
|
+
Make sure you've configured your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
|
|
36
62
|
|
|
37
63
|
Then you can deploy your app to your cluster:
|
|
38
64
|
|
|
39
65
|
```sh
|
|
40
66
|
npm run deploy
|
|
41
67
|
```
|
|
68
|
+
|
|
69
|
+
## Keep Going!
|
|
70
|
+
|
|
71
|
+
For more information about getting started with Harper and building applications, see our [getting started guide](https://docs.harperdb.io/docs).
|
|
72
|
+
|
|
73
|
+
For more information on Harper Components, see the [Components documentation](https://docs.harperdb.io/docs/reference/components).
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# your-project-name-here
|
|
2
2
|
|
|
3
|
+
Your new app is now ready for development!
|
|
4
|
+
|
|
5
|
+
Here's what you should do next:
|
|
6
|
+
|
|
3
7
|
## Installation
|
|
4
8
|
|
|
5
|
-
To get started, make sure you have [installed Harper](https://docs.harperdb.io/docs/deployments/install-harper)
|
|
9
|
+
To get started, make sure you have [installed Harper](https://docs.harperdb.io/docs/deployments/install-harper):
|
|
6
10
|
|
|
7
11
|
```sh
|
|
8
12
|
npm install -g harperdb
|
|
@@ -16,26 +20,56 @@ Then you can start your app:
|
|
|
16
20
|
npm run dev
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
TypeScript is supported at runtime in Node.js through [type stripping](https://nodejs.org/api/typescript.html#type-stripping). Full TypeScript language support can be enabled through integrating third party build steps to transpile your TypeScript into JavaScript.
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
### Define Your Schema
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
The [schemas/exampleTable.graphql](./schemas/exampleTable.graphql) is an example table schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
Open your [schemas/exampleTable.graphql](./schemas/exampleTable.graphql) to take a look at an example schema. You can add as many table definitions to a single schema file as you want. You can also create one file per schema.
|
|
30
|
+
|
|
31
|
+
These schemas are the heart of a great Harper app. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have. REST endpoints will get stood up for any table that you `@export`.
|
|
32
|
+
|
|
33
|
+
### Add Custom Endpoints
|
|
34
|
+
|
|
35
|
+
The [resources/greeting.ts](./resources/greeting.ts) provides a template for defining TypeScript resource classes, for customized application logic in your endpoints.
|
|
36
|
+
|
|
37
|
+
### View Your Website
|
|
38
|
+
|
|
39
|
+
Pop open [http://localhost:9926](http://localhost:9926) to view [web/index.html](./web/index.html) in your browser.
|
|
40
|
+
|
|
41
|
+
### Use Your API
|
|
42
|
+
|
|
43
|
+
Test your application works by querying the `/Greeting` endpoint:
|
|
26
44
|
|
|
27
|
-
|
|
45
|
+
```sh
|
|
46
|
+
curl http://localhost:9926/Greeting
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
You should see the following:
|
|
28
50
|
|
|
29
|
-
|
|
51
|
+
```json
|
|
52
|
+
{ "greeting": "Hello, world!" }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Configure Your App
|
|
56
|
+
|
|
57
|
+
Take a look at the [default configuration](./config.yaml), which specifies how files are handled in your application.
|
|
30
58
|
|
|
31
59
|
## Deployment
|
|
32
60
|
|
|
33
61
|
When you are ready, head to [https://fabric.harper.fast/](https://fabric.harper.fast/), log in to your account, and create a cluster.
|
|
34
62
|
|
|
35
|
-
Make sure you've configured your [.env](
|
|
63
|
+
Make sure you've configured your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
|
|
36
64
|
|
|
37
65
|
Then you can deploy your app to your cluster:
|
|
38
66
|
|
|
39
67
|
```sh
|
|
40
68
|
npm run deploy
|
|
41
69
|
```
|
|
70
|
+
|
|
71
|
+
## Keep Going!
|
|
72
|
+
|
|
73
|
+
For more information about getting started with Harper and building applications, see our [getting started guide](https://docs.harperdb.io/docs).
|
|
74
|
+
|
|
75
|
+
For more information on Harper Components, see the [Components documentation](https://docs.harperdb.io/docs/reference/components).
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# your-project-name-here
|
|
2
2
|
|
|
3
|
+
Your new app is now ready for development!
|
|
4
|
+
|
|
5
|
+
Here's what you should do next:
|
|
6
|
+
|
|
3
7
|
## Installation
|
|
4
8
|
|
|
5
|
-
To get started, make sure you have [installed Harper](https://docs.harperdb.io/docs/deployments/install-harper)
|
|
9
|
+
To get started, make sure you have [installed Harper](https://docs.harperdb.io/docs/deployments/install-harper):
|
|
6
10
|
|
|
7
11
|
```sh
|
|
8
12
|
npm install -g harperdb
|
|
@@ -16,6 +20,24 @@ Then you can start your app:
|
|
|
16
20
|
npm run dev
|
|
17
21
|
```
|
|
18
22
|
|
|
23
|
+
### Define Your Schema
|
|
24
|
+
|
|
25
|
+
The [schemas/exampleTable.graphql](./schemas/exampleTable.graphql) is an example table schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
|
|
26
|
+
|
|
27
|
+
Open your [schemas/exampleTable.graphql](./schemas/exampleTable.graphql) to take a look at an example schema. You can add as many table definitions to a single schema file as you want. You can also create one file per schema.
|
|
28
|
+
|
|
29
|
+
These schemas are the heart of a great Harper app. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have. REST endpoints will get stood up for any table that you `@export`.
|
|
30
|
+
|
|
31
|
+
### Add Custom Endpoints
|
|
32
|
+
|
|
33
|
+
The [resources/greeting.js](./resources/greeting.js) provides a template for defining JavaScript resource classes, for customized application logic in your endpoints.
|
|
34
|
+
|
|
35
|
+
### View Your Website
|
|
36
|
+
|
|
37
|
+
Pop open [http://localhost:9926](http://localhost:9926) to view [web/index.html](./web/index.html) in your browser.
|
|
38
|
+
|
|
39
|
+
### Use Your API
|
|
40
|
+
|
|
19
41
|
Test your application works by querying the `/Greeting` endpoint:
|
|
20
42
|
|
|
21
43
|
```sh
|
|
@@ -28,26 +50,24 @@ You should see the following:
|
|
|
28
50
|
{ "greeting": "Hello, world!" }
|
|
29
51
|
```
|
|
30
52
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
For more information about getting started with HarperDB and building applications, see our [getting started guide](https://docs.harperdb.io/docs).
|
|
34
|
-
|
|
35
|
-
For more information on Harper Components, see the [Components documentation](https://docs.harperdb.io/docs/reference/components).
|
|
53
|
+
### Configure Your App
|
|
36
54
|
|
|
37
55
|
Take a look at the [default configuration](./config.yaml), which specifies how files are handled in your application.
|
|
38
56
|
|
|
39
|
-
The [schemas/exampleTable.graphql](schemas/exampleTable.graphql) is an example table schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
|
|
40
|
-
|
|
41
|
-
The [resources/greeting.js](resources/greeting.js) provides a template for defining JavaScript resource classes, for customized application logic in your endpoints.
|
|
42
|
-
|
|
43
57
|
## Deployment
|
|
44
58
|
|
|
45
59
|
When you are ready, head to [https://fabric.harper.fast/](https://fabric.harper.fast/), log in to your account, and create a cluster.
|
|
46
60
|
|
|
47
|
-
Make sure you've configured your [.env](
|
|
61
|
+
Make sure you've configured your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
|
|
48
62
|
|
|
49
63
|
Then you can deploy your app to your cluster:
|
|
50
64
|
|
|
51
65
|
```sh
|
|
52
66
|
npm run deploy
|
|
53
67
|
```
|
|
68
|
+
|
|
69
|
+
## Keep Going!
|
|
70
|
+
|
|
71
|
+
For more information about getting started with Harper and building applications, see our [getting started guide](https://docs.harperdb.io/docs).
|
|
72
|
+
|
|
73
|
+
For more information on Harper Components, see the [Components documentation](https://docs.harperdb.io/docs/reference/components).
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# your-project-name-here
|
|
2
2
|
|
|
3
|
+
Your new app is now ready for development!
|
|
4
|
+
|
|
5
|
+
Here's what you should do next:
|
|
6
|
+
|
|
3
7
|
## Installation
|
|
4
8
|
|
|
5
|
-
To get started, make sure you have [installed Harper](https://docs.harperdb.io/docs/deployments/install-harper)
|
|
9
|
+
To get started, make sure you have [installed Harper](https://docs.harperdb.io/docs/deployments/install-harper):
|
|
6
10
|
|
|
7
11
|
```sh
|
|
8
12
|
npm install -g harperdb
|
|
@@ -16,6 +20,26 @@ Then you can start your app:
|
|
|
16
20
|
npm run dev
|
|
17
21
|
```
|
|
18
22
|
|
|
23
|
+
TypeScript is supported at runtime in Node.js through [type stripping](https://nodejs.org/api/typescript.html#type-stripping). Full TypeScript language support can be enabled through integrating third party build steps to transpile your TypeScript into JavaScript.
|
|
24
|
+
|
|
25
|
+
### Define Your Schema
|
|
26
|
+
|
|
27
|
+
The [schemas/exampleTable.graphql](./schemas/exampleTable.graphql) is an example table schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
|
|
28
|
+
|
|
29
|
+
Open your [schemas/exampleTable.graphql](./schemas/exampleTable.graphql) to take a look at an example schema. You can add as many table definitions to a single schema file as you want. You can also create one file per schema.
|
|
30
|
+
|
|
31
|
+
These schemas are the heart of a great Harper app. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have. REST endpoints will get stood up for any table that you `@export`.
|
|
32
|
+
|
|
33
|
+
### Add Custom Endpoints
|
|
34
|
+
|
|
35
|
+
The [resources/greeting.ts](./resources/greeting.ts) provides a template for defining TypeScript resource classes, for customized application logic in your endpoints.
|
|
36
|
+
|
|
37
|
+
### View Your Website
|
|
38
|
+
|
|
39
|
+
Pop open [http://localhost:9926](http://localhost:9926) to view [web/index.html](./web/index.html) in your browser.
|
|
40
|
+
|
|
41
|
+
### Use Your API
|
|
42
|
+
|
|
19
43
|
Test your application works by querying the `/Greeting` endpoint:
|
|
20
44
|
|
|
21
45
|
```sh
|
|
@@ -28,26 +52,24 @@ You should see the following:
|
|
|
28
52
|
{ "greeting": "Hello, world!" }
|
|
29
53
|
```
|
|
30
54
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
For more information about getting started with HarperDB and building applications, see our [getting started guide](https://docs.harperdb.io/docs).
|
|
34
|
-
|
|
35
|
-
For more information on Harper Components, see the [Components documentation](https://docs.harperdb.io/docs/reference/components).
|
|
55
|
+
### Configure Your App
|
|
36
56
|
|
|
37
57
|
Take a look at the [default configuration](./config.yaml), which specifies how files are handled in your application.
|
|
38
58
|
|
|
39
|
-
The [schemas/exampleTable.graphql](schemas/exampleTable.graphql) is an example table schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
|
|
40
|
-
|
|
41
|
-
The [resources/greeting.ts](resources/greeting.ts) provides a template for defining TypeScript resource classes, for customized application logic in your endpoints.
|
|
42
|
-
|
|
43
59
|
## Deployment
|
|
44
60
|
|
|
45
61
|
When you are ready, head to [https://fabric.harper.fast/](https://fabric.harper.fast/), log in to your account, and create a cluster.
|
|
46
62
|
|
|
47
|
-
Make sure you've configured your [.env](
|
|
63
|
+
Make sure you've configured your [.env](./.env) file with your secure cluster credentials. Don't commit this file to source control!
|
|
48
64
|
|
|
49
65
|
Then you can deploy your app to your cluster:
|
|
50
66
|
|
|
51
67
|
```sh
|
|
52
68
|
npm run deploy
|
|
53
69
|
```
|
|
70
|
+
|
|
71
|
+
## Keep Going!
|
|
72
|
+
|
|
73
|
+
For more information about getting started with Harper and building applications, see our [getting started guide](https://docs.harperdb.io/docs).
|
|
74
|
+
|
|
75
|
+
For more information on Harper Components, see the [Components documentation](https://docs.harperdb.io/docs/reference/components).
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Reads a template file, applies string substitutions, and writes the result to a target path.
|
|
5
|
-
*
|
|
6
|
-
* @param {string} targetPath - The path where the processed file will be written.
|
|
7
|
-
* @param {string} templatePath - The path to the source template file.
|
|
8
|
-
* @param {Record<string, string>} substitutions - A mapping of strings to replace in the file content.
|
|
9
|
-
*/
|
|
10
|
-
export function applyAndWriteTemplateFile(targetPath, templatePath, substitutions) {
|
|
11
|
-
let updatedContent = fs.readFileSync(templatePath, 'utf-8');
|
|
12
|
-
for (const variableName in substitutions) {
|
|
13
|
-
updatedContent = updatedContent.replaceAll(variableName, substitutions[variableName]);
|
|
14
|
-
}
|
|
15
|
-
fs.writeFileSync(targetPath, updatedContent);
|
|
16
|
-
}
|
package/lib/fs/copy.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import { copyDir } from './copyDir.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Copies a file or directory from source to destination.
|
|
6
|
-
*
|
|
7
|
-
* @param {string} src - The source path.
|
|
8
|
-
* @param {string} dest - The destination path.
|
|
9
|
-
*/
|
|
10
|
-
export function copy(src, dest) {
|
|
11
|
-
const stat = fs.statSync(src);
|
|
12
|
-
if (stat.isDirectory()) {
|
|
13
|
-
copyDir(src, dest);
|
|
14
|
-
} else {
|
|
15
|
-
fs.copyFileSync(src, dest);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# your-project-name-here
|
|
2
|
-
|
|
3
|
-
Your new app is now deployed and running on Harper Fabric!
|
|
4
|
-
|
|
5
|
-
Here's what you should do next:
|
|
6
|
-
|
|
7
|
-
### 1. Define Your Schema
|
|
8
|
-
|
|
9
|
-
Open your [schema.graphql](./schema.graphql) and tap [+ New Table](./schema.graphql?ShowNewTableModal=true). This is
|
|
10
|
-
your table schema definition, and is the heart of a great Harper app. This is the main starting point for defining your
|
|
11
|
-
[database schema](./databases), specifying which tables you want and what attributes/fields they should have. REST
|
|
12
|
-
endpoints will get stood up for any table that you `@export`.
|
|
13
|
-
|
|
14
|
-
### 2. Add Custom Endpoints
|
|
15
|
-
|
|
16
|
-
The [resources.js](./resources.js) provides a template for defining JavaScript resource classes for customized
|
|
17
|
-
application logic in your endpoints.
|
|
18
|
-
|
|
19
|
-
### 3. View Your Website
|
|
20
|
-
|
|
21
|
-
Pop open [http://localhost:9926](http://localhost:9926) to view [web/index.html](./web/index.html) in your browser.
|
|
22
|
-
|
|
23
|
-
### 4. Use Your API
|
|
24
|
-
|
|
25
|
-
Head to the [APIs](./apis) tab to explore your endpoints and exercise them. You can click the "Authenticate" button to
|
|
26
|
-
see what different users will be able to access through your API.
|
|
27
|
-
|
|
28
|
-
## Keep Going!
|
|
29
|
-
|
|
30
|
-
For more information about getting started with Harper and building applications, see
|
|
31
|
-
our [getting started guide](https://docs.harperdb.io/docs).
|
|
32
|
-
|
|
33
|
-
For more information on Harper Components, see
|
|
34
|
-
the [Components documentation](https://docs.harperdb.io/docs/reference/components).
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.env
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
.DS_Store
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# https://raw.githubusercontent.com/github/gitignore/refs/heads/main/Node.gitignore
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
# Logs
|
|
8
|
-
logs
|
|
9
|
-
*.log
|
|
10
|
-
npm-debug.log*
|
|
11
|
-
yarn-debug.log*
|
|
12
|
-
yarn-error.log*
|
|
13
|
-
lerna-debug.log*
|
|
14
|
-
|
|
15
|
-
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
16
|
-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
17
|
-
|
|
18
|
-
# Runtime data
|
|
19
|
-
pids
|
|
20
|
-
*.pid
|
|
21
|
-
*.seed
|
|
22
|
-
*.pid.lock
|
|
23
|
-
|
|
24
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
25
|
-
lib-cov
|
|
26
|
-
|
|
27
|
-
# Coverage directory used by tools like istanbul
|
|
28
|
-
coverage
|
|
29
|
-
*.lcov
|
|
30
|
-
|
|
31
|
-
# nyc test coverage
|
|
32
|
-
.nyc_output
|
|
33
|
-
|
|
34
|
-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
35
|
-
.grunt
|
|
36
|
-
|
|
37
|
-
# Bower dependency directory (https://bower.io/)
|
|
38
|
-
bower_components
|
|
39
|
-
|
|
40
|
-
# node-waf configuration
|
|
41
|
-
.lock-wscript
|
|
42
|
-
|
|
43
|
-
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
44
|
-
build/Release
|
|
45
|
-
|
|
46
|
-
# Dependency directories
|
|
47
|
-
node_modules/
|
|
48
|
-
jspm_packages/
|
|
49
|
-
|
|
50
|
-
# Snowpack dependency directory (https://snowpack.dev/)
|
|
51
|
-
web_modules/
|
|
52
|
-
|
|
53
|
-
# TypeScript cache
|
|
54
|
-
*.tsbuildinfo
|
|
55
|
-
|
|
56
|
-
# Optional npm cache directory
|
|
57
|
-
.npm
|
|
58
|
-
|
|
59
|
-
# Optional eslint cache
|
|
60
|
-
.eslintcache
|
|
61
|
-
|
|
62
|
-
# Optional stylelint cache
|
|
63
|
-
.stylelintcache
|
|
64
|
-
|
|
65
|
-
# Optional REPL history
|
|
66
|
-
.node_repl_history
|
|
67
|
-
|
|
68
|
-
# Output of 'npm pack'
|
|
69
|
-
*.tgz
|
|
70
|
-
|
|
71
|
-
# Yarn Integrity file
|
|
72
|
-
.yarn-integrity
|
|
73
|
-
|
|
74
|
-
# dotenv environment variable files
|
|
75
|
-
.env
|
|
76
|
-
.env.*
|
|
77
|
-
!.env.example
|
|
78
|
-
|
|
79
|
-
# parcel-bundler cache (https://parceljs.org/)
|
|
80
|
-
.cache
|
|
81
|
-
.parcel-cache
|
|
82
|
-
|
|
83
|
-
# Next.js build output
|
|
84
|
-
.next
|
|
85
|
-
out
|
|
86
|
-
|
|
87
|
-
# Nuxt.js build / generate output
|
|
88
|
-
.nuxt
|
|
89
|
-
dist
|
|
90
|
-
.output
|
|
91
|
-
|
|
92
|
-
# Gatsby files
|
|
93
|
-
.cache/
|
|
94
|
-
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
95
|
-
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
96
|
-
# public
|
|
97
|
-
|
|
98
|
-
# vuepress build output
|
|
99
|
-
.vuepress/dist
|
|
100
|
-
|
|
101
|
-
# vuepress v2.x temp and cache directory
|
|
102
|
-
.temp
|
|
103
|
-
.cache
|
|
104
|
-
|
|
105
|
-
# Sveltekit cache directory
|
|
106
|
-
.svelte-kit/
|
|
107
|
-
|
|
108
|
-
# vitepress build output
|
|
109
|
-
**/.vitepress/dist
|
|
110
|
-
|
|
111
|
-
# vitepress cache directory
|
|
112
|
-
**/.vitepress/cache
|
|
113
|
-
|
|
114
|
-
# Docusaurus cache and generated files
|
|
115
|
-
.docusaurus
|
|
116
|
-
|
|
117
|
-
# Serverless directories
|
|
118
|
-
.serverless/
|
|
119
|
-
|
|
120
|
-
# FuseBox cache
|
|
121
|
-
.fusebox/
|
|
122
|
-
|
|
123
|
-
# DynamoDB Local files
|
|
124
|
-
.dynamodb/
|
|
125
|
-
|
|
126
|
-
# Firebase cache directory
|
|
127
|
-
.firebase/
|
|
128
|
-
|
|
129
|
-
# TernJS port file
|
|
130
|
-
.tern-port
|
|
131
|
-
|
|
132
|
-
# Stores VSCode versions used for testing VSCode extensions
|
|
133
|
-
.vscode-test
|
|
134
|
-
|
|
135
|
-
# yarn v3
|
|
136
|
-
.pnp.*
|
|
137
|
-
.yarn/*
|
|
138
|
-
!.yarn/patches
|
|
139
|
-
!.yarn/plugins
|
|
140
|
-
!.yarn/releases
|
|
141
|
-
!.yarn/sdks
|
|
142
|
-
!.yarn/versions
|
|
143
|
-
|
|
144
|
-
# Vite files
|
|
145
|
-
vite.config.js.timestamp-*
|
|
146
|
-
vite.config.ts.timestamp-*
|
|
147
|
-
.vite/
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# yaml-language-server: $schema=./node_modules/harperdb/config-app.schema.json
|
|
2
|
-
|
|
3
|
-
# This is the configuration file for the application.
|
|
4
|
-
# It specifies built-in Harper components that will load the specified feature and files.
|
|
5
|
-
# For more information, see https://docs.harperdb.io/docs/reference/components/built-in-extensions
|
|
6
|
-
|
|
7
|
-
# Load Environment Variables from the specified file
|
|
8
|
-
# loadEnv:
|
|
9
|
-
# files: '.env'
|
|
10
|
-
|
|
11
|
-
# This provides the HTTP REST interface for all exported resources
|
|
12
|
-
rest: true
|
|
13
|
-
|
|
14
|
-
# These reads GraphQL schemas to define the schema of database/tables/attributes.
|
|
15
|
-
graphqlSchema:
|
|
16
|
-
files: 'schemas/*.graphql'
|
|
17
|
-
|
|
18
|
-
# Loads JavaScript modules such that their exports are exported as resources
|
|
19
|
-
jsResource:
|
|
20
|
-
files: 'resources/*.js'
|
|
21
|
-
|
|
22
|
-
# Serve the static files from the web directory as a web application
|
|
23
|
-
static:
|
|
24
|
-
files: 'web/*'
|