apibara 2.0.0-beta.40 → 2.0.0-beta.42
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/dist/chunks/add.mjs +44 -0
- package/dist/chunks/init.mjs +41 -0
- package/dist/cli/index.mjs +3 -1
- package/dist/core/index.mjs +0 -1
- package/dist/create/index.d.mts +17 -0
- package/dist/create/index.d.ts +17 -0
- package/dist/create/index.mjs +961 -0
- package/dist/rollup/index.d.mts +1 -0
- package/dist/rollup/index.d.ts +1 -0
- package/package.json +12 -4
- package/src/cli/commands/add.ts +44 -0
- package/src/cli/commands/init.ts +40 -0
- package/src/cli/index.ts +2 -0
- package/src/core/build/error.ts +0 -1
- package/src/create/add.ts +225 -0
- package/src/create/colors.ts +15 -0
- package/src/create/constants.ts +98 -0
- package/src/create/index.ts +2 -0
- package/src/create/init.ts +164 -0
- package/src/create/templates.ts +465 -0
- package/src/create/types.ts +34 -0
- package/src/create/utils.ts +412 -0
- package/src/rollup/index.ts +1 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { addIndexer } from 'apibara/create';
|
|
2
|
+
import { defineCommand } from 'citty';
|
|
3
|
+
|
|
4
|
+
const add = defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "add",
|
|
7
|
+
description: "apibara add helps you add a new indexer to your project with sensible defaults."
|
|
8
|
+
},
|
|
9
|
+
args: {
|
|
10
|
+
indexerId: {
|
|
11
|
+
type: "positional",
|
|
12
|
+
description: "Indexer ID",
|
|
13
|
+
required: false
|
|
14
|
+
},
|
|
15
|
+
chain: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Chain"
|
|
18
|
+
},
|
|
19
|
+
network: {
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "Network"
|
|
22
|
+
},
|
|
23
|
+
storage: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Storage"
|
|
26
|
+
},
|
|
27
|
+
dnaUrl: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "DNA URL"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
async run({ args }) {
|
|
33
|
+
const { indexerId, chain, network, storage, dnaUrl } = args;
|
|
34
|
+
await addIndexer({
|
|
35
|
+
argIndexerId: indexerId,
|
|
36
|
+
argChain: chain,
|
|
37
|
+
argNetwork: network,
|
|
38
|
+
argStorage: storage,
|
|
39
|
+
argDnaUrl: dnaUrl
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export { add as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { initializeProject } from 'apibara/create';
|
|
2
|
+
import { defineCommand } from 'citty';
|
|
3
|
+
|
|
4
|
+
const init = defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "init",
|
|
7
|
+
description: "Initialize a new Apibara project"
|
|
8
|
+
},
|
|
9
|
+
args: {
|
|
10
|
+
dir: {
|
|
11
|
+
type: "positional",
|
|
12
|
+
description: "Target path to initialize the project",
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
language: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Language to use: typescript, ts or javascript, js",
|
|
18
|
+
default: "ts",
|
|
19
|
+
alias: "l"
|
|
20
|
+
},
|
|
21
|
+
"no-create-indexer": {
|
|
22
|
+
type: "boolean",
|
|
23
|
+
description: "Do not create an indexer after initialization",
|
|
24
|
+
default: false
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
async run({ args }) {
|
|
28
|
+
const {
|
|
29
|
+
dir: targetDir,
|
|
30
|
+
"no-create-indexer": noCreateIndexer,
|
|
31
|
+
language
|
|
32
|
+
} = args;
|
|
33
|
+
await initializeProject({
|
|
34
|
+
argTargetDir: targetDir,
|
|
35
|
+
argLanguage: language,
|
|
36
|
+
argNoCreateIndexer: noCreateIndexer
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export { init as default };
|
package/dist/cli/index.mjs
CHANGED
|
@@ -11,7 +11,9 @@ const mainCli = defineCommand({
|
|
|
11
11
|
dev: () => import('../chunks/dev.mjs').then((r) => r.default),
|
|
12
12
|
build: () => import('../chunks/build.mjs').then((r) => r.default),
|
|
13
13
|
start: () => import('../chunks/start.mjs').then((r) => r.default),
|
|
14
|
-
prepare: () => import('../chunks/prepare.mjs').then((r) => r.default)
|
|
14
|
+
prepare: () => import('../chunks/prepare.mjs').then((r) => r.default),
|
|
15
|
+
init: () => import('../chunks/init.mjs').then((r) => r.default),
|
|
16
|
+
add: () => import('../chunks/add.mjs').then((r) => r.default)
|
|
15
17
|
}
|
|
16
18
|
});
|
|
17
19
|
runMain(mainCli);
|
package/dist/core/index.mjs
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Options$1 = {
|
|
2
|
+
argIndexerId?: string;
|
|
3
|
+
argChain?: string;
|
|
4
|
+
argNetwork?: string;
|
|
5
|
+
argStorage?: string;
|
|
6
|
+
argDnaUrl?: string;
|
|
7
|
+
};
|
|
8
|
+
declare function addIndexer({ argIndexerId, argChain, argNetwork, argStorage, argDnaUrl, }: Options$1): Promise<void>;
|
|
9
|
+
|
|
10
|
+
type Options = {
|
|
11
|
+
argTargetDir: string;
|
|
12
|
+
argLanguage?: string;
|
|
13
|
+
argNoCreateIndexer?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare function initializeProject({ argTargetDir, argLanguage, argNoCreateIndexer, }: Options): Promise<void>;
|
|
16
|
+
|
|
17
|
+
export { addIndexer, initializeProject };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Options$1 = {
|
|
2
|
+
argIndexerId?: string;
|
|
3
|
+
argChain?: string;
|
|
4
|
+
argNetwork?: string;
|
|
5
|
+
argStorage?: string;
|
|
6
|
+
argDnaUrl?: string;
|
|
7
|
+
};
|
|
8
|
+
declare function addIndexer({ argIndexerId, argChain, argNetwork, argStorage, argDnaUrl, }: Options$1): Promise<void>;
|
|
9
|
+
|
|
10
|
+
type Options = {
|
|
11
|
+
argTargetDir: string;
|
|
12
|
+
argLanguage?: string;
|
|
13
|
+
argNoCreateIndexer?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare function initializeProject({ argTargetDir, argLanguage, argNoCreateIndexer, }: Options): Promise<void>;
|
|
16
|
+
|
|
17
|
+
export { addIndexer, initializeProject };
|