create-near-app 7.0.2 → 7.0.3
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.js +0 -5
- package/dist/messages.js +1 -1
- package/dist/user-input.js +14 -4
- package/package.json +1 -1
- package/templates/contracts/rs/Cargo.lock +6619 -0
- package/templates/contracts/rs/Cargo.toml +3 -3
- package/templates/contracts/rs/src/lib.rs +1 -1
- package/templates/contracts/rs/tests/test_basics.rs +6 -5
- package/templates/contracts/ts/package.json +4 -2
- package/templates/contracts/ts/src/contract.ts +5 -0
- package/templates/contracts/ts/yarn.lock +3290 -0
- package/templates/frontend/next-app/package.json +11 -7
- package/templates/frontend/next-app/src/wallets/near.js +42 -5
- package/templates/frontend/next-page/package.json +11 -7
- package/templates/frontend/next-page/src/wallets/near.js +42 -5
package/dist/app.js
CHANGED
|
@@ -31,16 +31,11 @@ const semver_1 = __importDefault(require("semver"));
|
|
|
31
31
|
const make_1 = require("./make");
|
|
32
32
|
const user_input_1 = require("./user-input");
|
|
33
33
|
const show = __importStar(require("./messages"));
|
|
34
|
-
const tracking_1 = require("./tracking");
|
|
35
34
|
(async function () {
|
|
36
35
|
const supportedNodeVersion = require('../package.json').engines.node;
|
|
37
36
|
if (!semver_1.default.satisfies(process.version, supportedNodeVersion)) {
|
|
38
37
|
return show.unsupportedNodeVersion(supportedNodeVersion);
|
|
39
38
|
}
|
|
40
|
-
if (process.platform === 'win32') {
|
|
41
|
-
(0, tracking_1.trackUsage)('none', false, 'none');
|
|
42
|
-
return show.windowsWarning();
|
|
43
|
-
}
|
|
44
39
|
const prompt = await (0, user_input_1.promptAndGetConfig)();
|
|
45
40
|
if (prompt === undefined)
|
|
46
41
|
return;
|
package/dist/messages.js
CHANGED
|
@@ -84,7 +84,7 @@ npx create-near-app <projectName> [--frontend next-app|next-page] [--contract rs
|
|
|
84
84
|
exports.argsError = argsError;
|
|
85
85
|
const unsupportedNodeVersion = (supported) => (0, exports.show)((0, chalk_1.default) `{red We support node.js version ${supported} or later}`);
|
|
86
86
|
exports.unsupportedNodeVersion = unsupportedNodeVersion;
|
|
87
|
-
const windowsWarning = () => (0, exports.show)((0, chalk_1.default) `{red Please use Windows Subsystem for Linux (WSL)}
|
|
87
|
+
const windowsWarning = () => (0, exports.show)((0, chalk_1.default) `{red Please use Windows Subsystem for Linux (WSL) to develop smart contracts}
|
|
88
88
|
{yellow Learn more here: https://docs.near.org/blog/getting-started-on-windows}
|
|
89
89
|
`);
|
|
90
90
|
exports.windowsWarning = windowsWarning;
|
package/dist/user-input.js
CHANGED
|
@@ -46,12 +46,14 @@ async function getUserArgs() {
|
|
|
46
46
|
const options = commander_1.program.opts();
|
|
47
47
|
const [projectName] = commander_1.program.args;
|
|
48
48
|
const { contract, frontend, install, components } = options;
|
|
49
|
-
return { contract, frontend, components, projectName, install };
|
|
49
|
+
return { contract, frontend, components, projectName, install, error: undefined };
|
|
50
50
|
}
|
|
51
51
|
exports.getUserArgs = getUserArgs;
|
|
52
52
|
const appChoices = [
|
|
53
53
|
{ title: 'A Web App', description: 'A Web App that talks with Near contracts', value: 'gateway' },
|
|
54
|
-
{
|
|
54
|
+
{
|
|
55
|
+
title: 'A Smart Contract', description: 'A smart contract to be deployed in the Near Blockchain', value: 'contract',
|
|
56
|
+
},
|
|
55
57
|
];
|
|
56
58
|
const contractChoices = [
|
|
57
59
|
{ title: 'JS/TS Contract', description: 'A Near contract written in javascript/typescript', value: 'ts' },
|
|
@@ -113,14 +115,18 @@ async function getUserAnswers() {
|
|
|
113
115
|
if (app === 'gateway') {
|
|
114
116
|
// If gateway, ask for the framework to use
|
|
115
117
|
const { frontend, components, projectName, install } = await promptUser([frontendPrompt, componentsPrompt, namePrompts, npmPrompt]);
|
|
116
|
-
return { frontend, components, contract: 'none', projectName, install };
|
|
118
|
+
return { frontend, components, contract: 'none', projectName, install, error: undefined };
|
|
117
119
|
}
|
|
118
120
|
else {
|
|
121
|
+
// If platform is Window, return the error
|
|
122
|
+
if (process.platform === 'win32') {
|
|
123
|
+
return { frontend: 'none', components: false, contract: 'none', projectName: '', install: false, error: show.windowsWarning };
|
|
124
|
+
}
|
|
119
125
|
// If contract, ask for the language for the contract
|
|
120
126
|
let { contract } = await promptUser(contractPrompt);
|
|
121
127
|
const { projectName } = await promptUser(namePrompts);
|
|
122
128
|
const install = contract === 'ts' ? (await promptUser(npmPrompt)).install : false;
|
|
123
|
-
return { frontend: 'none', components: false, contract, projectName, install };
|
|
129
|
+
return { frontend: 'none', components: false, contract, projectName, install, error: undefined };
|
|
124
130
|
}
|
|
125
131
|
}
|
|
126
132
|
exports.getUserAnswers = getUserAnswers;
|
|
@@ -132,6 +138,10 @@ async function promptAndGetConfig() {
|
|
|
132
138
|
show.welcome();
|
|
133
139
|
args = await getUserAnswers();
|
|
134
140
|
}
|
|
141
|
+
if (args.error) {
|
|
142
|
+
(0, tracking_1.trackUsage)('none', false, 'none');
|
|
143
|
+
return args.error();
|
|
144
|
+
}
|
|
135
145
|
// Homogenizing terminal args with prompt args
|
|
136
146
|
args.contract = args.contract || 'none';
|
|
137
147
|
args.frontend = args.frontend || 'none';
|