dappbooster 2.0.0 → 3.0.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/dist/app.d.ts +3 -0
- package/dist/app.js +49 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +6 -0
- package/dist/import/components/Ask.d.ts +11 -0
- package/dist/import/components/Ask.js +18 -0
- package/dist/import/components/Divider.d.ts +5 -0
- package/dist/import/components/Divider.js +4 -0
- package/dist/import/components/MainTitle.d.ts +3 -0
- package/dist/import/components/MainTitle.js +6 -0
- package/dist/import/components/Multiselect/MultiSelect.d.ts +33 -0
- package/dist/import/components/Multiselect/MultiSelect.js +68 -0
- package/dist/import/components/Multiselect/components/Checkbox.d.ts +6 -0
- package/dist/import/components/Multiselect/components/Checkbox.js +6 -0
- package/dist/import/components/Multiselect/components/Indicator.d.ts +6 -0
- package/dist/import/components/Multiselect/components/Indicator.js +6 -0
- package/dist/import/components/Multiselect/components/Item.d.ts +7 -0
- package/dist/import/components/Multiselect/components/Item.js +4 -0
- package/dist/import/components/Multiselect/index.d.ts +1 -0
- package/dist/import/components/Multiselect/index.js +1 -0
- package/dist/import/components/steps/CloneRepo/CloneRepo.d.ts +13 -0
- package/dist/import/components/steps/CloneRepo/CloneRepo.js +13 -0
- package/dist/import/components/steps/CloneRepo/Commands.d.ts +12 -0
- package/dist/import/components/steps/CloneRepo/Commands.js +29 -0
- package/dist/import/components/steps/FileCleanup.d.ts +18 -0
- package/dist/import/components/steps/FileCleanup.js +72 -0
- package/dist/import/components/steps/Install/CustomInstallation.d.ts +16 -0
- package/dist/import/components/steps/Install/CustomInstallation.js +31 -0
- package/dist/import/components/steps/Install/FullInstallation.d.ts +7 -0
- package/dist/import/components/steps/Install/FullInstallation.js +10 -0
- package/dist/import/components/steps/Install/Install.d.ts +12 -0
- package/dist/import/components/steps/Install/Install.js +29 -0
- package/dist/import/components/steps/Install/InstallAllPackages.d.ts +7 -0
- package/dist/import/components/steps/Install/InstallAllPackages.js +9 -0
- package/dist/import/components/steps/InstallationMode.d.ts +8 -0
- package/dist/import/components/steps/InstallationMode.js +28 -0
- package/dist/import/components/steps/OptionalPackages.d.ts +15 -0
- package/dist/import/components/steps/OptionalPackages.js +51 -0
- package/dist/import/components/steps/PostInstall.d.ts +16 -0
- package/dist/import/components/steps/PostInstall.js +79 -0
- package/dist/import/components/steps/ProjectName.d.ts +14 -0
- package/dist/import/components/steps/ProjectName.js +25 -0
- package/dist/import/constants/config.d.ts +4 -0
- package/dist/import/constants/config.js +18 -0
- package/dist/import/types/types.d.ts +10 -0
- package/dist/import/types/types.js +1 -0
- package/dist/import/utils/utils.d.ts +32 -0
- package/dist/import/utils/utils.js +47 -0
- package/package.json +30 -19
- package/readme.md +39 -0
- package/.nvmrc +0 -1
- package/.prettierrc +0 -7
- package/LICENSE +0 -21
- package/README.md +0 -36
- package/import/config.js +0 -17
- package/import/git.js +0 -56
- package/import/install.js +0 -200
- package/import/user-prompts.js +0 -145
- package/index.js +0 -33
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import type { InstallationType, MultiSelectItem } from '../../types/types.js';
|
|
3
|
+
interface Props {
|
|
4
|
+
installation: InstallationType | undefined;
|
|
5
|
+
onCompletion: () => void;
|
|
6
|
+
onSubmit: (selectedItems: Array<MultiSelectItem>) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Step for selecting optional packages. Skipped if installation type is 'full'.
|
|
10
|
+
* @param onCompletion
|
|
11
|
+
* @param onSubmit
|
|
12
|
+
* @param installation
|
|
13
|
+
*/
|
|
14
|
+
declare const OptionalPackages: FC<Props>;
|
|
15
|
+
export default OptionalPackages;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Text } from 'ink';
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import MultiSelect from '../Multiselect/index.js';
|
|
4
|
+
const customPackages = [
|
|
5
|
+
{
|
|
6
|
+
label: 'Component Demos',
|
|
7
|
+
value: 'demo',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
label: 'Subgraph support',
|
|
11
|
+
value: 'subgraph',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
label: 'Typedoc documentation support',
|
|
15
|
+
value: 'typedoc',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: 'Vocs documentation support',
|
|
19
|
+
value: 'vocs',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: 'Husky Git hooks support',
|
|
23
|
+
value: 'husky',
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Step for selecting optional packages. Skipped if installation type is 'full'.
|
|
28
|
+
* @param onCompletion
|
|
29
|
+
* @param onSubmit
|
|
30
|
+
* @param installation
|
|
31
|
+
*/
|
|
32
|
+
const OptionalPackages = ({ onCompletion, onSubmit, installation }) => {
|
|
33
|
+
const [isFocused, setIsFocused] = useState(true);
|
|
34
|
+
const skip = installation === 'full';
|
|
35
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: Run this only once
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
// full installation, do nothing
|
|
38
|
+
if (skip) {
|
|
39
|
+
onCompletion();
|
|
40
|
+
}
|
|
41
|
+
}, []);
|
|
42
|
+
const onHandleSubmit = (selectedItems) => {
|
|
43
|
+
onSubmit(selectedItems);
|
|
44
|
+
setIsFocused(false);
|
|
45
|
+
onCompletion();
|
|
46
|
+
};
|
|
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 })));
|
|
50
|
+
};
|
|
51
|
+
export default OptionalPackages;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import type { InstallationType, MultiSelectItem } from '../../types/types.js';
|
|
3
|
+
interface Props {
|
|
4
|
+
installationConfig: {
|
|
5
|
+
installationType: InstallationType | undefined;
|
|
6
|
+
selectedFeatures?: Array<MultiSelectItem>;
|
|
7
|
+
};
|
|
8
|
+
projectName: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Component to ask for the project name.
|
|
12
|
+
* @param selectedFeatures
|
|
13
|
+
* @param projectName
|
|
14
|
+
*/
|
|
15
|
+
declare const PostInstall: FC<Props>;
|
|
16
|
+
export default PostInstall;
|
|
@@ -0,0 +1,79 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
onCompletion: () => void;
|
|
4
|
+
onSubmit: (value: string) => void;
|
|
5
|
+
projectName: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Component to ask for the project name.
|
|
9
|
+
* @param projectName
|
|
10
|
+
* @param onSubmit
|
|
11
|
+
* @param onCompletion
|
|
12
|
+
*/
|
|
13
|
+
declare const ProjectName: FC<Props>;
|
|
14
|
+
export default ProjectName;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useMemo, useCallback } from 'react';
|
|
2
|
+
import { isValidName } from '../../utils/utils.js';
|
|
3
|
+
import Ask from '../Ask.js';
|
|
4
|
+
/**
|
|
5
|
+
* Component to ask for the project name.
|
|
6
|
+
* @param projectName
|
|
7
|
+
* @param onSubmit
|
|
8
|
+
* @param onCompletion
|
|
9
|
+
*/
|
|
10
|
+
const ProjectName = ({ projectName, onSubmit, onCompletion }) => {
|
|
11
|
+
const validateName = useCallback((name) => {
|
|
12
|
+
if (name.length > 0 && !isValidName(name))
|
|
13
|
+
return 'Not a valid name!';
|
|
14
|
+
return '';
|
|
15
|
+
}, []);
|
|
16
|
+
const errorMessage = useMemo(() => validateName(projectName), [projectName, validateName]);
|
|
17
|
+
const handleSubmit = useCallback((name) => {
|
|
18
|
+
onSubmit(name);
|
|
19
|
+
if (isValidName(name)) {
|
|
20
|
+
onCompletion();
|
|
21
|
+
}
|
|
22
|
+
}, [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
|
+
};
|
|
25
|
+
export default ProjectName;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const repoUrl = 'https://github.com/BootNodeDev/dAppBooster.git';
|
|
2
|
+
export const featurePackages = {
|
|
3
|
+
subgraph: [
|
|
4
|
+
'@bootnodedev/db-subgraph',
|
|
5
|
+
'graphql graphql-request',
|
|
6
|
+
'@graphql-codegen/cli',
|
|
7
|
+
'@graphql-typed-document-node/core',
|
|
8
|
+
],
|
|
9
|
+
typedoc: [
|
|
10
|
+
'typedoc',
|
|
11
|
+
'typedoc-github-theme',
|
|
12
|
+
'typedoc-plugin-inline-sources',
|
|
13
|
+
'typedoc-plugin-missing-exports',
|
|
14
|
+
'typedoc-plugin-rename-defaults',
|
|
15
|
+
],
|
|
16
|
+
vocs: ['vocs'],
|
|
17
|
+
husky: ['husky', 'lint-staged', '@commitlint/cli', '@commitlint/config-conventional'],
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { MultiSelectItem } from '../types/types.js';
|
|
2
|
+
export declare function getProjectFolder(projectName: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Utility functions for import process
|
|
5
|
+
* @param name
|
|
6
|
+
*/
|
|
7
|
+
export declare function isValidName(name: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if the answer is confirmed
|
|
10
|
+
* @param answer
|
|
11
|
+
* @param errorMessage
|
|
12
|
+
*/
|
|
13
|
+
export declare function isAnswerConfirmed(answer?: string, errorMessage?: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if the step can be shown
|
|
16
|
+
* @param currentStep
|
|
17
|
+
* @param stepToShow
|
|
18
|
+
*/
|
|
19
|
+
export declare function canShowStep(currentStep: number, stepToShow: number): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true a feature is selected in the features list
|
|
22
|
+
* @param feature
|
|
23
|
+
* @param featuresList
|
|
24
|
+
*/
|
|
25
|
+
export declare function featureSelected(feature: string, featuresList: Array<MultiSelectItem> | undefined): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the packages to remove checking first if the feature is selected or not.
|
|
28
|
+
* Selected features are kept, unselected features are removed.
|
|
29
|
+
* @param feature
|
|
30
|
+
* @param featuresList
|
|
31
|
+
*/
|
|
32
|
+
export declare function getPackages(feature: string, featuresList: Array<MultiSelectItem> | undefined): string[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { featurePackages } from '../constants/config.js';
|
|
4
|
+
export function getProjectFolder(projectName) {
|
|
5
|
+
return join(process.cwd(), projectName);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Utility functions for import process
|
|
9
|
+
* @param name
|
|
10
|
+
*/
|
|
11
|
+
export function isValidName(name) {
|
|
12
|
+
return /^[a-zA-Z0-9_]+$/.test(name);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Checks if the answer is confirmed
|
|
16
|
+
* @param answer
|
|
17
|
+
* @param errorMessage
|
|
18
|
+
*/
|
|
19
|
+
export function isAnswerConfirmed(answer, errorMessage) {
|
|
20
|
+
return (answer !== '' && answer !== undefined && (errorMessage === '' || errorMessage === undefined));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the step can be shown
|
|
24
|
+
* @param currentStep
|
|
25
|
+
* @param stepToShow
|
|
26
|
+
*/
|
|
27
|
+
export function canShowStep(currentStep, stepToShow) {
|
|
28
|
+
return currentStep > stepToShow - 1;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns true a feature is selected in the features list
|
|
32
|
+
* @param feature
|
|
33
|
+
* @param featuresList
|
|
34
|
+
*/
|
|
35
|
+
export function featureSelected(feature, featuresList) {
|
|
36
|
+
return !!featuresList?.find((item) => item.value === feature);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the packages to remove checking first if the feature is selected or not.
|
|
40
|
+
* Selected features are kept, unselected features are removed.
|
|
41
|
+
* @param feature
|
|
42
|
+
* @param featuresList
|
|
43
|
+
*/
|
|
44
|
+
export function getPackages(feature, featuresList) {
|
|
45
|
+
const packages = featurePackages[feature];
|
|
46
|
+
return featureSelected(feature, featuresList) ? [] : packages?.length ? packages : [];
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,28 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dappbooster",
|
|
3
|
-
"
|
|
4
|
-
"version": "2.0.0",
|
|
5
|
-
"description": "Script to easily start your project with dAppBooster",
|
|
6
|
-
"main": "index.js",
|
|
3
|
+
"version": "3.0.0",
|
|
7
4
|
"license": "MIT",
|
|
5
|
+
"bin": "dist/cli.js",
|
|
6
|
+
"type": "module",
|
|
8
7
|
"engines": {
|
|
9
|
-
"node": ">=20
|
|
10
|
-
},
|
|
11
|
-
"bin": {
|
|
12
|
-
"dappbooster": "index.js"
|
|
8
|
+
"node": ">=20"
|
|
13
9
|
},
|
|
14
|
-
"
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
15
13
|
"dependencies": {
|
|
16
|
-
"
|
|
14
|
+
"figures": "^6.1.0",
|
|
15
|
+
"ink": "^5.2.1",
|
|
16
|
+
"ink-big-text": "^2.0.0",
|
|
17
|
+
"ink-divider": "^4.1.1",
|
|
18
|
+
"ink-gradient": "^3.0.0",
|
|
19
|
+
"ink-link": "^4.1.0",
|
|
20
|
+
"ink-select-input": "^6.2.0",
|
|
21
|
+
"ink-spawn": "^0.1.4",
|
|
22
|
+
"ink-text-input": "^6.0.0",
|
|
23
|
+
"react": "^18.3.1"
|
|
17
24
|
},
|
|
18
|
-
"keywords": [
|
|
19
|
-
"dappbooster",
|
|
20
|
-
"bootnode",
|
|
21
|
-
"cloner",
|
|
22
|
-
"installer",
|
|
23
|
-
"dapp"
|
|
24
|
-
],
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"
|
|
26
|
+
"@biomejs/biome": "^1.9.4",
|
|
27
|
+
"@sindresorhus/tsconfig": "^7.0.0",
|
|
28
|
+
"@types/node": "^22.15.21",
|
|
29
|
+
"@types/react": "^18.3.22",
|
|
30
|
+
"ts-node": "^10.9.1",
|
|
31
|
+
"typescript": "^5.8.3"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc",
|
|
35
|
+
"dev": "tsc --watch",
|
|
36
|
+
"lint": "pnpm biome check",
|
|
37
|
+
"lint:fix": "pnpm biome check --write"
|
|
27
38
|
}
|
|
28
|
-
}
|
|
39
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# dAppBooster installer
|
|
2
|
+
|
|
3
|
+
An easy way to install and customize [dAppBooster](https://dappbooster.dev/)
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
$ pnpm dlx dappbooster
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
<img src="./demo.svg" width="600">
|
|
12
|
+
|
|
13
|
+
dAppBooster documentation: https://docs.dappbooster.dev/
|
|
14
|
+
|
|
15
|
+
## Development
|
|
16
|
+
|
|
17
|
+
Clone the repo
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
git clone git@github.com:BootNodeDev/dAppBoosterInstallScript.git
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Move into the folder you just created and install the dependencies
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
cd dAppBoosterInstallScript
|
|
27
|
+
|
|
28
|
+
pnpm i
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
You can run the script by doing
|
|
32
|
+
|
|
33
|
+
```shell
|
|
34
|
+
$ node cli.js
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Releasing new versions to NPM
|
|
38
|
+
|
|
39
|
+
New releases are automatically uploaded to NPM using GitHub actions.
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
20
|
package/.prettierrc
DELETED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Fernando Greco
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# dAppBooster starter
|
|
2
|
-
|
|
3
|
-
A script to clone dAppBooster and cleanup the history to freshly start your new project.
|
|
4
|
-
|
|
5
|
-
Clones the latest tag from https://github.com/BootNodeDev/dAppBooster (so you might not see the last changes in `main`).
|
|
6
|
-
|
|
7
|
-
## Usage
|
|
8
|
-
|
|
9
|
-
```shell
|
|
10
|
-
$ pnpm dlx dappbooster <projectName>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Development
|
|
14
|
-
|
|
15
|
-
Move into the script's folder and then
|
|
16
|
-
|
|
17
|
-
```shell
|
|
18
|
-
# Clone the repo
|
|
19
|
-
git clone git@github.com:BootNodeDev/dAppBooster-starter.git
|
|
20
|
-
|
|
21
|
-
# Install dependencies
|
|
22
|
-
pnpm i
|
|
23
|
-
|
|
24
|
-
# Move into the script's folder
|
|
25
|
-
cd dAppBooster-starter
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
The common loop for testing the script looks something like
|
|
29
|
-
|
|
30
|
-
```shell
|
|
31
|
-
# Test the script, creates a folder called test
|
|
32
|
-
$ node index.js test
|
|
33
|
-
|
|
34
|
-
# Remove the test directory (ignored in .gitignore)
|
|
35
|
-
$ rm -rf test
|
|
36
|
-
```
|
package/import/config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const repoUrl = 'https://github.com/BootNodeDev/dAppBooster.git'
|
|
2
|
-
export const homeFolder = '/src/components/pageComponents/home'
|
|
3
|
-
|
|
4
|
-
export const defaultExecOptions = {
|
|
5
|
-
stdio: 'pipe',
|
|
6
|
-
shell: true,
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const fileExecOptions = {
|
|
10
|
-
recursive: true,
|
|
11
|
-
force: true,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const installPackageExecOptions = {
|
|
15
|
-
stdio: 'inherit',
|
|
16
|
-
shell: true,
|
|
17
|
-
}
|
package/import/git.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process'
|
|
2
|
-
import { rmSync } from 'node:fs'
|
|
3
|
-
import os from 'node:os'
|
|
4
|
-
import { join } from 'node:path'
|
|
5
|
-
import chalk from 'chalk'
|
|
6
|
-
import { defaultExecOptions, fileExecOptions, repoUrl } from './config.js'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @description Get the latest tag from the repository
|
|
10
|
-
* @returns {string} The latest tag
|
|
11
|
-
*/
|
|
12
|
-
function getLatestTag() {
|
|
13
|
-
const commandSilencer = os.platform() === 'win32' ? '> nul 2>&1' : '> /dev/null 2>&1'
|
|
14
|
-
|
|
15
|
-
execSync(`git fetch --tags ${commandSilencer}`, defaultExecOptions)
|
|
16
|
-
|
|
17
|
-
const tags = execSync('git tag -l --sort=-v:refname').toString().trim().split('\n')
|
|
18
|
-
|
|
19
|
-
return tags[0]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @description Clone the repository
|
|
24
|
-
*/
|
|
25
|
-
export function cloneRepo(projectName) {
|
|
26
|
-
const projectDir = join(process.cwd(), projectName)
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
console.log(`Cloning dAppBooster in ${chalk.bold(`${projectName}`)}`)
|
|
30
|
-
execSync(`git clone --depth 1 --no-checkout "${repoUrl}" "${projectDir}"`, defaultExecOptions)
|
|
31
|
-
|
|
32
|
-
process.chdir(projectDir)
|
|
33
|
-
|
|
34
|
-
const latestTag = getLatestTag(defaultExecOptions)
|
|
35
|
-
|
|
36
|
-
if (latestTag) {
|
|
37
|
-
console.log(`Checking out latest tag`)
|
|
38
|
-
execSync(`git checkout "${latestTag}"`, defaultExecOptions)
|
|
39
|
-
} else {
|
|
40
|
-
console.log(`No tags found, checking out ${chalk.bold('main')} branch...`)
|
|
41
|
-
execSync('git checkout main', defaultExecOptions)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Remove .git, and initialize the repo
|
|
45
|
-
rmSync(join(projectDir, '.git'), fileExecOptions)
|
|
46
|
-
execSync('git init', defaultExecOptions)
|
|
47
|
-
|
|
48
|
-
console.log(`Repository cloned in ${chalk.bold(projectDir)}`)
|
|
49
|
-
console.log(`Version: ${latestTag ? chalk.bold(latestTag) : chalk.bold('main')}`)
|
|
50
|
-
} catch (error) {
|
|
51
|
-
console.error(`${chalk.bold.red('An error occurred:')}`, error.message)
|
|
52
|
-
process.exit(1)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
console.log('\n---\n')
|
|
56
|
-
}
|