fabrique 1.0.13 → 1.0.21

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/.yarnrc.yml CHANGED
@@ -3,4 +3,4 @@ nodeLinker: node-modules
3
3
  unsafeHttpWhitelist:
4
4
  - localhost
5
5
 
6
- yarnPath: .yarn/releases/yarn-4.10.3.cjs
6
+ yarnPath: .yarn/releases/yarn-4.12.0.cjs
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2024 Valentin RICHARD
3
+ Copyright (c) 2025 Valentin RICHARD
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fabrique",
3
- "version": "1.0.13",
3
+ "version": "1.0.21",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "bin": "./src/index.js",
@@ -19,10 +19,10 @@
19
19
  "type": "git",
20
20
  "url": "https://github.com/lifaon74/fabrique"
21
21
  },
22
- "packageManager": "yarn@4.10.3",
22
+ "packageManager": "yarn@4.12.0",
23
23
  "devDependencies": {
24
- "@inquirer/prompts": "^7.9.0",
25
- "prettier": "^3.6.2",
24
+ "@inquirer/prompts": "^8.0.2",
25
+ "prettier": "^3.7.4",
26
26
  "prettier-plugin-organize-imports": "^4.3.0",
27
27
  "typescript": "^5.9.3"
28
28
  },
@@ -46,7 +46,7 @@ export async function create(type, name) {
46
46
  libname: await input({ message: 'Library name', default: name, required: true }),
47
47
  description: await input({ message: 'Description' }),
48
48
  author: await input({ message: 'Author' }),
49
- giturl: await input({ message: 'Git url' }),
49
+ giturl: normalizeGitUrl(await input({ message: 'Git url' })),
50
50
  };
51
51
 
52
52
  console.log(chalk.magentaBright('Initializing the library...'));
@@ -70,6 +70,26 @@ export async function create(type, name) {
70
70
  }
71
71
 
72
72
  /*---*/
73
+
74
+ /**
75
+ * Transform a git url into a valid one.
76
+ * @param {string} input
77
+ * @return {string}
78
+ */
79
+ function normalizeGitUrl(input) {
80
+ const gitUrl = new URL(input);
81
+
82
+ if (!gitUrl.pathname.endsWith('.git')) {
83
+ input = `${input}.git`;
84
+ }
85
+
86
+ if (!gitUrl.protocol.startsWith('git+')) {
87
+ input = `git+${input}`;
88
+ }
89
+
90
+ return input;
91
+ }
92
+
73
93
  /**
74
94
  * Replaces the patterns `{{name}}` from all the files found inside `cwd`.
75
95
  *