You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

create-nx-workspace

Package Overview
Dependencies
Maintainers
7
Versions
2337
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-nx-workspace - npm Package Compare versions

Comparing version

to
0.0.0-pr-31936-245bb1e

2

bin/create-nx-workspace.js

@@ -172,3 +172,3 @@ "use strict";

async function normalizeArgsMiddleware(argv) {
rawArgs = argv;
rawArgs = { ...argv };
output_1.output.log({

@@ -175,0 +175,0 @@ title: "Let's create a new workspace [https://nx.dev/getting-started/intro]",

{
"name": "create-nx-workspace",
"version": "0.0.0-pr-31936-1238995",
"version": "0.0.0-pr-31936-245bb1e",
"private": false,

@@ -5,0 +5,0 @@ "description": "Smart Repos · Fast Builds",

@@ -7,2 +7,6 @@ export declare enum VcsPushStatus {

}
export declare class GitHubPushSkippedError extends Error {
readonly title = "Push your workspace";
constructor(message: string);
}
export declare function checkGitVersion(): Promise<string | null | undefined>;

@@ -9,0 +13,0 @@ export declare function initializeGitRepo(directory: string, options: {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VcsPushStatus = void 0;
exports.GitHubPushSkippedError = exports.VcsPushStatus = void 0;
exports.checkGitVersion = checkGitVersion;

@@ -18,2 +18,10 @@ exports.initializeGitRepo = initializeGitRepo;

})(VcsPushStatus || (exports.VcsPushStatus = VcsPushStatus = {}));
class GitHubPushSkippedError extends Error {
constructor(message) {
super(message);
this.title = 'Push your workspace';
this.name = 'GitHubPushSkippedError';
}
}
exports.GitHubPushSkippedError = GitHubPushSkippedError;
async function checkGitVersion() {

@@ -33,3 +41,3 @@ try {

if (!username) {
throw new Error('GitHub CLI is not authenticated');
throw new GitHubPushSkippedError('GitHub CLI is not authenticated');
}

@@ -128,4 +136,4 @@ return username;

try {
if (process.env['NX_USE_GH_CLI'] === 'false') {
throw new Error('GitHub CLI is disabled by environment variable NX_USE_GH_CLI');
if (process.env['NX_SKIP_GH_PUSH'] === 'false') {
throw new GitHubPushSkippedError('NX_SKIP_GH_PUSH is false so skipping GitHub push.');
}

@@ -190,12 +198,16 @@ const username = await getGitHubUsername(directory);

const errorMessage = e instanceof Error ? e.message : String(e);
// Error code 127 means gh wasn't installed
const title = e instanceof GitHubPushSkippedError || e?.code === 127
? 'Push your workspace to GitHub'
: 'Failed to push workspace to GitHub';
const createRepoUrl = `https://github.com/new?name=${encodeURIComponent(options.name)}`;
output_1.output.log({
title: 'Failed to push workspace to GitHub',
title,
bodyLines: isVerbose
? [
`Please create a repo at ${createRepoUrl} and push this workspace.`,
`Please create a repo at ${createRepoUrl} and push this workspace`,
'Error details:',
errorMessage,
]
: [`Please create a repo at ${createRepoUrl} and push this workspace.`],
: [`Please create a repo at ${createRepoUrl} and push this workspace`],
});

@@ -202,0 +214,0 @@ return VcsPushStatus.FailedToPushToVcs;

@@ -0,5 +1,6 @@

import { VcsPushStatus } from '../git/git';
declare const outputMessages: {
readonly 'create-nx-workspace-success-ci-setup': readonly [{
readonly code: "ci-setup-visit";
readonly createMessage: (url: string | null, pushedToVcs: boolean) => {
readonly createMessage: (url: string | null, pushedToVcs: VcsPushStatus) => {
title: string;

@@ -12,3 +13,3 @@ type: string;

readonly code: "remote-cache-visit";
readonly createMessage: (url: string | null, pushedToVcs: boolean) => {
readonly createMessage: (url: string | null, pushedToVcs: VcsPushStatus) => {
title: string;

@@ -23,3 +24,3 @@ type: string;

readonly code: "ci-setup-visit";
readonly createMessage: (url: string | null, pushedToVcs: boolean) => {
readonly createMessage: (url: string | null, pushedToVcs: VcsPushStatus) => {
title: string;

@@ -31,3 +32,3 @@ type: string;

readonly code: "remote-cache-visit";
readonly createMessage: (url: string | null, pushedToVcs: boolean) => {
readonly createMessage: (url: string | null, pushedToVcs: VcsPushStatus) => {
title: string;

@@ -34,0 +35,0 @@ type: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMessageFactory = getMessageFactory;
const git_1 = require("../git/git");
function getSetupMessage(url, pushedToVcs) {
if (pushedToVcs === git_1.VcsPushStatus.PushedToVcs) {
return url
? `Go to Nx Cloud and finish the setup: ${url}`
: 'Return to Nx Cloud and finish the setup';
}
if (pushedToVcs === git_1.VcsPushStatus.OptedOutOfPushingToVcs) {
const action = url ? 'go' : 'return';
const urlSuffix = url ? `: ${url}` : '';
return `Push your repo, then ${action} to Nx Cloud and finish the setup${urlSuffix}`;
}
// Default case: FailedToPushToVcs
const action = url ? 'go' : 'return';
const urlSuffix = url ? `: ${url}` : '';
return `Once you have pushed your repo, ${action} to Nx Cloud and finish the setup${urlSuffix}`;
}
const outputMessages = {

@@ -12,9 +29,3 @@ 'create-nx-workspace-success-ci-setup': [

type: 'success',
bodyLines: [
`${pushedToVcs
? url
? `Go to Nx Cloud and finish the setup: ${url}`
: 'Return to Nx Cloud and finish the setup'
: `Once you have pushed your repo, ${url ? 'go' : 'return'} to Nx Cloud and finish the setup${url ? `: ${url}` : ''}`}`,
],
bodyLines: [getSetupMessage(url, pushedToVcs)],
};

@@ -32,7 +43,3 @@ },

bodyLines: [
`${pushedToVcs
? url
? `Go to Nx Cloud and finish the setup: ${url}`
: 'Return to Nx Cloud and finish the setup'
: `Once you have pushed your repo, ${url ? 'go' : 'return'} to Nx Cloud and finish the setup${url ? `: ${url}` : ''}`}`,
getSetupMessage(url, pushedToVcs),
`You can also set up a remote cache later by running \`nx g @nx/nx-cloud:init\``,

@@ -39,0 +46,0 @@ ],

@@ -6,3 +6,2 @@ "use strict";

exports.getNxCloudInfo = getNxCloudInfo;
const git_1 = require("../git/git");
const output_1 = require("../output");

@@ -43,3 +42,3 @@ const messages_1 = require("./messages");

const out = new output_1.CLIOutput(false);
const message = createMessage(typeof rawNxCloud === 'string' ? null : connectCloudUrl, pushedToVcs === git_1.VcsPushStatus.PushedToVcs);
const message = createMessage(typeof rawNxCloud === 'string' ? null : connectCloudUrl, pushedToVcs);
if (message.type === 'success') {

@@ -46,0 +45,0 @@ out.success(message);