@mateoserrano/simple-config 1.1.1 → 1.1.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.
- package/package.json +1 -1
- package/src/constants.js +6 -1
- package/src/core/deps.js +3 -3
- package/src/core/utils/urls.js +4 -2
- package/src/functions.js +3 -3
package/package.json
CHANGED
package/src/constants.js
CHANGED
|
@@ -64,4 +64,9 @@ export const devDepFiles = {
|
|
|
64
64
|
}
|
|
65
65
|
export const addHuskyPrepare = 'npm pkg set scripts.prepare="husky"'
|
|
66
66
|
export const installCmd = (installNames) => `npm install -D ${installNames.join(' ')} --save-exact`
|
|
67
|
-
export const setupHuskyCommand = '
|
|
67
|
+
export const setupHuskyCommand = 'echo "' +
|
|
68
|
+
'#!/usr/bin/env sh\n' +
|
|
69
|
+
'. "$(dirname -- "$0")/_/husky.sh"\n\n' +
|
|
70
|
+
'npx lint-staged"' +
|
|
71
|
+
'> .husky/pre-commit'
|
|
72
|
+
export const authorizeHuskyCommand = 'chmod +x .husky/pre-commit'
|
package/src/core/deps.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPackageRoot, moveFromPath } from './utils/index.js'
|
|
2
2
|
import { copyFileToFolderOrSkip } from './files.js'
|
|
3
3
|
|
|
4
4
|
export const getTemplatesFolder = (templatesRelativePath) => {
|
|
5
|
-
const
|
|
6
|
-
return moveFromPath(
|
|
5
|
+
const packageRoot = getPackageRoot()
|
|
6
|
+
return moveFromPath(packageRoot, templatesRelativePath)
|
|
7
7
|
}
|
|
8
8
|
export const getInstallNames = (devDeps) =>
|
|
9
9
|
Object.values(devDeps).map((dep) => `${dep.package}@${dep.version}`)
|
package/src/core/utils/urls.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import { resolve } from "node:path";
|
|
2
3
|
|
|
3
|
-
export function
|
|
4
|
-
|
|
4
|
+
export function getPackageRoot() {
|
|
5
|
+
const currentDir = fileURLToPath(new URL('.', import.meta.url))
|
|
6
|
+
return resolve(currentDir, '..', '..')
|
|
5
7
|
}
|
package/src/functions.js
CHANGED
|
@@ -2,12 +2,11 @@ import {
|
|
|
2
2
|
copyFilesToTargetOrSkip,
|
|
3
3
|
getInstallNames,
|
|
4
4
|
getTemplatesFolder,
|
|
5
|
-
runCommand,
|
|
6
5
|
runCommandSilent,
|
|
7
6
|
verifyNodePackage,
|
|
8
7
|
} from './core/index.js'
|
|
9
8
|
import {
|
|
10
|
-
addHuskyPrepare,
|
|
9
|
+
addHuskyPrepare, authorizeHuskyCommand,
|
|
11
10
|
devDepFiles,
|
|
12
11
|
devDeps,
|
|
13
12
|
installCmd,
|
|
@@ -17,7 +16,8 @@ import {
|
|
|
17
16
|
const runAddPrepareCommand = () => runCommandSilent(addHuskyPrepare)
|
|
18
17
|
const runInstallCommand = (installNames) => runCommandSilent(installCmd(installNames))
|
|
19
18
|
const runHuskyCommand = () => {
|
|
20
|
-
|
|
19
|
+
runCommandSilent(setupHuskyCommand)
|
|
20
|
+
runCommandSilent(authorizeHuskyCommand)
|
|
21
21
|
}
|
|
22
22
|
const getInstallationArguments = () => getInstallNames(devDeps)
|
|
23
23
|
|