create-near-app 8.0.0 → 8.2.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/messages.js +2 -1
- package/dist/types.js +1 -1
- package/dist/user-input.js +1 -0
- package/package.json +2 -1
- package/templates/contracts/rs/.github/workflows/deploy-production.yml +27 -0
- package/templates/contracts/rs/.github/workflows/deploy-staging.yml +56 -0
- package/templates/contracts/rs/.github/workflows/test.yml +32 -0
- package/templates/contracts/rs/.github/workflows/undeploy-staging.yml +25 -0
- package/templates/contracts/rs/Cargo.lock +973 -3244
- package/templates/contracts/rs/Cargo.toml +23 -6
- package/templates/contracts/rs/README.md +5 -7
- package/templates/contracts/rs/src/lib.rs +1 -1
- package/templates/contracts/rs/tests/test_basics.rs +11 -14
- package/templates/contracts/ts/package.json +1 -1
- package/templates/frontend/next-app/next.config.js +1 -0
- package/templates/frontend/next-app/package.json +23 -23
- package/templates/frontend/next-app/src/app/hello-near/page.js +7 -9
- package/templates/frontend/next-app/src/app/layout.js +34 -9
- package/templates/frontend/next-app/src/components/navigation.js +7 -9
- package/templates/frontend/next-app/src/config.js +1 -18
- package/templates/frontend/next-app/src/wallets/web3modal.js +30 -39
- package/templates/frontend/next-page/next.config.js +1 -0
- package/templates/frontend/next-page/package.json +23 -23
- package/templates/frontend/next-page/src/components/navigation.js +7 -9
- package/templates/frontend/next-page/src/config.js +1 -18
- package/templates/frontend/next-page/src/pages/_app.js +34 -11
- package/templates/frontend/next-page/src/pages/hello-near/index.js +7 -9
- package/templates/frontend/next-page/src/wallets/web3modal.js +30 -39
- package/templates/frontend/vite-react/eslint.config.js +38 -0
- package/templates/frontend/vite-react/index.html +13 -0
- package/templates/frontend/vite-react/package.json +49 -0
- package/templates/frontend/vite-react/public/favicon.ico +0 -0
- package/templates/frontend/vite-react/src/App.jsx +56 -0
- package/templates/frontend/vite-react/src/assets/near-logo.svg +43 -0
- package/templates/frontend/vite-react/src/assets/near.svg +1 -0
- package/templates/frontend/vite-react/src/assets/react.svg +1 -0
- package/templates/frontend/vite-react/src/components/cards.jsx +27 -0
- package/templates/frontend/vite-react/src/components/navigation.jsx +37 -0
- package/templates/frontend/vite-react/src/config.js +7 -0
- package/templates/frontend/vite-react/src/main.jsx +11 -0
- package/templates/frontend/vite-react/src/pages/hello_near.jsx +73 -0
- package/templates/frontend/vite-react/src/pages/home.jsx +31 -0
- package/templates/frontend/vite-react/src/styles/app.module.css +226 -0
- package/templates/frontend/vite-react/src/styles/globals.css +88 -0
- package/templates/frontend/vite-react/src/wallets/web3modal.js +35 -0
- package/templates/frontend/vite-react/vite.config.js +14 -0
- package/dist/package-json.js +0 -130
- package/templates/frontend/next-app/src/wallets/near.js +0 -216
- package/templates/frontend/next-page/src/wallets/near.js +0 -216
package/dist/messages.js
CHANGED
|
@@ -30,7 +30,8 @@ const successContractToText = (contract) => contract === 'none'
|
|
|
30
30
|
exports.successContractToText = successContractToText;
|
|
31
31
|
const frontendTemplates = {
|
|
32
32
|
'next-page': 'NextJS (Classic)',
|
|
33
|
-
'next-app': 'NextJS (App Router)'
|
|
33
|
+
'next-app': 'NextJS (App Router)',
|
|
34
|
+
'vite-react': 'Vite React'
|
|
34
35
|
};
|
|
35
36
|
const successFrontendToText = (frontend) => frontend === 'none'
|
|
36
37
|
? ''
|
package/dist/types.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.APPS = exports.FRONTENDS = exports.CONTRACTS = void 0;
|
|
4
4
|
exports.CONTRACTS = ['ts', 'rs', 'none'];
|
|
5
|
-
exports.FRONTENDS = ['next-app', 'next-page', 'none'];
|
|
5
|
+
exports.FRONTENDS = ['next-app', 'next-page', 'vite-react', 'none'];
|
|
6
6
|
exports.APPS = ['contract', 'gateway'];
|
|
7
7
|
//# sourceMappingURL=types.js.map
|
package/dist/user-input.js
CHANGED
|
@@ -61,6 +61,7 @@ const contractChoices = [
|
|
|
61
61
|
const frontendChoices = [
|
|
62
62
|
{ title: 'NextJs (Classic)', description: 'A web-app built using Next.js Page Router', value: 'next-page' },
|
|
63
63
|
{ title: 'NextJS (App Router)', description: 'A web-app built using Next.js new App Router', value: 'next-app' },
|
|
64
|
+
{ title: 'Vite (React)', description: 'A web-app built using Vite with React', value: 'vite-react' },
|
|
64
65
|
];
|
|
65
66
|
const appPrompt = {
|
|
66
67
|
type: 'select',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-near-app",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "Quickly scaffold your dApp on NEAR Blockchain",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"build": "tsc",
|
|
19
19
|
"test": "npm run build && FORCE_COLOR=1 jest --runInBand",
|
|
20
20
|
"test-e2e": "npm run build && ./test/e2e.sh",
|
|
21
|
+
"test:update": "jest -u",
|
|
21
22
|
"lint": "eslint .",
|
|
22
23
|
"fix": "eslint . --fix",
|
|
23
24
|
"release": "npm run build && release-it",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Deploy to production
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
uses: ./.github/workflows/test.yml
|
|
9
|
+
|
|
10
|
+
deploy-staging:
|
|
11
|
+
name: Deploy to production
|
|
12
|
+
needs: [test]
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout repository
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
- name: Install cargo-near CLI
|
|
18
|
+
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/download/cargo-near-v0.13.2/cargo-near-installer.sh | sh
|
|
19
|
+
- name: Deploy to production
|
|
20
|
+
run: |
|
|
21
|
+
cargo near deploy build-reproducible-wasm "${{ vars.NEAR_CONTRACT_PRODUCTION_ACCOUNT_ID }}" \
|
|
22
|
+
without-init-call \
|
|
23
|
+
network-config "${{ vars.NEAR_CONTRACT_PRODUCTION_NETWORK }}" \
|
|
24
|
+
sign-with-plaintext-private-key \
|
|
25
|
+
--signer-public-key "${{ vars.NEAR_CONTRACT_PRODUCTION_ACCOUNT_PUBLIC_KEY }}" \
|
|
26
|
+
--signer-private-key "${{ secrets.NEAR_CONTRACT_PRODUCTION_ACCOUNT_PRIVATE_KEY }}" \
|
|
27
|
+
send
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Deploy to staging
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
uses: ./.github/workflows/test.yml
|
|
8
|
+
|
|
9
|
+
deploy-staging:
|
|
10
|
+
name: Deploy to staging subaccount
|
|
11
|
+
permissions:
|
|
12
|
+
pull-requests: write
|
|
13
|
+
needs: [test]
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
env:
|
|
16
|
+
NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID: gh-${{ github.event.number }}.${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_ID }}
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout repository
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Install near CLI
|
|
23
|
+
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/download/v0.11.1/near-cli-rs-installer.sh | sh
|
|
24
|
+
- name: Create staging account
|
|
25
|
+
if: github.event.action == 'opened' || github.event.action == 'reopened'
|
|
26
|
+
run: |
|
|
27
|
+
near account create-account fund-myself "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" '10 NEAR' \
|
|
28
|
+
use-manually-provided-public-key "${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_PUBLIC_KEY }}" \
|
|
29
|
+
sign-as "${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_ID }}" \
|
|
30
|
+
network-config "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}" \
|
|
31
|
+
sign-with-plaintext-private-key \
|
|
32
|
+
--signer-public-key "${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_PUBLIC_KEY }}" \
|
|
33
|
+
--signer-private-key "${{ secrets.NEAR_CONTRACT_STAGING_ACCOUNT_PRIVATE_KEY }}" \
|
|
34
|
+
send
|
|
35
|
+
|
|
36
|
+
- name: Install cargo-near CLI
|
|
37
|
+
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/download/cargo-near-v0.13.2/cargo-near-installer.sh | sh
|
|
38
|
+
- name: Deploy to staging
|
|
39
|
+
# `--skip-git-remote-check` was used
|
|
40
|
+
# as pull request git refs `refs/pull/NUMBER/merge` are somewhat harder to access and live only as long as PRs do
|
|
41
|
+
#
|
|
42
|
+
# WASM reproducibility check akin to SourceScan won't be available for staging contracts, deployed from PRs
|
|
43
|
+
run: |
|
|
44
|
+
cargo near deploy build-reproducible-wasm --skip-git-remote-check "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
|
|
45
|
+
without-init-call \
|
|
46
|
+
network-config "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}" \
|
|
47
|
+
sign-with-plaintext-private-key \
|
|
48
|
+
--signer-public-key "${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_PUBLIC_KEY }}" \
|
|
49
|
+
--signer-private-key "${{ secrets.NEAR_CONTRACT_STAGING_ACCOUNT_PRIVATE_KEY }}" \
|
|
50
|
+
send
|
|
51
|
+
|
|
52
|
+
- name: Comment on pull request
|
|
53
|
+
env:
|
|
54
|
+
GH_TOKEN: ${{ github.token }}
|
|
55
|
+
run: |
|
|
56
|
+
gh pr comment "${{ github.event.number }}" --body "Staging contract is deployed to ["'`'"${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}"'`'" account](https://explorer.${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}.near.org/accounts/${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }})"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
on:
|
|
3
|
+
workflow_call:
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
code-formatting:
|
|
7
|
+
name: Code Formatting
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- name: Checkout repository
|
|
11
|
+
uses: actions/checkout@v4
|
|
12
|
+
- run: cargo fmt --check
|
|
13
|
+
|
|
14
|
+
code-linter:
|
|
15
|
+
name: Code Linter
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout repository
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
- name: Run cargo clippy
|
|
21
|
+
run: |
|
|
22
|
+
rustup component add clippy
|
|
23
|
+
cargo clippy --all-features --workspace --tests -- --warn clippy::all --warn clippy::nursery
|
|
24
|
+
|
|
25
|
+
tests:
|
|
26
|
+
name: Tests
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- name: Checkout repository
|
|
30
|
+
uses: actions/checkout@v4
|
|
31
|
+
- name: Run cargo test
|
|
32
|
+
run: cargo test
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Undeploy staging
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
types: [closed]
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
cleanup-staging:
|
|
8
|
+
name: Cleanup staging account
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
env:
|
|
11
|
+
NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID: gh-${{ github.event.number }}.${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_ID }}
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout repository
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
- name: Install near CLI
|
|
16
|
+
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/download/v0.11.1/near-cli-rs-installer.sh | sh
|
|
17
|
+
- name: Remove staging account
|
|
18
|
+
run: |
|
|
19
|
+
near account delete-account "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
|
|
20
|
+
beneficiary "${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_ID }}" \
|
|
21
|
+
network-config "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}" \
|
|
22
|
+
sign-with-plaintext-private-key \
|
|
23
|
+
--signer-public-key "${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_PUBLIC_KEY }}" \
|
|
24
|
+
--signer-private-key "${{ secrets.NEAR_CONTRACT_STAGING_ACCOUNT_PRIVATE_KEY }}" \
|
|
25
|
+
send
|