File tree Expand file tree Collapse file tree
templates/meshjs/off-chain Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -425,31 +425,34 @@ test fail_redeem_with_wrong_amount() fail {
425425# Off-chain component (MeshJS) — GiftCard
426426# Part of snap-project
427427
428+ # Install dependencies only when needed — node_modules is missing, or
429+ # package.json changed since the last install. Keeps repeat runs fast and quiet
430+ # (no npm output at all when deps are already up to date). `--no-fund --no-audit`
431+ # trims npm's noise when it does run. Delete node_modules (or `just clean`) to
432+ # force a fresh install.
433+ _install:
434+ @if [ ! -d node_modules ] || [ package.json -nt node_modules ]; then npm install --no-fund --no-audit; fi
435+
428436# Build the importable library into dist/ (JS + type declarations).
429- build:
430- npm install
437+ build: _install
431438 npm run build
432439
433- test:
434- npm install
440+ test: _install
435441 npm run test
436442
437443# Status: show the loaded blueprint and whether the env is ready for txs.
438- dev:
439- npm install
444+ dev: _install
440445 npm run start
441446
442447# Create a gift card: mint a token and lock <lovelace > at the script address.
443448# Submits to the local devnet if one is running (INDEXER_URL in ../.env), else
444449# to Blockfrost (needs BLOCKFROST_PROJECT_ID). Needs MNEMONIC either way — see
445450# .env.example.
446- create token lovelace:
447- npm install
451+ create token lovelace: _install
448452 npx tsx src/cli.ts create { {token }} { {lovelace }}
449453
450454# Redeem the gift card produced by the create transaction <txhash >.
451- redeem txhash:
452- npm install
455+ redeem txhash: _install
453456 npx tsx src/cli.ts redeem { {txhash }}
454457
455458clean:
Original file line number Diff line number Diff line change @@ -439,31 +439,34 @@ test fail_redeem_with_wrong_amount() fail {
439439# Off-chain component (MeshJS) — GiftCard
440440# Part of snap-project
441441
442+ # Install dependencies only when needed — node_modules is missing, or
443+ # package.json changed since the last install. Keeps repeat runs fast and quiet
444+ # (no npm output at all when deps are already up to date). `--no-fund --no-audit`
445+ # trims npm's noise when it does run. Delete node_modules (or `just clean`) to
446+ # force a fresh install.
447+ _install:
448+ @if [ ! -d node_modules ] || [ package.json -nt node_modules ]; then npm install --no-fund --no-audit; fi
449+
442450# Build the importable library into dist/ (JS + type declarations).
443- build:
444- npm install
451+ build: _install
445452 npm run build
446453
447- test:
448- npm install
454+ test: _install
449455 npm run test
450456
451457# Status: show the loaded blueprint and whether the env is ready for txs.
452- dev:
453- npm install
458+ dev: _install
454459 npm run start
455460
456461# Create a gift card: mint a token and lock <lovelace > at the script address.
457462# Submits to the local devnet if one is running (INDEXER_URL in ../.env), else
458463# to Blockfrost (needs BLOCKFROST_PROJECT_ID). Needs MNEMONIC either way — see
459464# .env.example.
460- create token lovelace:
461- npm install
465+ create token lovelace: _install
462466 npx tsx src/cli.ts create { {token }} { {lovelace }}
463467
464468# Redeem the gift card produced by the create transaction <txhash >.
465- redeem txhash:
466- npm install
469+ redeem txhash: _install
467470 npx tsx src/cli.ts redeem { {txhash }}
468471
469472clean:
Original file line number Diff line number Diff line change @@ -195,31 +195,34 @@ NODE_SOCKET_PATH=
195195# Off-chain component (MeshJS) — GiftCard
196196# Part of snap-project
197197
198+ # Install dependencies only when needed — node_modules is missing, or
199+ # package.json changed since the last install. Keeps repeat runs fast and quiet
200+ # (no npm output at all when deps are already up to date). `--no-fund --no-audit`
201+ # trims npm's noise when it does run. Delete node_modules (or `just clean`) to
202+ # force a fresh install.
203+ _install:
204+ @if [ ! -d node_modules ] || [ package.json -nt node_modules ]; then npm install --no-fund --no-audit; fi
205+
198206# Build the importable library into dist/ (JS + type declarations).
199- build:
200- npm install
207+ build: _install
201208 npm run build
202209
203- test:
204- npm install
210+ test: _install
205211 npm run test
206212
207213# Status: show the loaded blueprint and whether the env is ready for txs.
208- dev:
209- npm install
214+ dev: _install
210215 npm run start
211216
212217# Create a gift card: mint a token and lock <lovelace > at the script address.
213218# Submits to the local devnet if one is running (INDEXER_URL in ../.env), else
214219# to Blockfrost (needs BLOCKFROST_PROJECT_ID). Needs MNEMONIC either way — see
215220# .env.example.
216- create token lovelace:
217- npm install
221+ create token lovelace: _install
218222 npx tsx src/cli.ts create { {token }} { {lovelace }}
219223
220224# Redeem the gift card produced by the create transaction <txhash >.
221- redeem txhash:
222- npm install
225+ redeem txhash: _install
223226 npx tsx src/cli.ts redeem { {txhash }}
224227
225228clean:
Original file line number Diff line number Diff line change 11# Off-chain component (MeshJS) — GiftCard
22# Part of {{ project_name }}
33
4+ # Install dependencies only when needed — node_modules is missing, or
5+ # package.json changed since the last install. Keeps repeat runs fast and quiet
6+ # (no npm output at all when deps are already up to date). `--no-fund --no-audit`
7+ # trims npm's noise when it does run. Delete node_modules (or `just clean`) to
8+ # force a fresh install.
9+ _install:
10+ @if [ ! -d node_modules ] || [ package.json -nt node_modules ]; then npm install --no-fund --no-audit; fi
11+
412# Build the importable library into dist/ (JS + type declarations).
5- build:
6- npm install
13+ build: _install
714 npm run build
815
9- test:
10- npm install
16+ test: _install
1117 npm run test
1218
1319# Status: show the loaded blueprint and whether the env is ready for txs.
14- dev:
15- npm install
20+ dev: _install
1621 npm run start
1722
1823# Create a gift card: mint a token and lock <lovelace > at the script address.
1924# Submits to the local devnet if one is running (INDEXER_URL in ../.env), else
2025# to Blockfrost (needs BLOCKFROST_PROJECT_ID). Needs MNEMONIC either way — see
2126# .env.example.
22- create token lovelace:
23- npm install
27+ create token lovelace: _install
2428 npx tsx src/cli.ts create {{ "{{token}}" }} {{ "{{lovelace}}" }}
2529
2630# Redeem the gift card produced by the create transaction <txhash >.
27- redeem txhash:
28- npm install
31+ redeem txhash: _install
2932 npx tsx src/cli.ts redeem {{ "{{txhash}}" }}
3033
3134clean:
You can’t perform that action at this time.
0 commit comments