nvii 2.0.0 → 2.0.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.
Files changed (3) hide show
  1. package/LICENSE.md +23 -0
  2. package/dist/index.js +28 -13
  3. package/package.json +2 -2
package/LICENSE.md ADDED
@@ -0,0 +1,23 @@
1
+ # MIT License
2
+
3
+ ```txt
4
+ Copyright (c) 2025 Skaleway
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+ ```
package/dist/index.js CHANGED
@@ -26668,6 +26668,11 @@ async function unlinkProjectConfig(projectId) {
26668
26668
  return success;
26669
26669
  }
26670
26670
  }
26671
+ function getProjectInfoFromPackageJson(projectPath) {
26672
+ const packageJsonPath = (0, import_path.join)(projectPath, "package.json");
26673
+ const packageJson = JSON.parse((0, import_fs.readFileSync)(packageJsonPath, "utf8"));
26674
+ return { name: packageJson.name, description: packageJson.description };
26675
+ }
26671
26676
 
26672
26677
  // src/commands/crypt.ts
26673
26678
  var import_picocolors2 = __toESM(require_picocolors());
@@ -27043,41 +27048,47 @@ ${error.response.data.error}`));
27043
27048
  }
27044
27049
 
27045
27050
  // src/commands/new.ts
27046
- async function promptUser(message) {
27051
+ async function promptUser(message, defaultValue) {
27047
27052
  const response = await esm_default12.prompt([
27048
27053
  {
27049
27054
  type: "input",
27050
27055
  name: "answer",
27051
- message: import_picocolors7.default.cyan(message)
27056
+ message: import_picocolors7.default.cyan(message),
27057
+ default: defaultValue || ""
27052
27058
  }
27053
27059
  ]);
27054
27060
  return response.answer.trim();
27055
27061
  }
27056
27062
  async function createProject() {
27063
+ const ora = (await import("ora")).default;
27064
+ const spinner = ora({ text: import_picocolors7.default.cyan("Creating project..."), color: "cyan" });
27057
27065
  try {
27058
27066
  if (!isLogedIn()) {
27059
27067
  console.log(import_picocolors7.default.red("You must be logged in to create a new project."));
27060
27068
  await login();
27061
27069
  }
27062
- const projectName = await promptUser("Enter your project name:");
27070
+ const { name, description } = getProjectInfoFromPackageJson(process.cwd());
27071
+ const projectName = await promptUser("Enter your project name:", name);
27063
27072
  if (!projectName) {
27064
- console.error(import_picocolors7.default.red("\u274C Project name cannot be empty."));
27065
- process.exit(1);
27073
+ spinner.fail(import_picocolors7.default.red("Project name cannot be empty."));
27074
+ spinner.stop();
27075
+ return;
27066
27076
  }
27067
27077
  const projectDescription = await promptUser(
27068
- "Enter project description (optional):"
27078
+ "Enter project description (optional):",
27079
+ description
27069
27080
  );
27070
27081
  const userConfig = await readConfigFile();
27071
27082
  if (!userConfig?.userId || !userConfig?.deviceId) {
27072
- console.error(
27073
- import_picocolors7.default.red("\u274C Invalid user credentials. Please log in again.")
27074
- );
27083
+ spinner.fail(import_picocolors7.default.red("Invalid user credentials. Please log in again."));
27084
+ spinner.stop();
27075
27085
  await login();
27076
27086
  return;
27077
27087
  }
27078
27088
  const envs = await readEnvFile();
27079
27089
  const encryptedEnvs = encryptEnvValues(envs, userConfig.userId);
27080
27090
  await unlinkProject(false);
27091
+ spinner.start();
27081
27092
  const client = await getConfiguredClient();
27082
27093
  const response = await client.post(`/projects/${userConfig.userId}`, {
27083
27094
  name: projectName,
@@ -27088,17 +27099,21 @@ async function createProject() {
27088
27099
  const projectId = response.data.data.id;
27089
27100
  const branchName = "main";
27090
27101
  await writeProjectConfig(projectId, branchName);
27102
+ spinner.succeed(import_picocolors7.default.green("Project created and configuration saved!"));
27091
27103
  } catch (error) {
27092
27104
  if (error.response) {
27093
- console.error(import_picocolors7.default.yellow(`
27105
+ spinner.fail(import_picocolors7.default.yellow(`
27094
27106
  ${error.response.data.error}`));
27107
+ spinner.stop();
27095
27108
  return;
27096
27109
  }
27097
- if (error.message.includes("User force closed the prompt with SIGINT")) {
27098
- console.log(import_picocolors7.default.yellow("\nProject create cancelled."));
27110
+ if (error.message && error.message.includes("User force closed the prompt with SIGINT")) {
27111
+ spinner.stop();
27112
+ spinner.fail(import_picocolors7.default.yellow("\nProject create cancelled."));
27099
27113
  return;
27100
27114
  }
27101
- console.error(import_picocolors7.default.red("\u274C Error creating project:"), error.message);
27115
+ spinner.fail(import_picocolors7.default.red("Error creating project:"));
27116
+ spinner.stop();
27102
27117
  process.exit(1);
27103
27118
  }
27104
27119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nvii",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Secure environment variable management CLI for modern development teams",
5
5
  "keywords": [
6
6
  "environment",
@@ -40,8 +40,8 @@
40
40
  "ts-node-dev": "^2.0.0",
41
41
  "tsup": "^7.3.0",
42
42
  "typescript": "^5.7.2",
43
- "@nvii/typescript-config": "0.0.0",
44
43
  "@nvii/env-helpers": "0.0.1",
44
+ "@nvii/typescript-config": "0.0.0",
45
45
  "@nvii/db": "1.0.0"
46
46
  },
47
47
  "dependencies": {