create-near-app 6.0.3 → 6.1.1
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/README.md +1 -1
- package/dist/messages.js +37 -12
- package/dist/types.js +1 -1
- package/dist/user-input.js +2 -1
- package/package.json +1 -1
- package/templates/contracts/rs/rust-toolchain.toml +3 -1
- package/templates/frontend/next-page/README.md +36 -0
- package/templates/frontend/next-page/jsconfig.json +7 -0
- package/templates/frontend/next-page/next.config.js +6 -0
- package/templates/frontend/next-page/package-lock.json +14642 -0
- package/templates/frontend/next-page/package.json +43 -0
- package/templates/frontend/next-page/public/favicon.ico +0 -0
- package/templates/frontend/next-page/public/near-logo.svg +43 -0
- package/templates/frontend/next-page/public/near.svg +1 -0
- package/templates/frontend/next-page/public/next.svg +1 -0
- package/templates/frontend/next-page/public/vercel.svg +1 -0
- package/templates/frontend/next-page/src/components/cards.js +43 -0
- package/templates/frontend/next-page/src/components/navigation.js +36 -0
- package/templates/frontend/next-page/src/components/vm-component.js +26 -0
- package/templates/frontend/next-page/src/config.js +21 -0
- package/templates/frontend/next-page/src/layout.js +17 -0
- package/templates/frontend/next-page/src/pages/_app.js +10 -0
- package/templates/frontend/next-page/src/pages/_document.js +17 -0
- package/templates/frontend/next-page/src/pages/hello-components/index.js +48 -0
- package/templates/frontend/next-page/src/pages/hello-near/index.js +78 -0
- package/templates/frontend/next-page/src/pages/index.js +41 -0
- package/templates/frontend/next-page/src/styles/app.module.css +228 -0
- package/templates/frontend/next-page/src/styles/globals.css +95 -0
- package/templates/frontend/next-page/src/wallets/wallet-selector.js +120 -0
- package/templates/frontend/next-page/src/wallets/web3-wallet.ts +289 -0
- package/templates/sandbox-tests/sandbox-rs/Cargo.toml +2 -10
- package/templates/sandbox-tests/sandbox-rs/src/tests.rs +18 -19
- /package/templates/frontend/{next → next-app}/README.md +0 -0
- /package/templates/frontend/{next → next-app}/jsconfig.json +0 -0
- /package/templates/frontend/{next → next-app}/next.config.js +0 -0
- /package/templates/frontend/{next → next-app}/package.json +0 -0
- /package/templates/frontend/{next → next-app}/public/near-logo.svg +0 -0
- /package/templates/frontend/{next → next-app}/public/near.svg +0 -0
- /package/templates/frontend/{next → next-app}/public/next.svg +0 -0
- /package/templates/frontend/{next → next-app}/public/vercel.svg +0 -0
- /package/templates/frontend/{next → next-app}/src/app/app.module.css +0 -0
- /package/templates/frontend/{next → next-app}/src/app/favicon.ico +0 -0
- /package/templates/frontend/{next → next-app}/src/app/globals.css +0 -0
- /package/templates/frontend/{next → next-app}/src/app/hello-components/page.js +0 -0
- /package/templates/frontend/{next → next-app}/src/app/hello-near/page.js +0 -0
- /package/templates/frontend/{next → next-app}/src/app/layout.js +0 -0
- /package/templates/frontend/{next → next-app}/src/app/page.js +0 -0
- /package/templates/frontend/{next → next-app}/src/components/cards.js +0 -0
- /package/templates/frontend/{next → next-app}/src/components/navigation.js +0 -0
- /package/templates/frontend/{next → next-app}/src/components/vm-component.js +0 -0
- /package/templates/frontend/{next → next-app}/src/config.js +0 -0
- /package/templates/frontend/{next → next-app}/src/wallets/wallet-selector.js +0 -0
- /package/templates/frontend/{next → next-app}/src/wallets/web3-wallet.ts +0 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Quickly build apps backed by the [NEAR](https://near.org) blockchain
|
|
|
7
7
|
|
|
8
8
|
## Prerequisites
|
|
9
9
|
|
|
10
|
-
Make sure you have a [current version of Node.js](https://nodejs.org
|
|
10
|
+
Make sure you have a [current version of Node.js](https://nodejs.org) installed – we are targeting versions `16+` for JS contracts and `18+` for frontend/gateways.
|
|
11
11
|
|
|
12
12
|
Read about other [prerequisites](https://docs.near.org/develop/prerequisites) in our docs.
|
|
13
13
|
|
package/dist/messages.js
CHANGED
|
@@ -24,35 +24,60 @@ Please refer to https://github.com/near/create-near-app README to troubleshoot.
|
|
|
24
24
|
Notice: some platforms aren't supported (yet).
|
|
25
25
|
{bold {red ==========================================}}`);
|
|
26
26
|
exports.setupFailed = setupFailed;
|
|
27
|
-
const successContractToText = (contract) => contract === 'none'
|
|
27
|
+
const successContractToText = (contract) => contract === 'none'
|
|
28
|
+
? ''
|
|
29
|
+
: (0, chalk_1.default) `a smart contract in {bold ${contract === 'rs' ? 'Rust' : 'Typescript'}}`;
|
|
28
30
|
exports.successContractToText = successContractToText;
|
|
29
|
-
const
|
|
31
|
+
const frontendTemplates = {
|
|
32
|
+
'next-page': 'NextJS (Classic)',
|
|
33
|
+
'next-app': 'NextJS (App Router)',
|
|
34
|
+
vanilla: 'Vanilla-JS',
|
|
35
|
+
};
|
|
36
|
+
const successFrontendToText = (frontend) => frontend === 'none'
|
|
37
|
+
? ''
|
|
38
|
+
: (0, chalk_1.default) `a gateway using ${frontendTemplates[frontend]}`;
|
|
30
39
|
exports.successFrontendToText = successFrontendToText;
|
|
31
40
|
const setupSuccess = (projectName, contract, frontend, install) => (0, exports.show)((0, chalk_1.default) `
|
|
32
41
|
{green ======================================================}
|
|
33
42
|
✅ Success! Created '${projectName}', ${(0, exports.successContractToText)(contract)}${(0, exports.successFrontendToText)(frontend)}.
|
|
34
|
-
${contract === 'rs'
|
|
43
|
+
${contract === 'rs'
|
|
44
|
+
? (0, chalk_1.default) `🦀 If you are new to Rust please visit {bold {green https://www.rust-lang.org }}\n`
|
|
45
|
+
: ''}
|
|
35
46
|
{bold {bgYellow {black Next steps}}}:
|
|
36
47
|
${(0, exports.contractInstructions)(projectName, contract, install)}${(0, exports.gatewayInstructions)(projectName, frontend, install)}`);
|
|
37
48
|
exports.setupSuccess = setupSuccess;
|
|
38
|
-
const contractInstructions = (projectName, contract, install) => contract === 'none'
|
|
49
|
+
const contractInstructions = (projectName, contract, install) => contract === 'none'
|
|
50
|
+
? ''
|
|
51
|
+
: (0, chalk_1.default) `
|
|
39
52
|
- {inverse Navigate to your project}:
|
|
40
53
|
{blue cd {bold ${projectName}}}
|
|
41
|
-
${contract === 'ts' && !install
|
|
42
|
-
|
|
54
|
+
${contract === 'ts' && !install
|
|
55
|
+
? (0, chalk_1.default) ` - {inverse Install all dependencies}
|
|
56
|
+
{blue npm {bold install}}`
|
|
57
|
+
: 'Then:'}
|
|
43
58
|
- {inverse Build your contract}:
|
|
44
|
-
${contract === 'ts'
|
|
59
|
+
${contract === 'ts'
|
|
60
|
+
? (0, chalk_1.default) `{blue npm {bold run build}}`
|
|
61
|
+
: (0, chalk_1.default) `{blue {bold ./build.sh}}`}
|
|
45
62
|
- {inverse Test your contract} in the Sandbox:
|
|
46
|
-
${contract === 'ts'
|
|
63
|
+
${contract === 'ts'
|
|
64
|
+
? (0, chalk_1.default) `{blue npm {bold run test}}`
|
|
65
|
+
: (0, chalk_1.default) `{blue {bold ./test.sh}}`}
|
|
47
66
|
- {inverse Deploy your contract} to NEAR TestNet with a temporary dev account:
|
|
48
|
-
${contract === 'ts'
|
|
67
|
+
${contract === 'ts'
|
|
68
|
+
? (0, chalk_1.default) `{blue npm {bold run deploy}}`
|
|
69
|
+
: (0, chalk_1.default) `{blue {bold ./deploy.sh}}`}
|
|
49
70
|
🧠 Read {bold {greenBright README.md}} to explore further`;
|
|
50
71
|
exports.contractInstructions = contractInstructions;
|
|
51
|
-
const gatewayInstructions = (projectName, frontend, install) => frontend === 'none'
|
|
72
|
+
const gatewayInstructions = (projectName, frontend, install) => frontend === 'none'
|
|
73
|
+
? ''
|
|
74
|
+
: (0, chalk_1.default) `
|
|
52
75
|
- {inverse Navigate to your project}:
|
|
53
76
|
{blue cd {bold ${projectName}}}
|
|
54
|
-
${!install
|
|
55
|
-
|
|
77
|
+
${!install
|
|
78
|
+
? (0, chalk_1.default) ` - {inverse Install all dependencies}
|
|
79
|
+
{blue pnpm {bold install}}`
|
|
80
|
+
: 'Then:'}
|
|
56
81
|
- {inverse Start your app}:
|
|
57
82
|
{blue pnpm {bold run dev}}`;
|
|
58
83
|
exports.gatewayInstructions = gatewayInstructions;
|
package/dist/types.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.APPS = exports.TESTING_FRAMEWORKS = exports.FRONTENDS = exports.CONTRACTS = void 0;
|
|
4
4
|
exports.CONTRACTS = ['ts', 'rs', 'none'];
|
|
5
|
-
exports.FRONTENDS = ['next', 'vanilla', 'none'];
|
|
5
|
+
exports.FRONTENDS = ['next-app', 'next-page', 'vanilla', 'none'];
|
|
6
6
|
exports.TESTING_FRAMEWORKS = ['rs', 'ts', 'none'];
|
|
7
7
|
exports.APPS = ['contract', 'gateway'];
|
|
8
8
|
//# sourceMappingURL=types.js.map
|
package/dist/user-input.js
CHANGED
|
@@ -63,7 +63,8 @@ const testsChoices = [
|
|
|
63
63
|
{ title: 'Tests written in Typescript', value: 'ts' },
|
|
64
64
|
];
|
|
65
65
|
const frontendChoices = [
|
|
66
|
-
{ title: 'NextJs
|
|
66
|
+
{ title: 'NextJs (Classic)', description: 'A composable app built using Next.js, React and Near components', value: 'next-page' },
|
|
67
|
+
{ title: 'NextJS (App Router)', description: 'A composable app built using Next.js, React and Near components', value: 'next-app' },
|
|
67
68
|
{ title: 'Vanilla JS', description: 'A framework-less web app with limited capabilities.', value: 'vanilla' },
|
|
68
69
|
];
|
|
69
70
|
const appPrompt = {
|
package/package.json
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
First, run the development server:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
# or
|
|
10
|
+
yarn dev
|
|
11
|
+
# or
|
|
12
|
+
pnpm dev
|
|
13
|
+
# or
|
|
14
|
+
bun dev
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
18
|
+
|
|
19
|
+
You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.
|
|
20
|
+
|
|
21
|
+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
|
22
|
+
|
|
23
|
+
## Learn More
|
|
24
|
+
|
|
25
|
+
To learn more about Next.js, take a look at the following resources:
|
|
26
|
+
|
|
27
|
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
28
|
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
29
|
+
|
|
30
|
+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
31
|
+
|
|
32
|
+
## Deploy on Vercel
|
|
33
|
+
|
|
34
|
+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
35
|
+
|
|
36
|
+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|