create-harper 0.0.4 → 0.0.5
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/index.js +21 -20
- package/lib/constants/defaultEnv.js +3 -0
- package/lib/constants/exampleFiles.js +22 -0
- package/lib/constants/frameworks.js +1 -13
- package/lib/constants/templates.js +2 -2
- package/lib/fs/crawlTemplateDir.js +9 -3
- package/lib/steps/getEnvVars.js +57 -6
- package/lib/steps/getExamples.js +48 -0
- package/lib/steps/getTemplate.js +4 -4
- package/lib/steps/helpAgents.js +15 -0
- package/lib/steps/scaffoldProject.js +3 -2
- package/package.json +1 -2
- package/template-react/config.yaml +2 -2
- package/template-react/resources/exampleSocket.js +34 -0
- package/template-react/resources/exampleTable.js +14 -0
- package/template-react/resources/greeting.js +10 -0
- package/{template-studio/schema.graphql → template-react/schemas/exampleTable.graphql} +1 -1
- package/template-react-ts/config.yaml +2 -2
- package/template-react-ts/resources/exampleSocket.ts +41 -0
- package/template-react-ts/resources/exampleTable.ts +20 -0
- package/template-react-ts/{resources.ts → resources/greeting.ts} +0 -23
- package/{template-vanilla/schema.graphql → template-react-ts/schemas/exampleTable.graphql} +1 -1
- package/template-studio/config.yaml +2 -2
- package/template-studio/resources/exampleSocket.js +34 -0
- package/template-studio/resources/exampleTable.js +14 -0
- package/template-studio/resources/greeting.js +10 -0
- package/{template-vanilla-ts/schema.graphql → template-studio/schemas/exampleTable.graphql} +1 -1
- package/template-studio-ts/config.yaml +2 -2
- package/template-studio-ts/resources/exampleSocket.ts +41 -0
- package/template-studio-ts/resources/exampleTable.ts +20 -0
- package/{template-vanilla-ts/resources.ts → template-studio-ts/resources/greeting.ts} +0 -23
- package/template-studio-ts/{schema.graphql → schemas/exampleTable.graphql} +1 -1
- package/template-vanilla/README.md +1 -1
- package/template-vanilla/config.yaml +2 -2
- package/template-vanilla/resources/exampleSocket.js +34 -0
- package/template-vanilla/resources/exampleTable.js +14 -0
- package/template-vanilla/resources/greeting.js +10 -0
- package/template-vanilla/schemas/exampleTable.graphql +7 -0
- package/template-vanilla-ts/README.md +2 -2
- package/template-vanilla-ts/config.yaml +2 -2
- package/template-vanilla-ts/resources/exampleSocket.ts +41 -0
- package/template-vanilla-ts/resources/exampleTable.ts +20 -0
- package/{template-studio-ts/resources.ts → template-vanilla-ts/resources/greeting.ts} +0 -23
- package/template-vanilla-ts/schemas/exampleTable.graphql +7 -0
- package/template-barebones/README.md +0 -7
- package/template-barebones/_aiignore +0 -1
- package/template-barebones/_env +0 -3
- package/template-barebones/_env.example +0 -3
- package/template-barebones/_gitignore +0 -147
- package/template-barebones/config.yaml +0 -7
- package/template-barebones/graphql.config.yml +0 -3
- package/template-barebones/package.json +0 -14
- package/template-barebones/schema.graphql +0 -1
- package/template-react/resources.js +0 -27
- package/template-react/schema.graphql +0 -5
- package/template-react-ts/schema.graphql +0 -5
- package/template-studio/resources.js +0 -27
- package/template-vanilla/resources.js +0 -27
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Resource } from 'harperdb';
|
|
2
|
-
|
|
3
|
-
/** Here we can define any JavaScript-based resources and extensions to tables
|
|
4
|
-
import {tables} from 'harperdb';
|
|
5
|
-
|
|
6
|
-
export class MyCustomResource extends tables.TableName {
|
|
7
|
-
// we can define our own custom POST handler
|
|
8
|
-
post(content) {
|
|
9
|
-
// do something with the incoming content;
|
|
10
|
-
return super.post(content);
|
|
11
|
-
}
|
|
12
|
-
// or custom GET handler
|
|
13
|
-
get() {
|
|
14
|
-
// we can modify this resource before returning
|
|
15
|
-
return super.get();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
*/
|
|
19
|
-
// we can also define a custom resource without a specific table
|
|
20
|
-
export class Greeting extends Resource {
|
|
21
|
-
// a "Hello, world!" handler
|
|
22
|
-
static loadAsInstance = false; // use the updated/newer Resource API
|
|
23
|
-
|
|
24
|
-
get() {
|
|
25
|
-
return { greeting: 'Hello, world!' };
|
|
26
|
-
}
|
|
27
|
-
}
|