create-rulecad 0.1.0 → 0.1.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.
- package/index.mjs +2 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
import fs from 'node:fs';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { execSync } from 'node:child_process';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
7
8
|
|
|
8
9
|
const args = process.argv.slice(2), install = !args.includes('--no-install');
|
|
9
10
|
const dir = path.resolve(args.find((a) => !a.startsWith('--')) || 'my-designs'), name = path.basename(dir);
|
|
10
11
|
if (fs.existsSync(dir) && fs.readdirSync(dir).length) { console.error(`${dir} isn't empty: name a new folder (npm create rulecad my-designs)`); process.exit(1); }
|
|
11
12
|
|
|
12
|
-
const TEMPLATE = new URL('./template/', import.meta.url)
|
|
13
|
+
const TEMPLATE = fileURLToPath(new URL('./template/', import.meta.url));
|
|
13
14
|
fs.cpSync(TEMPLATE, dir, { recursive: true });
|
|
14
15
|
fs.renameSync(path.join(dir, 'gitignore'), path.join(dir, '.gitignore')); // npm drops files named .gitignore from packages
|
|
15
16
|
const readme = path.join(dir, 'README.md');
|
package/package.json
CHANGED