Skip to content

Commit

Permalink
chore: change windows message & tracking (#2152)
Browse files Browse the repository at this point in the history
* chore: change windows message & tracking

* update snapshots

* chore: release v7.0.2
  • Loading branch information
gagdiez authored Jul 24, 2024
1 parent 23cf986 commit 9c482fd
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
- name: Install modules
run: npm install
- name: Run ESLint
run: npm run lint --max-warnings=0
run: npm run lint --max-warnings=0
3 changes: 2 additions & 1 deletion .github/workflows/test-contract-rs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Test Contract RS
on: push
env:
NODE_ENV: 'ci'
jobs:
tests:
strategy:
Expand All @@ -17,4 +19,3 @@ jobs:
run: npm run start -- hello-near --frontend none --contract rs
- name: Run tests
run: cd hello-near && cargo test

3 changes: 2 additions & 1 deletion .github/workflows/test-contract-ts.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Test Contract TS
on: push
env:
NODE_ENV: 'ci'
jobs:
tests:
strategy:
Expand All @@ -18,4 +20,3 @@ jobs:
run: npm run start -- hello-near --frontend none --contract ts
- name: Run tests
run: cd hello-near && npm install && npm run test

3 changes: 2 additions & 1 deletion .github/workflows/test-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Test Frontend
on: push
env:
NODE_ENV: 'ci'
jobs:
tests:
strategy:
Expand All @@ -22,4 +24,3 @@ jobs:
run: npm run start -- hello-components --frontend next-page --components
- name: Install
run: cd hello-components && npm install

2 changes: 1 addition & 1 deletion .github/workflows/test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
NEAR_ENV: ci
IS_GITHUB_ACTION: true
FORCE_COLOR: 1
run: npm test
run: npm test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-near-app",
"version": "7.0.1",
"version": "7.0.2",
"description": "Quickly scaffold your dApp on NEAR Blockchain",
"main": "index.js",
"engines": {
Expand Down
14 changes: 14 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import path from 'path';
import semver from 'semver';

import { createProject, runDepsInstall } from './make';
import { promptAndGetConfig, } from './user-input';
import * as show from './messages';
import { trackUsage } from './tracking';

(async function () {

const supportedNodeVersion = require('../package.json').engines.node;
if (!semver.satisfies(process.version, supportedNodeVersion)) {
return show.unsupportedNodeVersion(supportedNodeVersion);
}

if (process.platform === 'win32') {
trackUsage('none', false, 'none');
return show.windowsWarning();
}

const prompt = await promptAndGetConfig();
if (prompt === undefined) return;

Expand Down
6 changes: 3 additions & 3 deletions src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ export const unsupportedNodeVersion = (supported: string) =>
show(chalk`{red We support node.js version ${supported} or later}`);

export const windowsWarning = () =>
show(chalk`{bgYellow {black Notice: On Win32 please use WSL (Windows Subsystem for Linux).}}
https://docs.microsoft.com/en-us/windows/wsl/install
Exiting now.`);
show(chalk`{red Please use Windows Subsystem for Linux (WSL)}
{yellow Learn more here: https://docs.near.org/blog/getting-started-on-windows}
`);

export const directoryExists = (dirName: string) =>
show(chalk`{red This directory already exists! ${dirName}}`);
Expand Down
9 changes: 0 additions & 9 deletions src/user-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import chalk from 'chalk';
import prompt, { PromptObject } from 'prompts';
import { program } from 'commander';
import * as show from './messages';
import semver from 'semver';
import { trackUsage } from './tracking';
import fs from 'fs';

Expand Down Expand Up @@ -121,14 +120,6 @@ export async function getUserAnswers(): Promise<UserConfig> {
}

export async function promptAndGetConfig(): Promise<{ config: UserConfig, projectPath: string } | void> {
const supportedNodeVersion = require('../package.json').engines.node;
if (!semver.satisfies(process.version, supportedNodeVersion)) {
return show.unsupportedNodeVersion(supportedNodeVersion);
}

if (process.platform === 'win32') {
return show.windowsWarning();
}

// process cli args
let args = await getUserArgs();
Expand Down
6 changes: 3 additions & 3 deletions test/__snapshots__/user-input.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Run npx create-near-app without arguments, or use:
npx create-near-app <projectName> [--frontend next-app|next-page] [--contract rs|ts|none]",
],
[
"[43m[30mNotice: On Win32 please use WSL (Windows Subsystem for Linux).[39m[49m
https://docs.microsoft.com/en-us/windows/wsl/install
Exiting now.",
"[31mPlease use Windows Subsystem for Linux (WSL)[39m
[33mLearn more here: https://docs.near.org/blog/getting-started-on-windows[39m
",
],
[
"
Expand Down

0 comments on commit 9c482fd

Please sign in to comment.