create-mn-app 0.3.28 โ 0.4.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 +75 -89
- package/dist/utils/templates.js +4 -4
- package/package.json +1 -1
- package/templates/hello-world/README.md.template +160 -60
- package/templates/hello-world/_gitignore +6 -1
- package/templates/hello-world/contracts/hello-world.compact.template +1 -1
- package/templates/hello-world/docker-compose.yml.template +66 -5
- package/templates/hello-world/package.json.template +17 -15
- package/templates/hello-world/scripts/e2e-check.ts.template +124 -0
- package/templates/hello-world/src/check-balance.ts.template +26 -84
- package/templates/hello-world/src/cli.ts.template +40 -76
- package/templates/hello-world/src/deploy.ts.template +236 -348
- package/templates/hello-world/src/network.ts +320 -0
- package/templates/hello-world/src/setup.ts.template +37 -0
- package/templates/hello-world/src/wallet-state.ts +95 -0
- package/templates/hello-world/src/wallet.ts +189 -0
- package/templates/hello-world/tsconfig.json.template +1 -1
- package/dist/installers/wallet-generator.d.ts +0 -4
- package/dist/installers/wallet-generator.d.ts.map +0 -1
- package/dist/installers/wallet-generator.js +0 -78
- package/dist/installers/wallet-generator.js.map +0 -1
- package/dist/test.d.ts +0 -2
- package/dist/test.d.ts.map +0 -1
- package/dist/test.js +0 -65
- package/dist/test.js.map +0 -1
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is part of create-mn-app.
|
|
3
|
-
// Copyright (C) 2025 Midnight Foundation
|
|
4
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
// You may not use this file except in compliance with the License.
|
|
7
|
-
// You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
// See the License for the specific language governing permissions and
|
|
15
|
-
// limitations under the License.
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.WalletGenerator = void 0;
|
|
21
|
-
const path_1 = __importDefault(require("path"));
|
|
22
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
23
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
24
|
-
class WalletGenerator {
|
|
25
|
-
async generate(projectPath) {
|
|
26
|
-
// Generate 32 random bytes and convert to hex string
|
|
27
|
-
const bytes = crypto_1.default.randomBytes(32);
|
|
28
|
-
const walletSeed = bytes.toString("hex");
|
|
29
|
-
// Create .env file
|
|
30
|
-
const envPath = path_1.default.join(projectPath, ".env");
|
|
31
|
-
const envContent = `# Midnight Network Configuration
|
|
32
|
-
# Generated on ${new Date().toISOString()}
|
|
33
|
-
|
|
34
|
-
# Network Configuration
|
|
35
|
-
MIDNIGHT_NETWORK=preprod
|
|
36
|
-
PROOF_SERVER_URL=http://127.0.0.1:6300
|
|
37
|
-
|
|
38
|
-
# Wallet Configuration (KEEP PRIVATE!)
|
|
39
|
-
WALLET_SEED=${walletSeed}
|
|
40
|
-
|
|
41
|
-
# Contract Configuration
|
|
42
|
-
CONTRACT_NAME=hello-world
|
|
43
|
-
|
|
44
|
-
# Development Settings
|
|
45
|
-
DEBUG_LEVEL=info
|
|
46
|
-
AUTO_START_PROOF_SERVER=true
|
|
47
|
-
|
|
48
|
-
# Security Warning:
|
|
49
|
-
# Keep your wallet seed private and secure!
|
|
50
|
-
# Never commit this file to version control.
|
|
51
|
-
# Add .env to your .gitignore file.
|
|
52
|
-
`;
|
|
53
|
-
await fs_extra_1.default.writeFile(envPath, envContent);
|
|
54
|
-
// Also create .env.example for reference
|
|
55
|
-
const envExamplePath = path_1.default.join(projectPath, ".env.example");
|
|
56
|
-
const envExampleContent = `# Midnight Network Configuration
|
|
57
|
-
# Copy this file to .env and fill in your values
|
|
58
|
-
|
|
59
|
-
# Network Configuration
|
|
60
|
-
MIDNIGHT_NETWORK=preprod
|
|
61
|
-
PROOF_SERVER_URL=http://127.0.0.1:6300
|
|
62
|
-
|
|
63
|
-
# Wallet Configuration (KEEP PRIVATE!)
|
|
64
|
-
WALLET_SEED=your_64_character_wallet_seed_here
|
|
65
|
-
|
|
66
|
-
# Contract Configuration
|
|
67
|
-
CONTRACT_NAME=hello-world
|
|
68
|
-
|
|
69
|
-
# Development Settings
|
|
70
|
-
DEBUG_LEVEL=info
|
|
71
|
-
AUTO_START_PROOF_SERVER=true
|
|
72
|
-
`;
|
|
73
|
-
await fs_extra_1.default.writeFile(envExamplePath, envExampleContent);
|
|
74
|
-
return walletSeed;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.WalletGenerator = WalletGenerator;
|
|
78
|
-
//# sourceMappingURL=wallet-generator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-generator.js","sourceRoot":"","sources":["../../src/installers/wallet-generator.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,yCAAyC;AACzC,sCAAsC;AACtC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;AAEjC,gDAAwB;AACxB,wDAA0B;AAC1B,oDAA4B;AAE5B,MAAa,eAAe;IAC1B,KAAK,CAAC,QAAQ,CAAC,WAAmB;QAChC,qDAAqD;QACrD,MAAM,KAAK,GAAG,gBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACrC,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAEzC,mBAAmB;QACnB,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG;iBACN,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;;;;;;;cAO3B,UAAU;;;;;;;;;;;;;CAavB,CAAC;QAEE,MAAM,kBAAE,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAExC,yCAAyC;QACzC,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAC9D,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;CAgB7B,CAAC;QAEE,MAAM,kBAAE,CAAC,SAAS,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;QAEtD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAzDD,0CAyDC"}
|
package/dist/test.d.ts
DELETED
package/dist/test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":""}
|
package/dist/test.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is part of create-mn-app.
|
|
3
|
-
// Copyright (C) 2025 Midnight Foundation
|
|
4
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
// You may not use this file except in compliance with the License.
|
|
7
|
-
// You may obtain a copy of the License at
|
|
8
|
-
//
|
|
9
|
-
// https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
11
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
// See the License for the specific language governing permissions and
|
|
15
|
-
// limitations under the License.
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
21
|
-
const path_1 = __importDefault(require("path"));
|
|
22
|
-
const create_app_1 = require("./create-app");
|
|
23
|
-
async function testCreateApp() {
|
|
24
|
-
console.log("๐งช Testing create-mn-app...\n");
|
|
25
|
-
const testDir = path_1.default.join(process.cwd(), "test-app");
|
|
26
|
-
// Clean up any existing test
|
|
27
|
-
if (fs_extra_1.default.existsSync(testDir)) {
|
|
28
|
-
await fs_extra_1.default.remove(testDir);
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
await (0, create_app_1.createApp)("test-app", {
|
|
32
|
-
template: "hello-world",
|
|
33
|
-
useNpm: true,
|
|
34
|
-
skipInstall: false,
|
|
35
|
-
skipGit: true,
|
|
36
|
-
verbose: true,
|
|
37
|
-
});
|
|
38
|
-
console.log("\nโ
Test completed successfully!");
|
|
39
|
-
// Verify structure
|
|
40
|
-
const requiredFiles = [
|
|
41
|
-
"package.json",
|
|
42
|
-
"tsconfig.json",
|
|
43
|
-
".gitignore",
|
|
44
|
-
"README.md",
|
|
45
|
-
"docker-compose.yml",
|
|
46
|
-
"contracts/hello-world.compact",
|
|
47
|
-
"src/deploy.ts",
|
|
48
|
-
"src/cli.ts",
|
|
49
|
-
"src/check-balance.ts",
|
|
50
|
-
];
|
|
51
|
-
for (const file of requiredFiles) {
|
|
52
|
-
const filePath = path_1.default.join(testDir, file);
|
|
53
|
-
if (!fs_extra_1.default.existsSync(filePath)) {
|
|
54
|
-
throw new Error(`Missing file: ${file}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
console.log("โ
All required files present");
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
console.error("โ Test failed:", error);
|
|
61
|
-
process.exit(1);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
testCreateApp();
|
|
65
|
-
//# sourceMappingURL=test.js.map
|
package/dist/test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,yCAAyC;AACzC,sCAAsC;AACtC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;AAEjC,wDAA0B;AAC1B,gDAAwB;AACxB,6CAAyC;AAEzC,KAAK,UAAU,aAAa;IAC1B,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;IAE7C,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;IAErD,6BAA6B;IAC7B,IAAI,kBAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,kBAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,CAAC;QACH,MAAM,IAAA,sBAAS,EAAC,UAAU,EAAE;YAC1B,QAAQ,EAAE,aAAa;YACvB,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,KAAK;YAClB,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAEhD,mBAAmB;QACnB,MAAM,aAAa,GAAG;YACpB,cAAc;YACd,eAAe;YACf,YAAY;YACZ,WAAW;YACX,oBAAoB;YACpB,+BAA+B;YAC/B,eAAe;YACf,YAAY;YACZ,sBAAsB;SACvB,CAAC;QAEF,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC1C,IAAI,CAAC,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,aAAa,EAAE,CAAC"}
|