notra-editor 1.0.0-beta.2 → 1.0.0

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.

Potentially problematic release.


This version of notra-editor might be problematic. Click here for more details.

package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- #!/usr/bin/env node
1
+
2
+ export { }
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- #!/usr/bin/env node
3
2
 
4
3
  // src/index.ts
5
4
  import { Command } from "commander";
@@ -35,24 +34,35 @@ async function fetchRegistry(url) {
35
34
  }
36
35
  }
37
36
 
37
+ // src/utils/validator.ts
38
+ import { existsSync } from "fs";
39
+ import { join } from "path";
40
+ function validateProject(cwd = process.cwd()) {
41
+ const packageJsonPath = join(cwd, "package.json");
42
+ if (existsSync(packageJsonPath)) {
43
+ return { valid: true };
44
+ }
45
+ return {
46
+ valid: false,
47
+ error: "package.json not found. Please run this command in a project root directory."
48
+ };
49
+ }
50
+
38
51
  // src/utils/conflict.ts
39
- import { existsSync, readdirSync } from "fs";
40
- import { join, isAbsolute } from "path";
52
+ import { existsSync as existsSync2, readdirSync } from "fs";
53
+ import { join as join2, isAbsolute } from "path";
41
54
  function detectConflicts(targetDir, cwd = process.cwd()) {
42
- const absolutePath = isAbsolute(targetDir) ? targetDir : join(cwd, targetDir);
43
- if (!existsSync(absolutePath)) {
55
+ const absolutePath = isAbsolute(targetDir) ? targetDir : join2(cwd, targetDir);
56
+ if (!existsSync2(absolutePath)) {
44
57
  return {
45
58
  hasConflict: false,
46
59
  existingFiles: []
47
60
  };
48
61
  }
49
- const files = readdirSync(absolutePath, {
50
- recursive: true,
51
- withFileTypes: true
52
- }).filter((dirent) => dirent.isFile()).map((dirent) => {
62
+ const files = readdirSync(absolutePath, { recursive: true, withFileTypes: true }).filter((dirent) => dirent.isFile()).map((dirent) => {
53
63
  const parentPath = dirent.parentPath || dirent.path;
54
64
  const relativePath = parentPath.replace(absolutePath, "").replace(/^[/\\]/, "");
55
- return relativePath ? join(relativePath, dirent.name) : dirent.name;
65
+ return relativePath ? join2(relativePath, dirent.name) : dirent.name;
56
66
  });
57
67
  return {
58
68
  hasConflict: files.length > 0,
@@ -62,13 +72,13 @@ function detectConflicts(targetDir, cwd = process.cwd()) {
62
72
 
63
73
  // src/utils/copier.ts
64
74
  import { writeFileSync, mkdirSync } from "fs";
65
- import { join as join2, dirname, isAbsolute as isAbsolute2 } from "path";
75
+ import { join as join3, dirname, isAbsolute as isAbsolute2 } from "path";
66
76
  async function copyFiles(files, targetDir, cwd = process.cwd()) {
67
77
  const copiedFiles = [];
68
- const absoluteTargetDir = isAbsolute2(targetDir) ? targetDir : join2(cwd, targetDir);
78
+ const absoluteTargetDir = isAbsolute2(targetDir) ? targetDir : join3(cwd, targetDir);
69
79
  try {
70
80
  for (const file of files) {
71
- const targetPath = join2(absoluteTargetDir, file.path);
81
+ const targetPath = join3(absoluteTargetDir, file.path);
72
82
  const targetDirPath = dirname(targetPath);
73
83
  mkdirSync(targetDirPath, { recursive: true });
74
84
  writeFileSync(targetPath, file.content, "utf-8");
@@ -118,30 +128,9 @@ async function installDependencies(dependencies, cwd = process.cwd()) {
118
128
  }
119
129
  }
120
130
 
121
- // src/utils/prompts.ts
122
- import prompts from "prompts";
123
- function isInteractive() {
124
- return process.stdin.isTTY === true;
125
- }
126
- async function confirmOverwrite(targetDir) {
127
- if (!isInteractive()) {
128
- return false;
129
- }
130
- const response = await prompts({
131
- type: "confirm",
132
- name: "overwrite",
133
- message: `Directory "${targetDir}" already exists. Do you want to overwrite it?`,
134
- initial: false
135
- });
136
- if (response.overwrite === void 0) {
137
- return false;
138
- }
139
- return response.overwrite;
140
- }
141
-
142
131
  // src/utils/ui.ts
143
- import kleur from "kleur";
144
132
  import ora from "ora";
133
+ import kleur from "kleur";
145
134
  function createSpinner() {
146
135
  const spinner = ora();
147
136
  return {
@@ -169,18 +158,25 @@ function info(message) {
169
158
  console.log(kleur.cyan(message));
170
159
  }
171
160
 
172
- // src/utils/validator.ts
173
- import { existsSync as existsSync2 } from "fs";
174
- import { join as join3 } from "path";
175
- function validateProject(cwd = process.cwd()) {
176
- const packageJsonPath = join3(cwd, "package.json");
177
- if (existsSync2(packageJsonPath)) {
178
- return { valid: true };
161
+ // src/utils/prompts.ts
162
+ import prompts from "prompts";
163
+ function isInteractive() {
164
+ return process.stdin.isTTY === true;
165
+ }
166
+ async function confirmOverwrite(targetDir) {
167
+ if (!isInteractive()) {
168
+ return false;
179
169
  }
180
- return {
181
- valid: false,
182
- error: "package.json not found. Please run this command in a project root directory."
183
- };
170
+ const response = await prompts({
171
+ type: "confirm",
172
+ name: "overwrite",
173
+ message: `Directory "${targetDir}" already exists. Do you want to overwrite it?`,
174
+ initial: false
175
+ });
176
+ if (response.overwrite === void 0) {
177
+ return false;
178
+ }
179
+ return response.overwrite;
184
180
  }
185
181
 
186
182
  // src/commands/init.ts
@@ -199,9 +195,7 @@ async function initCommand(options = {}) {
199
195
  if (options.force) {
200
196
  info(`Overwriting existing files in ${CONSTANTS.TARGET_DIR}...`);
201
197
  } else if (!isInteractive()) {
202
- error(
203
- `Directory "${CONSTANTS.TARGET_DIR}" already exists. Use --force to overwrite.`
204
- );
198
+ error(`Directory "${CONSTANTS.TARGET_DIR}" already exists. Use --force to overwrite.`);
205
199
  process.exit(1);
206
200
  } else {
207
201
  const shouldOverwrite = await confirmOverwrite(CONSTANTS.TARGET_DIR);
@@ -216,9 +210,7 @@ async function initCommand(options = {}) {
216
210
  const fetchResult = await fetchRegistry(registryUrl);
217
211
  if (!fetchResult.success || !fetchResult.data) {
218
212
  spinner.fail("Failed to fetch registry");
219
- error(
220
- fetchResult.error || "Network request failed. Please check your internet connection."
221
- );
213
+ error(fetchResult.error || "Network request failed. Please check your internet connection.");
222
214
  process.exit(1);
223
215
  }
224
216
  spinner.succeed("Registry fetched successfully");
@@ -227,14 +219,10 @@ async function initCommand(options = {}) {
227
219
  const copyResult = await copyFiles(registry.files, CONSTANTS.TARGET_DIR);
228
220
  if (!copyResult.success) {
229
221
  spinner.fail("Failed to copy files");
230
- error(
231
- copyResult.error || "File write failed. Please check directory permissions."
232
- );
222
+ error(copyResult.error || "File write failed. Please check directory permissions.");
233
223
  process.exit(1);
234
224
  }
235
- spinner.succeed(
236
- `Copied ${copyResult.copiedFiles.length} files to ${CONSTANTS.TARGET_DIR}`
237
- );
225
+ spinner.succeed(`Copied ${copyResult.copiedFiles.length} files to ${CONSTANTS.TARGET_DIR}`);
238
226
  if (registry.dependencies.length > 0) {
239
227
  spinner.start("Installing dependencies...");
240
228
  const installResult = await installDependencies(registry.dependencies);
package/package.json CHANGED
@@ -1,53 +1,42 @@
1
- {
2
- "name": "notra-editor",
3
- "type": "module",
4
- "version": "1.0.0-beta.2",
5
- "description": "CLI tool to scaffold notra-editor into your project",
6
- "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/Levix0501/notra-editor.git",
10
- "directory": "packages/cli"
11
- },
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "keywords": [
16
- "tiptap",
17
- "editor",
18
- "cli",
19
- "scaffold"
20
- ],
21
- "bin": {
22
- "notra-editor": "./dist/index.js"
23
- },
24
- "files": [
25
- "dist"
26
- ],
27
- "engines": {
28
- "node": ">=18"
29
- },
30
- "dependencies": {
31
- "commander": "^14.0.0",
32
- "kleur": "^4.1.5",
33
- "ora": "^8.2.0",
34
- "prompts": "^2.4.2"
35
- },
36
- "devDependencies": {
37
- "@types/node": "^20",
38
- "@types/prompts": "^2.4.9",
39
- "fast-check": "^3.19.0",
40
- "tsup": "^8.5.0",
41
- "typescript": "^5",
42
- "vitest": "^4.0.18"
43
- },
44
- "scripts": {
45
- "build": "tsup",
46
- "dev": "tsup --watch",
47
- "test": "vitest run",
48
- "test:watch": "vitest",
49
- "release": "changeset version",
50
- "pub:beta": "pnpm build && pnpm publish --no-git-checks --access public --tag beta",
51
- "pub:release": "pnpm build && pnpm publish --access public"
52
- }
53
- }
1
+ {
2
+ "name": "notra-editor",
3
+ "version": "1.0.0",
4
+ "description": "CLI tool to scaffold notra-editor into your project",
5
+ "type": "module",
6
+ "bin": {
7
+ "notra-editor": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsup",
14
+ "dev": "tsup --watch",
15
+ "test": "vitest run",
16
+ "test:watch": "vitest"
17
+ },
18
+ "dependencies": {
19
+ "commander": "^14.0.0",
20
+ "kleur": "^4.1.5",
21
+ "ora": "^8.2.0",
22
+ "prompts": "^2.4.2"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^20",
26
+ "@types/prompts": "^2.4.9",
27
+ "fast-check": "^3.19.0",
28
+ "tsup": "^8.5.0",
29
+ "typescript": "^5",
30
+ "vitest": "^4.0.18"
31
+ },
32
+ "engines": {
33
+ "node": ">=18"
34
+ },
35
+ "keywords": [
36
+ "tiptap",
37
+ "editor",
38
+ "cli",
39
+ "scaffold"
40
+ ],
41
+ "license": "MIT"
42
+ }