dappbooster 3.0.0 → 3.0.2

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.
Files changed (65) hide show
  1. package/dist/app.d.ts +1 -2
  2. package/dist/app.js +25 -24
  3. package/dist/cli.js +2 -2
  4. package/dist/components/Ask.js +11 -0
  5. package/dist/{import/components → components}/Divider.d.ts +1 -1
  6. package/dist/components/Divider.js +4 -0
  7. package/dist/{import/components → components}/MainTitle.d.ts +1 -1
  8. package/dist/components/MainTitle.js +5 -0
  9. package/dist/{import/components → components}/Multiselect/MultiSelect.d.ts +1 -2
  10. package/dist/{import/components → components}/Multiselect/MultiSelect.js +11 -13
  11. package/dist/components/Multiselect/components/Checkbox.d.ts +5 -0
  12. package/dist/components/Multiselect/components/Checkbox.js +5 -0
  13. package/dist/{import/components → components}/Multiselect/components/Indicator.d.ts +1 -2
  14. package/dist/components/Multiselect/components/Indicator.js +5 -0
  15. package/dist/components/Multiselect/components/Item.d.ts +6 -0
  16. package/dist/components/Multiselect/components/Item.js +4 -0
  17. package/dist/{import/components → components}/steps/CloneRepo/CloneRepo.d.ts +1 -1
  18. package/dist/components/steps/CloneRepo/CloneRepo.js +11 -0
  19. package/dist/{import/components → components}/steps/CloneRepo/Commands.d.ts +1 -1
  20. package/dist/components/steps/CloneRepo/Commands.js +16 -0
  21. package/dist/components/steps/FileCleanup.js +43 -0
  22. package/dist/{import/components → components}/steps/Install/CustomInstallation.d.ts +1 -1
  23. package/dist/{import/components → components}/steps/Install/CustomInstallation.js +2 -7
  24. package/dist/{import/components → components}/steps/Install/FullInstallation.d.ts +1 -1
  25. package/dist/components/steps/Install/FullInstallation.js +8 -0
  26. package/dist/components/steps/Install/Install.js +17 -0
  27. package/dist/{import/components → components}/steps/Install/InstallAllPackages.d.ts +1 -1
  28. package/dist/components/steps/Install/InstallAllPackages.js +7 -0
  29. package/dist/components/steps/InstallationMode.js +26 -0
  30. package/dist/{import/components → components}/steps/OptionalPackages.d.ts +3 -2
  31. package/dist/{import/components → components}/steps/OptionalPackages.js +6 -7
  32. package/dist/{import/components → components}/steps/PostInstall.d.ts +1 -1
  33. package/dist/components/steps/PostInstall.js +19 -0
  34. package/dist/{import/components → components}/steps/ProjectName.js +3 -2
  35. package/package.json +1 -1
  36. package/readme.md +9 -4
  37. package/dist/import/components/Ask.js +0 -18
  38. package/dist/import/components/Divider.js +0 -4
  39. package/dist/import/components/MainTitle.js +0 -6
  40. package/dist/import/components/Multiselect/components/Checkbox.d.ts +0 -6
  41. package/dist/import/components/Multiselect/components/Checkbox.js +0 -6
  42. package/dist/import/components/Multiselect/components/Indicator.js +0 -6
  43. package/dist/import/components/Multiselect/components/Item.d.ts +0 -7
  44. package/dist/import/components/Multiselect/components/Item.js +0 -4
  45. package/dist/import/components/steps/CloneRepo/CloneRepo.js +0 -13
  46. package/dist/import/components/steps/CloneRepo/Commands.js +0 -29
  47. package/dist/import/components/steps/FileCleanup.js +0 -72
  48. package/dist/import/components/steps/Install/FullInstallation.js +0 -10
  49. package/dist/import/components/steps/Install/Install.js +0 -29
  50. package/dist/import/components/steps/Install/InstallAllPackages.js +0 -9
  51. package/dist/import/components/steps/InstallationMode.js +0 -28
  52. package/dist/import/components/steps/PostInstall.js +0 -79
  53. /package/dist/{import/components → components}/Ask.d.ts +0 -0
  54. /package/dist/{import/components → components}/Multiselect/index.d.ts +0 -0
  55. /package/dist/{import/components → components}/Multiselect/index.js +0 -0
  56. /package/dist/{import/components → components}/steps/FileCleanup.d.ts +0 -0
  57. /package/dist/{import/components → components}/steps/Install/Install.d.ts +0 -0
  58. /package/dist/{import/components → components}/steps/InstallationMode.d.ts +0 -0
  59. /package/dist/{import/components → components}/steps/ProjectName.d.ts +0 -0
  60. /package/dist/{import/constants → constants}/config.d.ts +0 -0
  61. /package/dist/{import/constants → constants}/config.js +0 -0
  62. /package/dist/{import/types → types}/types.d.ts +0 -0
  63. /package/dist/{import/types → types}/types.js +0 -0
  64. /package/dist/{import/utils → utils}/utils.d.ts +0 -0
  65. /package/dist/{import/utils → utils}/utils.js +0 -0
package/dist/app.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
- declare const App: () => React.JSX.Element;
1
+ declare const App: () => import("react/jsx-runtime").JSX.Element;
3
2
  export default App;
package/dist/app.js CHANGED
@@ -1,39 +1,42 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import { Box } from 'ink';
2
- import React, { useState, useMemo, useCallback } from 'react';
3
- import MainTitle from './import/components/MainTitle.js';
4
- import CloneRepo from './import/components/steps/CloneRepo/CloneRepo.js';
5
- import FileCleanup from './import/components/steps/FileCleanup.js';
6
- import Install from './import/components/steps/Install/Install.js';
7
- import InstallationMode from './import/components/steps/InstallationMode.js';
8
- import OptionalPackages from './import/components/steps/OptionalPackages.js';
9
- import PostInstall from './import/components/steps/PostInstall.js';
10
- import ProjectName from './import/components/steps/ProjectName.js';
11
- import { canShowStep } from './import/utils/utils.js';
3
+ import { useCallback, useMemo, useState } from 'react';
4
+ import MainTitle from './components/MainTitle.js';
5
+ import CloneRepo from './components/steps/CloneRepo/CloneRepo.js';
6
+ import FileCleanup from './components/steps/FileCleanup.js';
7
+ import Install from './components/steps/Install/Install.js';
8
+ import InstallationMode from './components/steps/InstallationMode.js';
9
+ import OptionalPackages from './components/steps/OptionalPackages.js';
10
+ import PostInstall from './components/steps/PostInstall.js';
11
+ import ProjectName from './components/steps/ProjectName.js';
12
+ import { canShowStep } from './utils/utils.js';
12
13
  const App = () => {
13
14
  const [projectName, setProjectName] = useState('');
14
15
  const [currentStep, setCurrentStep] = useState(1);
15
16
  const [setupType, setSetupType] = useState();
16
17
  const [selectedFeatures, setSelectedFeatures] = useState();
17
- const finishStep = useCallback(() => setCurrentStep(currentStep + 1), [currentStep]);
18
+ const finishStep = useCallback(() => setCurrentStep((prevStep) => prevStep + 1), []);
18
19
  const onSelectSetupType = useCallback((item) => setSetupType(item), []);
19
20
  const onSelectSelectedFeatures = useCallback((selectedItems) => setSelectedFeatures([...selectedItems]), []);
20
21
  const steps = useMemo(() => [
21
- React.createElement(ProjectName, { onCompletion: finishStep, onSubmit: setProjectName, projectName: projectName, key: 1 }),
22
- React.createElement(CloneRepo, { onCompletion: finishStep, projectName: projectName, key: 2 }),
23
- React.createElement(InstallationMode, { onCompletion: finishStep, onSelect: onSelectSetupType, key: 3 }),
24
- React.createElement(OptionalPackages, { installation: setupType?.value, onCompletion: finishStep, onSubmit: onSelectSelectedFeatures, key: 4 }),
25
- React.createElement(Install, { installationConfig: {
22
+ _jsx(ProjectName, { onCompletion: finishStep, onSubmit: setProjectName, projectName: projectName }, 1),
23
+ _jsx(CloneRepo, { onCompletion: finishStep, projectName: projectName }, 2),
24
+ _jsx(InstallationMode, { onCompletion: finishStep, onSelect: onSelectSetupType }, 3),
25
+ // TODO: add a skip parameter to all (or most) steps
26
+ // to allow skipping when testing, etc.
27
+ _jsx(OptionalPackages, { onCompletion: finishStep, onSubmit: onSelectSelectedFeatures, skip: setupType?.value === 'full' }, 4),
28
+ _jsx(Install, { installationConfig: {
26
29
  installationType: setupType?.value,
27
30
  selectedFeatures: selectedFeatures,
28
- }, onCompletion: finishStep, projectName: projectName, key: 5 }),
29
- React.createElement(FileCleanup, { installationConfig: {
31
+ }, onCompletion: finishStep, projectName: projectName }, 5),
32
+ _jsx(FileCleanup, { installationConfig: {
30
33
  installationType: setupType?.value,
31
34
  selectedFeatures: selectedFeatures,
32
- }, onCompletion: finishStep, projectName: projectName, key: 6 }),
33
- React.createElement(PostInstall, { projectName: projectName, installationConfig: {
35
+ }, onCompletion: finishStep, projectName: projectName }, 6),
36
+ _jsx(PostInstall, { projectName: projectName, installationConfig: {
34
37
  installationType: setupType?.value,
35
38
  selectedFeatures: selectedFeatures,
36
- }, key: 7 }),
39
+ } }, 7),
37
40
  ], [
38
41
  finishStep,
39
42
  onSelectSelectedFeatures,
@@ -42,8 +45,6 @@ const App = () => {
42
45
  onSelectSetupType,
43
46
  projectName,
44
47
  ]);
45
- return (React.createElement(Box, { flexDirection: 'column', rowGap: 1, width: 80 },
46
- React.createElement(MainTitle, null),
47
- steps.map((item, index) => canShowStep(currentStep, index + 1) && item)));
48
+ return (_jsxs(Box, { flexDirection: 'column', rowGap: 1, width: 80, children: [_jsx(MainTitle, {}), steps.map((item, index) => canShowStep(currentStep, index + 1) && item)] }));
48
49
  };
49
50
  export default App;
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { render } from 'ink';
3
- import React from 'react';
4
4
  import App from './app.js';
5
5
  console.clear();
6
- render(React.createElement(App, null));
6
+ render(_jsx(App, {}));
@@ -0,0 +1,11 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ import TextInput from 'ink-text-input';
4
+ import { useMemo, useState } from 'react';
5
+ import { isAnswerConfirmed } from '../utils/utils.js';
6
+ const Ask = ({ question, onSubmit, answer, tip, errorMessage, placeholder }) => {
7
+ const [input, setInput] = useState('');
8
+ const answered = useMemo(() => isAnswerConfirmed(answer, errorMessage), [answer, errorMessage]);
9
+ return (_jsxs(Box, { flexDirection: 'column', rowGap: 1, children: [_jsxs(Box, { flexDirection: 'column', children: [_jsxs(Box, { children: [_jsxs(Text, { color: 'whiteBright', children: [question, ": "] }), answered ? (_jsx(Text, { bold: true, color: 'green', children: answer })) : (_jsx(TextInput, { onChange: setInput, onSubmit: onSubmit, placeholder: placeholder, value: input }))] }), tip && _jsx(Text, { color: 'gray', children: tip })] }), errorMessage && (_jsx(Text, { bold: true, color: 'red', children: errorMessage }))] }));
10
+ };
11
+ export default Ask;
@@ -1,4 +1,4 @@
1
- import { type FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  declare const Divider: FC<{
3
3
  title: string;
4
4
  }>;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import BaseDivider from 'ink-divider';
3
+ const Divider = ({ title }) => (_jsx(BaseDivider, { titlePadding: 2, titleColor: 'whiteBright', title: title }));
4
+ export default Divider;
@@ -1,3 +1,3 @@
1
- import { type FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  declare const MainTitle: FC;
3
3
  export default MainTitle;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import BigText from 'ink-big-text';
3
+ import Gradient from 'ink-gradient';
4
+ const MainTitle = () => (_jsx(Gradient, { colors: ['#ff438c', '#bb1d79', '#8b46a4', '#6a2581'], children: _jsx(BigText, { lineHeight: 1, font: 'chrome', text: "dAppBooster" }) }));
5
+ export default MainTitle;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import CheckBox from './components/Checkbox.js';
3
2
  import Indicator from './components/Indicator.js';
4
3
  import ItemComponent from './components/Item.js';
@@ -28,6 +27,6 @@ type MultiSelectProps<T> = {
28
27
  onSubmit?: (selectedItems: Item<T>[]) => void;
29
28
  onHighlight?: (highlightedItem: Item<T>) => void;
30
29
  };
31
- declare const MultiSelect: <T>({ items, defaultSelected, focus, initialIndex, indicatorComponent, checkboxComponent, itemComponent, limit, onSelect, onUnselect, onSubmit, onHighlight, }: MultiSelectProps<T>) => React.JSX.Element;
30
+ declare const MultiSelect: <T>({ items, defaultSelected, focus, initialIndex, indicatorComponent, checkboxComponent, itemComponent, limit, onSelect, onUnselect, onSubmit, onHighlight, }: MultiSelectProps<T>) => import("react/jsx-runtime").JSX.Element;
32
31
  export default MultiSelect;
33
32
  export { Indicator, ItemComponent, CheckBox, type Item };
@@ -1,5 +1,6 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
1
2
  import { Box, useInput } from 'ink';
2
- import React, { useCallback, useState } from 'react';
3
+ import { createElement, useCallback, useState } from 'react';
3
4
  import CheckBox from './components/Checkbox.js';
4
5
  import Indicator from './components/Indicator.js';
5
6
  import ItemComponent from './components/Item.js';
@@ -51,18 +52,15 @@ const MultiSelect = ({ items = [], defaultSelected = [], focus = true, initialIn
51
52
  handleSelect(slicedItems[highlightedIndex]);
52
53
  }
53
54
  }, [onHighlight, handleSelect, handleSubmit, slicedItems, highlightedIndex]), { isActive: focus });
54
- return (React.createElement(Box, { flexDirection: "column" }, slicedItems.map((item, index) => {
55
- const key = item.key || item.label;
56
- const isHighlighted = index === highlightedIndex;
57
- const isSelected = includesItems(item, selectedItems);
58
- return (React.createElement(Box, { key: key },
59
- React.createElement(indicatorComponent, { isHighlighted }),
60
- React.createElement(checkboxComponent, { isSelected }),
61
- React.createElement(itemComponent, {
62
- ...item,
63
- isHighlighted,
64
- })));
65
- })));
55
+ return (_jsx(Box, { flexDirection: "column", children: slicedItems.map((item, index) => {
56
+ const key = item.key || item.label;
57
+ const isHighlighted = index === highlightedIndex;
58
+ const isSelected = includesItems(item, selectedItems);
59
+ return (_jsxs(Box, { children: [createElement(indicatorComponent, { isHighlighted }), createElement(checkboxComponent, { isSelected }), createElement(itemComponent, {
60
+ ...item,
61
+ isHighlighted,
62
+ })] }, key));
63
+ }) }));
66
64
  };
67
65
  export default MultiSelect;
68
66
  export { Indicator, ItemComponent, CheckBox };
@@ -0,0 +1,5 @@
1
+ type CheckBoxProps = {
2
+ isSelected: boolean;
3
+ };
4
+ declare const CheckBox: ({ isSelected }: CheckBoxProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default CheckBox;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import figures from 'figures';
3
+ import { Box, Text } from 'ink';
4
+ const CheckBox = ({ isSelected = false }) => (_jsx(Box, { marginRight: 1, children: _jsx(Text, { color: isSelected ? 'green' : 'white', children: isSelected ? figures.circleFilled : figures.circle }) }));
5
+ export default CheckBox;
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
1
  type IndicatorProps = {
3
2
  isHighlighted: boolean;
4
3
  };
5
- declare const Indicator: ({ isHighlighted }: IndicatorProps) => React.JSX.Element;
4
+ declare const Indicator: ({ isHighlighted }: IndicatorProps) => import("react/jsx-runtime").JSX.Element;
6
5
  export default Indicator;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import figures from 'figures';
3
+ import { Box, Text } from 'ink';
4
+ const Indicator = ({ isHighlighted = false }) => (_jsx(Box, { marginRight: 1, children: _jsx(Text, { color: isHighlighted ? 'green' : undefined, children: isHighlighted ? figures.pointer : ' ' }) }));
5
+ export default Indicator;
@@ -0,0 +1,6 @@
1
+ type ItemProps = {
2
+ isHighlighted: boolean;
3
+ label: string;
4
+ };
5
+ declare const Item: ({ isHighlighted, label }: ItemProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default Item;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Text } from 'ink';
3
+ const Item = ({ isHighlighted = false, label }) => (_jsx(Text, { color: isHighlighted ? 'green' : 'white', bold: isHighlighted, children: label }));
4
+ export default Item;
@@ -1,4 +1,4 @@
1
- import { type FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  interface Props {
3
3
  projectName: string;
4
4
  onCompletion: () => void;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Divider from '../../Divider.js';
3
+ import Commands from './Commands.js';
4
+ /**
5
+ * Step for cloning the repository.
6
+ * @param projectName
7
+ * @param onCompletion
8
+ * @constructor
9
+ */
10
+ const CloneRepo = ({ projectName, onCompletion }) => (_jsxs(_Fragment, { children: [_jsx(Divider, { title: 'Git tasks' }), _jsx(Commands, { projectName: projectName, onCompletion: onCompletion })] }));
11
+ export default CloneRepo;
@@ -1,4 +1,4 @@
1
- import { type FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  interface Props {
3
3
  projectName: string;
4
4
  onCompletion: () => void;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { join } from 'node:path';
3
+ import * as process from 'node:process';
4
+ import { Box, Text } from 'ink';
5
+ import { Script, Spawn } from 'ink-spawn';
6
+ import { repoUrl } from '../../../constants/config.js';
7
+ /**
8
+ * Executes all the commands to clone the dAppBooster repository.
9
+ * @param projectName
10
+ * @param onCompletion
11
+ */
12
+ const Commands = ({ projectName, onCompletion }) => {
13
+ const projectFolder = join(process.cwd(), projectName);
14
+ return (_jsx(Box, { flexDirection: 'column', gap: 0, children: _jsxs(Script, { children: [_jsxs(Box, { columnGap: 1, children: [_jsx(Text, { color: 'whiteBright', children: "Cloning dAppBooster in" }), _jsx(Text, { italic: true, children: projectName })] }), _jsx(Spawn, { shell: true, silent: true, successText: 'Done!', failureText: `Failed to clone the project, check if a folder called "${projectName}" already exists and your read/write permissions...`, runningText: 'Working...', command: "git", args: ['clone', '--depth', '1', '--no-checkout', repoUrl, projectName] }), _jsx(Text, { color: 'whiteBright', children: "Fetching tags" }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: 'git', args: ['fetch', '--tags'], runningText: 'Working...', successText: 'Done!', failureText: 'Error...' }), _jsx(Text, { color: 'whiteBright', children: "Checking out latest tag" }), _jsx(Spawn, { shell: true, cwd: projectFolder, command: "git", args: ['checkout $(git describe --tags `git rev-list --tags --max-count=1`)'], successText: "Done!", failureText: 'Error...' }), _jsx(Text, { color: 'whiteBright', children: "Removing .git folder" }), _jsx(Spawn, { shell: true, cwd: projectFolder, command: "rm", args: ['-rf', '.git'], successText: "Done!", failureText: 'Error...' }), _jsx(Text, { color: 'whiteBright', children: "Initializing Git repository" }), _jsx(Spawn, { shell: true, cwd: projectFolder, command: "git", args: ['init'], successText: "Done!", failureText: 'Error...', onCompletion: onCompletion })] }) }));
15
+ };
16
+ export default Commands;
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { readFileSync, writeFileSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { Box, Text } from 'ink';
5
+ import { Script, Spawn } from 'ink-spawn';
6
+ import { useMemo } from 'react';
7
+ import { featureSelected, getProjectFolder } from '../../utils/utils.js';
8
+ import Divider from '../Divider.js';
9
+ const packageJSONCleanup = (projectFolder, selectedFeatures) => {
10
+ const packageJSONPath = join(projectFolder, 'package.json');
11
+ const packageJSON = JSON.parse(readFileSync(packageJSONPath, 'utf8'));
12
+ if (!featureSelected('subgraph', selectedFeatures)) {
13
+ packageJSON.scripts['subgraph-codegen'] = undefined;
14
+ }
15
+ if (!featureSelected('typedoc', selectedFeatures)) {
16
+ packageJSON.scripts['typedoc:build'] = undefined;
17
+ }
18
+ if (!featureSelected('vocs', selectedFeatures)) {
19
+ packageJSON.scripts['docs:build'] = undefined;
20
+ packageJSON.scripts['docs:dev'] = undefined;
21
+ packageJSON.scripts['docs:preview'] = undefined;
22
+ }
23
+ if (!featureSelected('husky', selectedFeatures)) {
24
+ packageJSON.scripts.prepare = undefined;
25
+ }
26
+ writeFileSync(packageJSONPath, `${JSON.stringify(packageJSON, null, 2)}\n`);
27
+ };
28
+ /**
29
+ * Performs file cleanup after the installation process
30
+ * @param onCompletion
31
+ * @param installation
32
+ * @param projectName
33
+ */
34
+ const FileCleanup = ({ onCompletion, installationConfig, projectName }) => {
35
+ const { installationType, selectedFeatures } = installationConfig;
36
+ const projectFolder = useMemo(() => getProjectFolder(projectName), [projectName]);
37
+ const currentHomeFolder = `${projectFolder}/src/components/pageComponents/home`;
38
+ return (_jsxs(_Fragment, { children: [_jsx(Divider, { title: 'File cleanup' }), _jsx(Box, { flexDirection: 'column', gap: 0, children: _jsxs(Script, { children: [installationType === 'custom' && (_jsxs(Script, { onCompletion: () => packageJSONCleanup(projectFolder, selectedFeatures), children: [!featureSelected('demo', selectedFeatures) && (_jsxs(Script, { children: [_jsx(Text, { color: 'whiteBright', children: "Component demos" }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', currentHomeFolder], runningText: 'Removing home files...', successText: 'Done!', failureText: 'Error...' }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "mkdir", args: ['-p', currentHomeFolder], runningText: 'Creating home folder...', successText: 'Done!', failureText: 'Error...' }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "cp", args: ['./.install-files/home/index.tsx', currentHomeFolder], runningText: 'Creating new home page index file...', successText: 'Done!', failureText: 'Error...' })] })), !featureSelected('subgraph', selectedFeatures) && (_jsxs(Script, { children: [_jsx(Text, { color: 'whiteBright', children: "Subgraph" }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', './src/subgraphs'], runningText: 'Removing subgraphs folder...', successText: 'Done!', failureText: 'Error...' }), featureSelected('demo', selectedFeatures) && (_jsxs(Script, { children: [_jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', `${currentHomeFolder}/Examples/demos/subgraphs`], runningText: 'Removing subgraphs demos folder...', successText: 'Done!', failureText: 'Error...' }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: [`${currentHomeFolder}/Examples/index.tsx`], runningText: 'Removing examples index file...', successText: 'Done!', failureText: 'Error...' }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "cp", args: [
39
+ './.install-files/home/Examples/index.tsx',
40
+ `${currentHomeFolder}/Examples/index.tsx`,
41
+ ], runningText: 'Creating new examples index file...', successText: 'Done!', failureText: 'Error...' })] }))] })), !featureSelected('typedoc', selectedFeatures) && (_jsxs(Script, { children: [_jsx(Text, { color: 'whiteBright', children: "Typedoc" }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['./typedoc.json'], runningText: 'Removing config...', successText: 'Done!', failureText: 'Error...' })] })), !featureSelected('vocs', selectedFeatures) && (_jsxs(Script, { children: [_jsx(Text, { color: 'whiteBright', children: "Vocs" }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['./vocs.config.ts'], runningText: 'Removing config...', successText: 'Done!', failureText: 'Error...' }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', './docs'], runningText: 'Removing docs folder...', successText: 'Done!', failureText: 'Error...' })] })), !featureSelected('husky', selectedFeatures) && (_jsxs(Script, { children: [_jsx(Text, { color: 'whiteBright', children: "Husky" }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', './.husky'], runningText: 'Removing Husky folder...', successText: 'Done!', failureText: 'Error...' }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['./.lintstagedrc.mjs'], runningText: 'Removing lint-staged config...', successText: 'Done!', failureText: 'Error...' }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['./commitlint.config.js'], runningText: 'Removing commitlint config...', successText: 'Done!', failureText: 'Error...' })] }))] })), _jsx(Text, { color: 'whiteBright', children: "Install script" }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', './.install-files'], runningText: 'Removing folder...', successText: 'Done!', failureText: 'Error...', onCompletion: onCompletion })] }) })] }));
42
+ };
43
+ export default FileCleanup;
@@ -1,4 +1,4 @@
1
- import { type FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  import type { MultiSelectItem } from '../../../types/types.js';
3
3
  interface Props {
4
4
  onCompletion: () => void;
@@ -1,6 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import { Box, Text } from 'ink';
2
3
  import { Script, Spawn } from 'ink-spawn';
3
- import React from 'react';
4
4
  import { getPackages } from '../../../utils/utils.js';
5
5
  import InstallAllPackages from './InstallAllPackages.js';
6
6
  /**
@@ -21,11 +21,6 @@ const CustomInstallation = ({ onCompletion, selectedFeatures, projectFolder }) =
21
21
  ]
22
22
  .join(' ')
23
23
  .trim();
24
- return (React.createElement(Box, { flexDirection: 'column', gap: 0 }, !packagesToRemove ? (React.createElement(Script, null,
25
- React.createElement(InstallAllPackages, { projectFolder: projectFolder, onCompletion: onCompletion }))) : (React.createElement(Script, null,
26
- React.createElement(Text, { color: 'whiteBright' }, "Installing packages"),
27
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: 'pnpm', args: ['remove', packagesToRemove], runningText: 'Working...', successText: 'Done!', failureText: 'Error...' }),
28
- React.createElement(Text, { color: 'whiteBright' }, "Executing post-install scripts"),
29
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: 'pnpm', args: ['run', 'postinstall'], runningText: 'Working...', successText: 'Done!', failureText: 'Error...', onCompletion: onCompletion })))));
24
+ return (_jsx(Box, { flexDirection: 'column', gap: 0, children: !packagesToRemove ? (_jsx(Script, { children: _jsx(InstallAllPackages, { projectFolder: projectFolder, onCompletion: onCompletion }) })) : (_jsxs(Script, { children: [_jsx(Text, { color: 'whiteBright', children: "Installing packages" }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: 'pnpm', args: ['remove', packagesToRemove], runningText: 'Working...', successText: 'Done!', failureText: 'Error...' }), _jsx(Text, { color: 'whiteBright', children: "Executing post-install scripts" }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: 'pnpm', args: ['run', 'postinstall'], runningText: 'Working...', successText: 'Done!', failureText: 'Error...', onCompletion: onCompletion })] })) }));
30
25
  };
31
26
  export default CustomInstallation;
@@ -1,4 +1,4 @@
1
- import { type FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  interface Props {
3
3
  projectFolder: string;
4
4
  onCompletion?: () => void;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from 'ink';
3
+ import { Script } from 'ink-spawn';
4
+ import InstallAllPackages from './InstallAllPackages.js';
5
+ const FullInstallation = ({ onCompletion, projectFolder }) => {
6
+ return (_jsx(Box, { flexDirection: 'column', gap: 0, children: _jsx(Script, { children: _jsx(InstallAllPackages, { projectFolder: projectFolder, onCompletion: onCompletion }) }) }));
7
+ };
8
+ export default FullInstallation;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ import { Script, Spawn } from 'ink-spawn';
4
+ import { useMemo } from 'react';
5
+ import { getProjectFolder } from '../../../utils/utils.js';
6
+ import Divider from '../../Divider.js';
7
+ import CustomInstallation from './CustomInstallation.js';
8
+ import FullInstallation from './FullInstallation.js';
9
+ const Install = ({ projectName, onCompletion, installationConfig }) => {
10
+ const { installationType, selectedFeatures } = installationConfig;
11
+ const projectFolder = useMemo(() => getProjectFolder(projectName), [projectName]);
12
+ const title = installationType
13
+ ? installationType[0]?.toUpperCase() + installationType.slice(1)
14
+ : '';
15
+ return (_jsxs(_Fragment, { children: [_jsx(Divider, { title: `${title ?? 'Full'} installation` }), _jsx(Box, { flexDirection: 'column', gap: 0, children: _jsxs(Script, { children: [_jsx(Box, { columnGap: 1, children: _jsxs(Text, { color: 'whiteBright', children: ["Creating", ' ', _jsx(Text, { italic: true, color: 'white', children: ".env.local" }), ' ', "file"] }) }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: 'cp', args: ['.env.example', '.env.local'], runningText: 'Working...', successText: 'Done!', failureText: 'Error...' }), installationType === 'full' && (_jsx(FullInstallation, { onCompletion: onCompletion, projectFolder: projectFolder })), installationType === 'custom' && (_jsx(CustomInstallation, { selectedFeatures: selectedFeatures, onCompletion: onCompletion, projectFolder: projectFolder }))] }) })] }));
16
+ };
17
+ export default Install;
@@ -1,4 +1,4 @@
1
- import { type FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  interface Props {
3
3
  onCompletion?: () => void;
4
4
  projectFolder: string;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text } from 'ink';
3
+ import { Spawn } from 'ink-spawn';
4
+ const InstallAllPackages = ({ projectFolder, onCompletion }) => {
5
+ return (_jsxs(_Fragment, { children: [_jsx(Text, { color: 'whiteBright', children: "Installing packages" }), _jsx(Spawn, { shell: true, cwd: projectFolder, silent: true, command: 'pnpm', args: ['i'], runningText: 'Working...', successText: 'Done!', failureText: 'Error...', onCompletion: onCompletion })] }));
6
+ };
7
+ export default InstallAllPackages;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import figures from 'figures';
3
+ import { Text } from 'ink';
4
+ import SelectInput from 'ink-select-input';
5
+ import { useState } from 'react';
6
+ import Divider from '../Divider.js';
7
+ const installationTypeItems = [
8
+ {
9
+ label: 'Full',
10
+ value: 'full',
11
+ },
12
+ {
13
+ label: 'Custom',
14
+ value: 'custom',
15
+ },
16
+ ];
17
+ const InstallationMode = ({ onCompletion, onSelect }) => {
18
+ const [isFocused, setIsFocused] = useState(true);
19
+ const handleSelect = (item) => {
20
+ onSelect(item);
21
+ onCompletion();
22
+ setIsFocused(false);
23
+ };
24
+ return (_jsxs(_Fragment, { children: [_jsx(Divider, { title: 'Installation setup' }), _jsx(Text, { color: 'whiteBright', children: "Choose installation type" }), _jsx(SelectInput, { indicatorComponent: ({ isSelected }) => (_jsx(Text, { color: "green", children: isSelected ? `${figures.pointer} ` : ' ' })), itemComponent: ({ label, isSelected }) => (_jsx(Text, { color: isSelected ? 'green' : 'white', bold: isSelected, children: label })), isFocused: isFocused, items: installationTypeItems, onSelect: handleSelect })] }));
25
+ };
26
+ export default InstallationMode;
@@ -1,15 +1,16 @@
1
1
  import { type FC } from 'react';
2
- import type { InstallationType, MultiSelectItem } from '../../types/types.js';
2
+ import type { MultiSelectItem } from '../../types/types.js';
3
3
  interface Props {
4
- installation: InstallationType | undefined;
5
4
  onCompletion: () => void;
6
5
  onSubmit: (selectedItems: Array<MultiSelectItem>) => void;
6
+ skip?: boolean;
7
7
  }
8
8
  /**
9
9
  * Step for selecting optional packages. Skipped if installation type is 'full'.
10
10
  * @param onCompletion
11
11
  * @param onSubmit
12
12
  * @param installation
13
+ * @param skip
13
14
  */
14
15
  declare const OptionalPackages: FC<Props>;
15
16
  export default OptionalPackages;
@@ -1,5 +1,6 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import { Text } from 'ink';
2
- import React, { useState, useEffect } from 'react';
3
+ import { useEffect, useState } from 'react';
3
4
  import MultiSelect from '../Multiselect/index.js';
4
5
  const customPackages = [
5
6
  {
@@ -28,11 +29,11 @@ const customPackages = [
28
29
  * @param onCompletion
29
30
  * @param onSubmit
30
31
  * @param installation
32
+ * @param skip
31
33
  */
32
- const OptionalPackages = ({ onCompletion, onSubmit, installation }) => {
34
+ const OptionalPackages = ({ onCompletion, onSubmit, skip = false }) => {
33
35
  const [isFocused, setIsFocused] = useState(true);
34
- const skip = installation === 'full';
35
- // biome-ignore lint/correctness/useExhaustiveDependencies: Run this only once
36
+ // biome-ignore lint/correctness/useExhaustiveDependencies: Run this only once, no matter what
36
37
  useEffect(() => {
37
38
  // full installation, do nothing
38
39
  if (skip) {
@@ -44,8 +45,6 @@ const OptionalPackages = ({ onCompletion, onSubmit, installation }) => {
44
45
  setIsFocused(false);
45
46
  onCompletion();
46
47
  };
47
- return skip ? null : (React.createElement(React.Fragment, null,
48
- React.createElement(Text, { color: 'whiteBright' }, "Choose optional packages"),
49
- React.createElement(MultiSelect, { defaultSelected: customPackages, focus: isFocused, items: customPackages, onSubmit: onHandleSubmit })));
48
+ return skip ? null : (_jsxs(_Fragment, { children: [_jsx(Text, { color: 'whiteBright', children: "Choose optional packages" }), _jsx(MultiSelect, { defaultSelected: customPackages, focus: isFocused, items: customPackages, onSubmit: onHandleSubmit })] }));
50
49
  };
51
50
  export default OptionalPackages;
@@ -1,4 +1,4 @@
1
- import { type FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  import type { InstallationType, MultiSelectItem } from '../../types/types.js';
3
3
  interface Props {
4
4
  installationConfig: {
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import figures from 'figures';
3
+ import { Box, Text } from 'ink';
4
+ import Link from 'ink-link';
5
+ import { featureSelected } from '../../utils/utils.js';
6
+ import Divider from '../Divider.js';
7
+ const SubgraphWarningMessage = () => (_jsxs(Box, { flexDirection: 'column', rowGap: 1, children: [_jsx(Box, { alignItems: 'center', borderColor: 'yellow', borderStyle: 'bold', flexDirection: 'column', justifyContent: 'center', padding: 1, children: _jsxs(Text, { color: 'yellow', children: [figures.warning, figures.warning, " ", _jsx(Text, { bold: true, children: "WARNING:" }), " You ", _jsx(Text, { bold: true, children: "MUST" }), " finish the subgraph's configuration manually ", figures.warning, figures.warning] }) }), _jsx(Text, { color: 'whiteBright', children: "Follow these steps:" }), _jsxs(Box, { flexDirection: 'column', children: [_jsxs(Text, { children: ["1- Provide your own API key for ", _jsx(Text, { color: 'gray', children: "PUBLIC_SUBGRAPHS_API_KEY" }), " in", ' ', _jsx(Text, { color: 'gray', children: ".env.local" }), " You can get one", ' ', _jsx(Link, { url: "https://thegraph.com/studio/apikeys", children: "here" })] }), _jsxs(Text, { children: ["2- After the API key is correctly configured, run", ' ', _jsx(Text, { color: 'gray', children: "pnpm subgraph-codegen" }), " in your console from the project's folder"] })] }), _jsxs(Text, { children: ["More configuration info in", ' ', _jsx(Link, { url: 'https://docs.dappbooster.dev/introduction/getting-started', children: "the docs" }), "."] }), _jsxs(Text, { color: 'yellow', bold: true, children: [figures.info, " Only after you have followed the previous steps you may proceed."] })] }));
8
+ const PostInstallMessage = ({ projectName }) => (_jsxs(Box, { flexDirection: 'column', rowGap: 1, paddingBottom: 2, children: [_jsx(Text, { color: 'whiteBright', children: "To start development on your project:" }), _jsxs(Box, { flexDirection: 'column', children: [_jsxs(Text, { children: ["1- Move into the project's folder with ", _jsxs(Text, { color: 'gray', children: ["cd ", projectName] })] }), _jsxs(Text, { children: ["2- Start the development server with ", _jsx(Text, { color: 'gray', children: "pnpm dev" })] })] }), _jsx(Text, { color: 'whiteBright', children: "More info:" }), _jsxs(Box, { flexDirection: 'column', children: [_jsxs(Text, { children: ["- Check out ", _jsx(Text, { color: 'gray', children: ".env.local" }), " for more configurations."] }), _jsxs(Text, { children: ["- Read ", _jsx(Link, { url: "https://docs.dappbooster.dev", children: "the docs" }), " to know more about", ' ', _jsx(Text, { color: 'gray', children: "dAppBooster" }), "!"] }), _jsxs(Text, { children: ["- Report issues with this installer", ' ', _jsx(Link, { url: "https://github.com/BootNodeDev/dAppBoosterInstallScript/issues", children: "here" })] })] })] }));
9
+ /**
10
+ * Component to ask for the project name.
11
+ * @param selectedFeatures
12
+ * @param projectName
13
+ */
14
+ const PostInstall = ({ installationConfig, projectName }) => {
15
+ const { selectedFeatures, installationType } = installationConfig;
16
+ const subgraphSupport = featureSelected('subgraph', selectedFeatures);
17
+ return (_jsxs(_Fragment, { children: [_jsx(Divider, { title: 'Post-install instructions' }), _jsxs(Box, { flexDirection: 'column', rowGap: 2, children: [(subgraphSupport || installationType === 'full') && _jsx(SubgraphWarningMessage, {}), _jsx(PostInstallMessage, { projectName: projectName })] })] }));
18
+ };
19
+ export default PostInstall;
@@ -1,4 +1,5 @@
1
- import React, { useMemo, useCallback } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useMemo } from 'react';
2
3
  import { isValidName } from '../../utils/utils.js';
3
4
  import Ask from '../Ask.js';
4
5
  /**
@@ -20,6 +21,6 @@ const ProjectName = ({ projectName, onSubmit, onCompletion }) => {
20
21
  onCompletion();
21
22
  }
22
23
  }, [onSubmit, onCompletion]);
23
- return (React.createElement(Ask, { answer: projectName, errorMessage: errorMessage, onSubmit: handleSubmit, question: 'Project name', tip: 'Letters (a–z, A–Z), numbers (0–9), and underscores (_) are allowed.' }));
24
+ return (_jsx(Ask, { answer: projectName, errorMessage: errorMessage, onSubmit: handleSubmit, question: 'Project name', tip: 'Letters (a–z, A–Z), numbers (0–9), and underscores (_) are allowed.' }));
24
25
  };
25
26
  export default ProjectName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dappbooster",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "license": "MIT",
5
5
  "bin": "dist/cli.js",
6
6
  "type": "module",
package/readme.md CHANGED
@@ -2,14 +2,19 @@
2
2
 
3
3
  An easy way to install and customize [dAppBooster](https://dappbooster.dev/)
4
4
 
5
+ ## Requirements
6
+
7
+ - Node >= 20
8
+ - pnpm
9
+
5
10
  ## Usage
6
11
 
12
+ <img src="./demo.svg" width="600">
13
+
7
14
  ```shell
8
- $ pnpm dlx dappbooster
15
+ pnpm dlx dappbooster
9
16
  ```
10
17
 
11
- <img src="./demo.svg" width="600">
12
-
13
18
  dAppBooster documentation: https://docs.dappbooster.dev/
14
19
 
15
20
  ## Development
@@ -31,7 +36,7 @@ pnpm i
31
36
  You can run the script by doing
32
37
 
33
38
  ```shell
34
- $ node cli.js
39
+ node cli.js
35
40
  ```
36
41
 
37
42
  ## Releasing new versions to NPM
@@ -1,18 +0,0 @@
1
- import { Box, Text } from 'ink';
2
- import TextInput from 'ink-text-input';
3
- import React, { useMemo, useState } from 'react';
4
- import { isAnswerConfirmed } from '../utils/utils.js';
5
- const Ask = ({ question, onSubmit, answer, tip, errorMessage, placeholder }) => {
6
- const [input, setInput] = useState('');
7
- const answered = useMemo(() => isAnswerConfirmed(answer, errorMessage), [answer, errorMessage]);
8
- return (React.createElement(Box, { flexDirection: 'column', rowGap: 1 },
9
- React.createElement(Box, { flexDirection: 'column' },
10
- React.createElement(Box, null,
11
- React.createElement(Text, { color: 'whiteBright' },
12
- question,
13
- ": "),
14
- answered ? (React.createElement(Text, { bold: true, color: 'green' }, answer)) : (React.createElement(TextInput, { onChange: setInput, onSubmit: onSubmit, placeholder: placeholder, value: input }))),
15
- tip && React.createElement(Text, { color: 'gray' }, tip)),
16
- errorMessage && (React.createElement(Text, { bold: true, color: 'red' }, errorMessage))));
17
- };
18
- export default Ask;
@@ -1,4 +0,0 @@
1
- import BaseDivider from 'ink-divider';
2
- import React from 'react';
3
- const Divider = ({ title }) => (React.createElement(BaseDivider, { titlePadding: 2, titleColor: 'whiteBright', title: title }));
4
- export default Divider;
@@ -1,6 +0,0 @@
1
- import BigText from 'ink-big-text';
2
- import Gradient from 'ink-gradient';
3
- import React from 'react';
4
- const MainTitle = () => (React.createElement(Gradient, { colors: ['#ff438c', '#bb1d79', '#8b46a4', '#6a2581'] },
5
- React.createElement(BigText, { lineHeight: 1, font: 'chrome', text: "dAppBooster" })));
6
- export default MainTitle;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- type CheckBoxProps = {
3
- isSelected: boolean;
4
- };
5
- declare const CheckBox: ({ isSelected }: CheckBoxProps) => React.JSX.Element;
6
- export default CheckBox;
@@ -1,6 +0,0 @@
1
- import figures from 'figures';
2
- import { Box, Text } from 'ink';
3
- import React from 'react';
4
- const CheckBox = ({ isSelected = false }) => (React.createElement(Box, { marginRight: 1 },
5
- React.createElement(Text, { color: isSelected ? 'green' : 'white' }, isSelected ? figures.circleFilled : figures.circle)));
6
- export default CheckBox;
@@ -1,6 +0,0 @@
1
- import figures from 'figures';
2
- import { Box, Text } from 'ink';
3
- import React from 'react';
4
- const Indicator = ({ isHighlighted = false }) => (React.createElement(Box, { marginRight: 1 },
5
- React.createElement(Text, { color: isHighlighted ? 'green' : undefined }, isHighlighted ? figures.pointer : ' ')));
6
- export default Indicator;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- type ItemProps = {
3
- isHighlighted: boolean;
4
- label: string;
5
- };
6
- declare const Item: ({ isHighlighted, label }: ItemProps) => React.JSX.Element;
7
- export default Item;
@@ -1,4 +0,0 @@
1
- import { Text } from 'ink';
2
- import React from 'react';
3
- const Item = ({ isHighlighted = false, label }) => (React.createElement(Text, { color: isHighlighted ? 'green' : 'white', bold: isHighlighted }, label));
4
- export default Item;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import Divider from '../../Divider.js';
3
- import Commands from './Commands.js';
4
- /**
5
- * Step for cloning the repository.
6
- * @param projectName
7
- * @param onCompletion
8
- * @constructor
9
- */
10
- const CloneRepo = ({ projectName, onCompletion }) => (React.createElement(React.Fragment, null,
11
- React.createElement(Divider, { title: 'Git tasks' }),
12
- React.createElement(Commands, { projectName: projectName, onCompletion: onCompletion })));
13
- export default CloneRepo;
@@ -1,29 +0,0 @@
1
- import { join } from 'node:path';
2
- import * as process from 'node:process';
3
- import { Box, Text } from 'ink';
4
- import { Script, Spawn } from 'ink-spawn';
5
- import React from 'react';
6
- import { repoUrl } from '../../../constants/config.js';
7
- /**
8
- * Executes all the commands to clone the dAppBooster repository.
9
- * @param projectName
10
- * @param onCompletion
11
- */
12
- const Commands = ({ projectName, onCompletion }) => {
13
- const projectFolder = join(process.cwd(), projectName);
14
- return (React.createElement(Box, { flexDirection: 'column', gap: 0 },
15
- React.createElement(Script, null,
16
- React.createElement(Box, { columnGap: 1 },
17
- React.createElement(Text, { color: 'whiteBright' }, "Cloning dAppBooster in"),
18
- React.createElement(Text, { italic: true }, projectName)),
19
- React.createElement(Spawn, { shell: true, silent: true, successText: 'Done!', failureText: `Failed to clone the project, check if a folder called "${projectName}" already exists and your read/write permissions...`, runningText: 'Working...', command: "git", args: ['clone', '--depth', '1', '--no-checkout', repoUrl, projectName] }),
20
- React.createElement(Text, { color: 'whiteBright' }, "Fetching tags"),
21
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: 'git', args: ['fetch', '--tags'], runningText: 'Working...', successText: 'Done!', failureText: 'Error...' }),
22
- React.createElement(Text, { color: 'whiteBright' }, "Checking out latest tag"),
23
- React.createElement(Spawn, { shell: true, cwd: projectFolder, command: "git", args: ['checkout $(git describe --tags `git rev-list --tags --max-count=1`)'], successText: "Done!", failureText: 'Error...' }),
24
- React.createElement(Text, { color: 'whiteBright' }, "Removing .git folder"),
25
- React.createElement(Spawn, { shell: true, cwd: projectFolder, command: "rm", args: ['-rf', '.git'], successText: "Done!", failureText: 'Error...' }),
26
- React.createElement(Text, { color: 'whiteBright' }, "Initializing Git repository"),
27
- React.createElement(Spawn, { shell: true, cwd: projectFolder, command: "git", args: ['init'], successText: "Done!", failureText: 'Error...', onCompletion: onCompletion }))));
28
- };
29
- export default Commands;
@@ -1,72 +0,0 @@
1
- import { readFileSync, writeFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { Box, Text } from 'ink';
4
- import { Script, Spawn } from 'ink-spawn';
5
- import React, { useMemo } from 'react';
6
- import { featureSelected, getProjectFolder } from '../../utils/utils.js';
7
- import Divider from '../Divider.js';
8
- const packageJSONCleanup = (projectFolder, selectedFeatures) => {
9
- const packageJSONPath = join(projectFolder, 'package.json');
10
- const packageJSON = JSON.parse(readFileSync(packageJSONPath, 'utf8'));
11
- if (!featureSelected('subgraph', selectedFeatures)) {
12
- packageJSON.scripts['subgraph-codegen'] = undefined;
13
- }
14
- if (!featureSelected('typedoc', selectedFeatures)) {
15
- packageJSON.scripts['typedoc:build'] = undefined;
16
- }
17
- if (!featureSelected('vocs', selectedFeatures)) {
18
- packageJSON.scripts['docs:build'] = undefined;
19
- packageJSON.scripts['docs:dev'] = undefined;
20
- packageJSON.scripts['docs:preview'] = undefined;
21
- }
22
- if (!featureSelected('husky', selectedFeatures)) {
23
- packageJSON.scripts.prepare = undefined;
24
- }
25
- writeFileSync(packageJSONPath, `${JSON.stringify(packageJSON, null, 2)}\n`);
26
- };
27
- /**
28
- * Performs file cleanup after the installation process
29
- * @param onCompletion
30
- * @param installation
31
- * @param projectName
32
- */
33
- const FileCleanup = ({ onCompletion, installationConfig, projectName }) => {
34
- const { installationType, selectedFeatures } = installationConfig;
35
- const projectFolder = useMemo(() => getProjectFolder(projectName), [projectName]);
36
- const currentHomeFolder = `${projectFolder}/src/components/pageComponents/home`;
37
- return (React.createElement(React.Fragment, null,
38
- React.createElement(Divider, { title: 'File cleanup' }),
39
- React.createElement(Box, { flexDirection: 'column', gap: 0 },
40
- React.createElement(Script, null,
41
- installationType === 'custom' && (React.createElement(Script, { onCompletion: () => packageJSONCleanup(projectFolder, selectedFeatures) },
42
- !featureSelected('demo', selectedFeatures) && (React.createElement(Script, null,
43
- React.createElement(Text, { color: 'whiteBright' }, "Component demos"),
44
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', currentHomeFolder], runningText: 'Removing home files...', successText: 'Done!', failureText: 'Error...' }),
45
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "mkdir", args: ['-p', currentHomeFolder], runningText: 'Creating home folder...', successText: 'Done!', failureText: 'Error...' }),
46
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "cp", args: ['./.install-files/home/index.tsx', currentHomeFolder], runningText: 'Creating new home page file...', successText: 'Done!', failureText: 'Error...' }))),
47
- !featureSelected('subgraph', selectedFeatures) && (React.createElement(Script, null,
48
- React.createElement(Text, { color: 'whiteBright' }, "Subgraph"),
49
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', './src/subgraphs'], runningText: 'Removing subgraphs folder...', successText: 'Done!', failureText: 'Error...' }),
50
- featureSelected('demo', selectedFeatures) && (React.createElement(Script, null,
51
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', `${currentHomeFolder}/Examples/demos/subgraphs`], runningText: 'Removing subgraphs demos folder...', successText: 'Done!', failureText: 'Error...' }),
52
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: [`${currentHomeFolder}/index.tsx`], runningText: 'Removing home page file...', successText: 'Done!', failureText: 'Error...' }),
53
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "cp", args: [
54
- './.install-files/home/Examples/index.tsx',
55
- `${currentHomeFolder}/index.tsx`,
56
- ], runningText: 'Creating new home page file...', successText: 'Done!', failureText: 'Error...' }))))),
57
- !featureSelected('typedoc', selectedFeatures) && (React.createElement(Script, null,
58
- React.createElement(Text, { color: 'whiteBright' }, "Typedoc"),
59
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['./typedoc.json'], runningText: 'Removing config...', successText: 'Done!', failureText: 'Error...' }))),
60
- !featureSelected('vocs', selectedFeatures) && (React.createElement(Script, null,
61
- React.createElement(Text, { color: 'whiteBright' }, "Vocs"),
62
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['./vocs.config.ts'], runningText: 'Removing config...', successText: 'Done!', failureText: 'Error...' }),
63
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', './docs'], runningText: 'Removing docs folder...', successText: 'Done!', failureText: 'Error...' }))),
64
- !featureSelected('husky', selectedFeatures) && (React.createElement(Script, null,
65
- React.createElement(Text, { color: 'whiteBright' }, "Husky"),
66
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', './.husky'], runningText: 'Removing Husky folder...', successText: 'Done!', failureText: 'Error...' }),
67
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['./.lintstagedrc.mjs'], runningText: 'Removing lint-staged config...', successText: 'Done!', failureText: 'Error...' }),
68
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['./commitlint.config.js'], runningText: 'Removing commitlint config...', successText: 'Done!', failureText: 'Error...' }))))),
69
- React.createElement(Text, { color: 'whiteBright' }, "Install script"),
70
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: "rm", args: ['-rf', './.install-files'], runningText: 'Removing folder...', successText: 'Done!', failureText: 'Error...', onCompletion: onCompletion })))));
71
- };
72
- export default FileCleanup;
@@ -1,10 +0,0 @@
1
- import { Box } from 'ink';
2
- import { Script } from 'ink-spawn';
3
- import React from 'react';
4
- import InstallAllPackages from './InstallAllPackages.js';
5
- const FullInstallation = ({ onCompletion, projectFolder }) => {
6
- return (React.createElement(Box, { flexDirection: 'column', gap: 0 },
7
- React.createElement(Script, null,
8
- React.createElement(InstallAllPackages, { projectFolder: projectFolder, onCompletion: onCompletion }))));
9
- };
10
- export default FullInstallation;
@@ -1,29 +0,0 @@
1
- import { Box, Text } from 'ink';
2
- import { Script, Spawn } from 'ink-spawn';
3
- import React, { useMemo } from 'react';
4
- import { getProjectFolder } from '../../../utils/utils.js';
5
- import Divider from '../../Divider.js';
6
- import CustomInstallation from './CustomInstallation.js';
7
- import FullInstallation from './FullInstallation.js';
8
- const Install = ({ projectName, onCompletion, installationConfig }) => {
9
- const { installationType, selectedFeatures } = installationConfig;
10
- const projectFolder = useMemo(() => getProjectFolder(projectName), [projectName]);
11
- const title = installationType
12
- ? installationType[0]?.toUpperCase() + installationType.slice(1)
13
- : '';
14
- return (React.createElement(React.Fragment, null,
15
- React.createElement(Divider, { title: `${title ?? 'Full'} installation` }),
16
- React.createElement(Box, { flexDirection: 'column', gap: 0 },
17
- React.createElement(Script, null,
18
- React.createElement(Box, { columnGap: 1 },
19
- React.createElement(Text, { color: 'whiteBright' },
20
- "Creating",
21
- ' ',
22
- React.createElement(Text, { italic: true, color: 'white' }, ".env.local"),
23
- ' ',
24
- "file")),
25
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: 'cp', args: ['.env.example', '.env.local'], runningText: 'Working...', successText: 'Done!', failureText: 'Error...' }),
26
- installationType === 'full' && (React.createElement(FullInstallation, { onCompletion: onCompletion, projectFolder: projectFolder })),
27
- installationType === 'custom' && (React.createElement(CustomInstallation, { selectedFeatures: selectedFeatures, onCompletion: onCompletion, projectFolder: projectFolder }))))));
28
- };
29
- export default Install;
@@ -1,9 +0,0 @@
1
- import { Text } from 'ink';
2
- import { Spawn } from 'ink-spawn';
3
- import React from 'react';
4
- const InstallAllPackages = ({ projectFolder, onCompletion }) => {
5
- return (React.createElement(React.Fragment, null,
6
- React.createElement(Text, { color: 'whiteBright' }, "Installing packages"),
7
- React.createElement(Spawn, { shell: true, cwd: projectFolder, silent: true, command: 'pnpm', args: ['i'], runningText: 'Working...', successText: 'Done!', failureText: 'Error...', onCompletion: onCompletion })));
8
- };
9
- export default InstallAllPackages;
@@ -1,28 +0,0 @@
1
- import figures from 'figures';
2
- import { Text } from 'ink';
3
- import SelectInput from 'ink-select-input';
4
- import React, { useState } from 'react';
5
- import Divider from '../Divider.js';
6
- const installationTypeItems = [
7
- {
8
- label: 'Full',
9
- value: 'full',
10
- },
11
- {
12
- label: 'Custom',
13
- value: 'custom',
14
- },
15
- ];
16
- const InstallationMode = ({ onCompletion, onSelect }) => {
17
- const [isFocused, setIsFocused] = useState(true);
18
- const handleSelect = (item) => {
19
- onSelect(item);
20
- onCompletion();
21
- setIsFocused(false);
22
- };
23
- return (React.createElement(React.Fragment, null,
24
- React.createElement(Divider, { title: 'Installation setup' }),
25
- React.createElement(Text, { color: 'whiteBright' }, "Choose installation type"),
26
- React.createElement(SelectInput, { indicatorComponent: ({ isSelected }) => (React.createElement(Text, { color: "green" }, isSelected ? `${figures.pointer} ` : ' ')), itemComponent: ({ label, isSelected }) => (React.createElement(Text, { color: isSelected ? 'green' : 'white', bold: isSelected }, label)), isFocused: isFocused, items: installationTypeItems, onSelect: handleSelect })));
27
- };
28
- export default InstallationMode;
@@ -1,79 +0,0 @@
1
- import figures from 'figures';
2
- import { Box, Text } from 'ink';
3
- import Link from 'ink-link';
4
- import React from 'react';
5
- import { featureSelected } from '../../utils/utils.js';
6
- import Divider from '../Divider.js';
7
- const SubgraphWarningMessage = () => (React.createElement(Box, { flexDirection: 'column', rowGap: 1 },
8
- React.createElement(Box, { alignItems: 'center', borderColor: 'yellow', borderStyle: 'bold', flexDirection: 'column', justifyContent: 'center', padding: 1 },
9
- React.createElement(Text, { color: 'yellow' },
10
- figures.warning,
11
- figures.warning,
12
- " ",
13
- React.createElement(Text, { bold: true }, "WARNING:"),
14
- " You ",
15
- React.createElement(Text, { bold: true }, "MUST"),
16
- " finish the subgraph's configuration manually ",
17
- figures.warning,
18
- figures.warning)),
19
- React.createElement(Text, { bold: true }, "Follow these steps:"),
20
- React.createElement(Box, { flexDirection: 'column' },
21
- React.createElement(Text, null,
22
- "1- Provide your own API key for ",
23
- React.createElement(Text, { bold: true }, "PUBLIC_SUBGRAPHS_API_KEY"),
24
- " in",
25
- ' ',
26
- React.createElement(Text, { bold: true }, ".env.local"),
27
- " You can get one at",
28
- ' ',
29
- React.createElement(Link, { url: "https://thegraph.com/studio/apikeys" }, "https://thegraph.com/studio/apikeys")),
30
- React.createElement(Text, null,
31
- "2- After the API key is correctly configured, run ",
32
- React.createElement(Text, { bold: true }, "pnpm subgraph-codegen"),
33
- " in your console from the project's folder")),
34
- React.createElement(Text, null,
35
- "More configuration info in",
36
- ' ',
37
- React.createElement(Link, { url: 'https://docs.dappbooster.dev/introduction/getting-started' }, "the docs"),
38
- "."),
39
- React.createElement(Text, { color: 'yellow', bold: true },
40
- figures.info,
41
- " Only after you have followed the previous steps you may proceed.")));
42
- const PostInstallMessage = ({ projectName }) => (React.createElement(Box, { flexDirection: 'column', rowGap: 1, paddingBottom: 2 },
43
- React.createElement(Text, { bold: true }, "To start development on your project:"),
44
- React.createElement(Box, { flexDirection: 'column' },
45
- React.createElement(Text, null,
46
- "1- Move into the project's folder with ",
47
- React.createElement(Text, { bold: true },
48
- "cd ",
49
- projectName)),
50
- React.createElement(Text, null,
51
- "2- Start the development server with ",
52
- React.createElement(Text, { bold: true }, "pnpm dev"))),
53
- React.createElement(Text, { bold: true }, "More info:"),
54
- React.createElement(Box, { flexDirection: 'column' },
55
- React.createElement(Text, null,
56
- "- Check out ",
57
- React.createElement(Text, { bold: true }, ".env.local"),
58
- " for more configurations."),
59
- React.createElement(Text, null,
60
- "- Read the docs at",
61
- ' ',
62
- React.createElement(Link, { url: "https://docs.dappbooster.dev" }, "https://docs.dappbooster.dev"),
63
- " to know more about ",
64
- React.createElement(Text, { bold: true }, "dAppBooster")))));
65
- /**
66
- * Component to ask for the project name.
67
- * @param selectedFeatures
68
- * @param projectName
69
- */
70
- const PostInstall = ({ installationConfig, projectName }) => {
71
- const { selectedFeatures, installationType } = installationConfig;
72
- const subgraphSupport = featureSelected('subgraph', selectedFeatures);
73
- return (React.createElement(React.Fragment, null,
74
- React.createElement(Divider, { title: 'Post-install instructions' }),
75
- React.createElement(Box, { flexDirection: 'column', rowGap: 2 },
76
- (subgraphSupport || installationType === 'full') && React.createElement(SubgraphWarningMessage, null),
77
- React.createElement(PostInstallMessage, { projectName: projectName }))));
78
- };
79
- export default PostInstall;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes