create-tinny-backend 1.0.1 → 1.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.
Files changed (2) hide show
  1. package/index.js +11 -7
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1,18 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const fs = require('fs-extra');
4
- const path = require('path');
5
- const { execSync } = require('child_process');
6
- const prompts = require('prompts');
7
- const { cyan, green, bold, yellow, red, gray } = require('kolorist');
8
- const ora = require('ora');
3
+ import fs from 'fs-extra';
4
+ import path from 'node:path';
5
+ import { execSync } from 'node:child_process';
6
+ import prompts from 'prompts';
7
+ import { cyan, green, bold, yellow, red, gray } from 'kolorist';
8
+ import ora from 'ora';
9
+ import { fileURLToPath } from 'node:url';
9
10
 
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
10
13
 
11
14
  const args = process.argv.slice(2);
12
15
  const projectName = args[0] || 'myapp';
13
16
  const targetDir = path.join(process.cwd(), projectName);
14
17
 
15
18
 
19
+
16
20
  if (fs.existsSync(targetDir)) {
17
21
  console.error(red(`✖ Directory "${projectName}" already exists.`));
18
22
  process.exit(1);
@@ -42,7 +46,7 @@ const header = {
42
46
 
43
47
 
44
48
  `
45
- }
49
+ };
46
50
 
47
51
 
48
52
  (async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-tinny-backend",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Scaffold a new tinny-backend project",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "author": "Yassine Ajagrou",
23
23
  "license": "ISC",
24
- "type": "commonjs",
24
+ "type": "module",
25
25
  "bugs": {
26
26
  "url": "https://github.com/iaceene/create-tinny-backend/issues"
27
27
  },