@charcoal-ui/tailwind-diff 3.1.2-beta.6 → 3.3.0-beta.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.
- package/dist/packageManager.js +3 -3
- package/dist/withPackages.d.ts +2 -2
- package/dist/withPackages.js +6 -6
- package/package.json +2 -2
- package/src/packageManager.ts +3 -3
- package/src/withPackages.ts +6 -6
package/dist/packageManager.js
CHANGED
|
@@ -8,11 +8,11 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
function detectPackageManager(base) {
|
|
11
|
-
const
|
|
11
|
+
const upperBounds = [os_1.default.homedir(), path_1.default.resolve('/')];
|
|
12
12
|
let dir = fs_1.default.statSync(base).isDirectory() ? base : path_1.default.dirname(base);
|
|
13
13
|
while (!fs_1.default.existsSync(path_1.default.join(dir, 'package.json'))) {
|
|
14
14
|
const parent = path_1.default.dirname(dir);
|
|
15
|
-
if (
|
|
15
|
+
if (upperBounds.includes(parent)) {
|
|
16
16
|
throw new Error('No node project found.');
|
|
17
17
|
}
|
|
18
18
|
dir = parent;
|
|
@@ -41,7 +41,7 @@ function detectPackageManager(base) {
|
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
dir = path_1.default.dirname(dir);
|
|
44
|
-
} while (!
|
|
44
|
+
} while (!upperBounds.includes(dir));
|
|
45
45
|
return {
|
|
46
46
|
type,
|
|
47
47
|
packageJSONPath,
|
package/dist/withPackages.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { PackageManagerInfo } from './packageManager';
|
|
|
2
2
|
/**
|
|
3
3
|
* 指定したバージョンのパッケージが存在する状態で処理を行う
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
5
|
+
* @param packageDescriptors 欲しいパッケージの一覧
|
|
6
6
|
* @param callback 実行したい処理
|
|
7
7
|
*/
|
|
8
|
-
export declare function withPackages<T>(packageManagerInfo: PackageManagerInfo,
|
|
8
|
+
export declare function withPackages<T>(packageManagerInfo: PackageManagerInfo, packageDescriptors: readonly string[], callback: () => T | Promise<T>): Promise<T>;
|
|
9
9
|
//# sourceMappingURL=withPackages.d.ts.map
|
package/dist/withPackages.js
CHANGED
|
@@ -12,11 +12,11 @@ const defer_1 = require("./defer");
|
|
|
12
12
|
/**
|
|
13
13
|
* 指定したバージョンのパッケージが存在する状態で処理を行う
|
|
14
14
|
*
|
|
15
|
-
* @param
|
|
15
|
+
* @param packageDescriptors 欲しいパッケージの一覧
|
|
16
16
|
* @param callback 実行したい処理
|
|
17
17
|
*/
|
|
18
|
-
async function withPackages(packageManagerInfo,
|
|
19
|
-
if (
|
|
18
|
+
async function withPackages(packageManagerInfo, packageDescriptors, callback) {
|
|
19
|
+
if (packageDescriptors.length === 0) {
|
|
20
20
|
return callback();
|
|
21
21
|
}
|
|
22
22
|
const deferer = (0, defer_1.createDefer)();
|
|
@@ -45,15 +45,15 @@ async function withPackages(packageManagerInfo, packageDescripters, callback) {
|
|
|
45
45
|
let cmd, recoverCmd;
|
|
46
46
|
switch (packageManagerInfo.type) {
|
|
47
47
|
case 'npm':
|
|
48
|
-
cmd = `npm install ${
|
|
48
|
+
cmd = `npm install ${packageDescriptors.join(' ')}`;
|
|
49
49
|
recoverCmd = 'npm install';
|
|
50
50
|
break;
|
|
51
51
|
case 'yarn':
|
|
52
|
-
cmd = `yarn add ${
|
|
52
|
+
cmd = `yarn add ${packageDescriptors.join(' ')}`;
|
|
53
53
|
recoverCmd = 'yarn install';
|
|
54
54
|
break;
|
|
55
55
|
case 'pnpm':
|
|
56
|
-
cmd = `pnpm add ${
|
|
56
|
+
cmd = `pnpm add ${packageDescriptors.join(' ')}`;
|
|
57
57
|
recoverCmd = 'pnpm install';
|
|
58
58
|
break;
|
|
59
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charcoal-ui/tailwind-diff",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0-beta.0",
|
|
4
4
|
"bin": "bin/tailwind-diff.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"url": "https://github.com/pixiv/charcoal.git",
|
|
26
26
|
"directory": "packages/tailwind-diff"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "aa4321ee5b76734602f8e135caa5e91388ca9403"
|
|
29
29
|
}
|
package/src/packageManager.ts
CHANGED
|
@@ -11,12 +11,12 @@ export interface PackageManagerInfo {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function detectPackageManager(base: string): PackageManagerInfo {
|
|
14
|
-
const
|
|
14
|
+
const upperBounds = [os.homedir(), path.resolve('/')]
|
|
15
15
|
let dir = fs.statSync(base).isDirectory() ? base : path.dirname(base)
|
|
16
16
|
|
|
17
17
|
while (!fs.existsSync(path.join(dir, 'package.json'))) {
|
|
18
18
|
const parent = path.dirname(dir)
|
|
19
|
-
if (
|
|
19
|
+
if (upperBounds.includes(parent)) {
|
|
20
20
|
throw new Error('No node project found.')
|
|
21
21
|
}
|
|
22
22
|
dir = parent
|
|
@@ -50,7 +50,7 @@ export function detectPackageManager(base: string): PackageManagerInfo {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
dir = path.dirname(dir)
|
|
53
|
-
} while (!
|
|
53
|
+
} while (!upperBounds.includes(dir))
|
|
54
54
|
|
|
55
55
|
return {
|
|
56
56
|
type,
|
package/src/withPackages.ts
CHANGED
|
@@ -8,15 +8,15 @@ import { PackageManagerInfo } from './packageManager'
|
|
|
8
8
|
/**
|
|
9
9
|
* 指定したバージョンのパッケージが存在する状態で処理を行う
|
|
10
10
|
*
|
|
11
|
-
* @param
|
|
11
|
+
* @param packageDescriptors 欲しいパッケージの一覧
|
|
12
12
|
* @param callback 実行したい処理
|
|
13
13
|
*/
|
|
14
14
|
export async function withPackages<T>(
|
|
15
15
|
packageManagerInfo: PackageManagerInfo,
|
|
16
|
-
|
|
16
|
+
packageDescriptors: readonly string[],
|
|
17
17
|
callback: () => T | Promise<T>
|
|
18
18
|
): Promise<T> {
|
|
19
|
-
if (
|
|
19
|
+
if (packageDescriptors.length === 0) {
|
|
20
20
|
return callback()
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -56,15 +56,15 @@ export async function withPackages<T>(
|
|
|
56
56
|
let cmd: string, recoverCmd: string
|
|
57
57
|
switch (packageManagerInfo.type) {
|
|
58
58
|
case 'npm':
|
|
59
|
-
cmd = `npm install ${
|
|
59
|
+
cmd = `npm install ${packageDescriptors.join(' ')}`
|
|
60
60
|
recoverCmd = 'npm install'
|
|
61
61
|
break
|
|
62
62
|
case 'yarn':
|
|
63
|
-
cmd = `yarn add ${
|
|
63
|
+
cmd = `yarn add ${packageDescriptors.join(' ')}`
|
|
64
64
|
recoverCmd = 'yarn install'
|
|
65
65
|
break
|
|
66
66
|
case 'pnpm':
|
|
67
|
-
cmd = `pnpm add ${
|
|
67
|
+
cmd = `pnpm add ${packageDescriptors.join(' ')}`
|
|
68
68
|
recoverCmd = 'pnpm install'
|
|
69
69
|
break
|
|
70
70
|
}
|