deplift 1.2.3 → 1.3.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/README.md +9 -5
- package/dist/cjs/index.cjs +21 -7
- package/dist/esm/index.mjs +21 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -15,10 +15,14 @@ npm install -D deplift
|
|
|
15
15
|
```bash
|
|
16
16
|
npx deplift
|
|
17
17
|
|
|
18
|
+
Positionals:
|
|
19
|
+
pkgPath Path to package.json [string]
|
|
20
|
+
|
|
18
21
|
Options:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
22
|
+
--major Set major version caps: dep=version pairs
|
|
23
|
+
[array] [default: []]
|
|
24
|
+
-d, --dry-run Run without making changes [boolean] [default: false]
|
|
25
|
+
--install Run npm install [boolean] [default: true]
|
|
26
|
+
-v, --version Show version number [boolean]
|
|
27
|
+
-h, --help Show help
|
|
24
28
|
```
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var path = require('node:path');
|
|
5
|
+
var node_url = require('node:url');
|
|
5
6
|
var promises = require('node:fs/promises');
|
|
6
7
|
var node_child_process = require('node:child_process');
|
|
7
8
|
var fg = require('fast-glob');
|
|
8
9
|
var yargs = require('yargs');
|
|
9
10
|
var helpers = require('yargs/helpers');
|
|
10
11
|
|
|
12
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
13
|
+
const __dirname$1 = path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
11
14
|
const defaultIgnore = ['**/node_modules/**', '**/dist/**', '**/coverage/**', '**/build/**', '**/.next/**', '**/.docusaurus/**'];
|
|
12
15
|
const depSections = ['dependencies', 'devDependencies'];
|
|
13
16
|
const stripPrefix = version => version.replace(/^\D+/, '');
|
|
@@ -58,11 +61,16 @@ const parseArgs = async () => {
|
|
|
58
61
|
version: 'unknown'
|
|
59
62
|
};
|
|
60
63
|
try {
|
|
61
|
-
pkg = JSON.parse(await promises.readFile(path.resolve(
|
|
64
|
+
pkg = JSON.parse(await promises.readFile(path.resolve(__dirname$1, '../../package.json'), 'utf8'));
|
|
62
65
|
} catch (_unused2) {}
|
|
63
|
-
const argv = await yargs(helpers.hideBin(process.argv)).
|
|
66
|
+
const argv = await yargs(helpers.hideBin(process.argv)).command('$0 [pkgPath]', 'CLI to update deps in monorepos', yargs => {
|
|
67
|
+
yargs.positional('pkgPath', {
|
|
68
|
+
type: 'string',
|
|
69
|
+
describe: 'Path to package.json'
|
|
70
|
+
});
|
|
71
|
+
}).option('major', {
|
|
64
72
|
type: 'array',
|
|
65
|
-
describe: '
|
|
73
|
+
describe: 'Set major version caps: dep=version pairs',
|
|
66
74
|
default: [],
|
|
67
75
|
coerce: pairs => {
|
|
68
76
|
const result = {};
|
|
@@ -73,31 +81,37 @@ const parseArgs = async () => {
|
|
|
73
81
|
}
|
|
74
82
|
const key = pair.slice(0, idx);
|
|
75
83
|
const value = pair.slice(idx + 1);
|
|
76
|
-
|
|
84
|
+
const num = Number(value);
|
|
85
|
+
if (isNaN(num)) throw new Error(`Invalid --major version "${value}" for "${key}", expected a number`);
|
|
86
|
+
result[key] = num;
|
|
77
87
|
}
|
|
78
88
|
return result;
|
|
79
89
|
}
|
|
80
90
|
}).option('dry-run', {
|
|
81
91
|
type: 'boolean',
|
|
92
|
+
alias: 'd',
|
|
82
93
|
describe: 'Run without making changes',
|
|
83
94
|
default: false
|
|
84
95
|
}).option('install', {
|
|
85
96
|
type: 'boolean',
|
|
86
97
|
describe: 'Run npm install',
|
|
87
98
|
default: true
|
|
88
|
-
}).version(pkg.version).
|
|
99
|
+
}).version(pkg.version).help().alias('v', 'version').alias('h', 'help').strict().parse();
|
|
100
|
+
console.log(`[deplift] v${pkg.version}\n`);
|
|
89
101
|
return argv;
|
|
90
102
|
};
|
|
91
103
|
async function main() {
|
|
92
104
|
const {
|
|
93
105
|
dryRun,
|
|
94
106
|
install: runInstall,
|
|
95
|
-
major: majorCaps
|
|
107
|
+
major: majorCaps,
|
|
108
|
+
pkgPath
|
|
96
109
|
} = await parseArgs();
|
|
97
110
|
if (dryRun) console.log('💡 Dry run enabled — no files will be changed or installed.');
|
|
98
111
|
const config = await loadConfig();
|
|
99
112
|
const ignorePatterns = Array.isArray(config.ignore) ? Array.from(new Set([...defaultIgnore, ...config.ignore])) : defaultIgnore;
|
|
100
|
-
const
|
|
113
|
+
const searchPath = pkgPath && (pkgPath.endsWith('/') ? pkgPath : `${pkgPath}/`);
|
|
114
|
+
const packageFiles = await fg.glob(`${searchPath != null ? searchPath : '**/'}package.json`, {
|
|
101
115
|
ignore: ignorePatterns
|
|
102
116
|
});
|
|
103
117
|
if (packageFiles.length === 0) {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import path, { resolve } from 'node:path';
|
|
2
|
+
import path, { dirname, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
4
5
|
import { execSync } from 'node:child_process';
|
|
5
6
|
import fg from 'fast-glob';
|
|
6
7
|
import yargs from 'yargs';
|
|
7
8
|
import { hideBin } from 'yargs/helpers';
|
|
8
9
|
|
|
10
|
+
const __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
9
11
|
const defaultIgnore = ['**/node_modules/**', '**/dist/**', '**/coverage/**', '**/build/**', '**/.next/**', '**/.docusaurus/**'];
|
|
10
12
|
const depSections = ['dependencies', 'devDependencies'];
|
|
11
13
|
const stripPrefix = version => version.replace(/^\D+/, '');
|
|
@@ -56,11 +58,16 @@ const parseArgs = async () => {
|
|
|
56
58
|
version: 'unknown'
|
|
57
59
|
};
|
|
58
60
|
try {
|
|
59
|
-
pkg = JSON.parse(await readFile(resolve(
|
|
61
|
+
pkg = JSON.parse(await readFile(resolve(__dirname$1, '../../package.json'), 'utf8'));
|
|
60
62
|
} catch (_unused2) {}
|
|
61
|
-
const argv = await yargs(hideBin(process.argv)).
|
|
63
|
+
const argv = await yargs(hideBin(process.argv)).command('$0 [pkgPath]', 'CLI to update deps in monorepos', yargs => {
|
|
64
|
+
yargs.positional('pkgPath', {
|
|
65
|
+
type: 'string',
|
|
66
|
+
describe: 'Path to package.json'
|
|
67
|
+
});
|
|
68
|
+
}).option('major', {
|
|
62
69
|
type: 'array',
|
|
63
|
-
describe: '
|
|
70
|
+
describe: 'Set major version caps: dep=version pairs',
|
|
64
71
|
default: [],
|
|
65
72
|
coerce: pairs => {
|
|
66
73
|
const result = {};
|
|
@@ -71,31 +78,37 @@ const parseArgs = async () => {
|
|
|
71
78
|
}
|
|
72
79
|
const key = pair.slice(0, idx);
|
|
73
80
|
const value = pair.slice(idx + 1);
|
|
74
|
-
|
|
81
|
+
const num = Number(value);
|
|
82
|
+
if (isNaN(num)) throw new Error(`Invalid --major version "${value}" for "${key}", expected a number`);
|
|
83
|
+
result[key] = num;
|
|
75
84
|
}
|
|
76
85
|
return result;
|
|
77
86
|
}
|
|
78
87
|
}).option('dry-run', {
|
|
79
88
|
type: 'boolean',
|
|
89
|
+
alias: 'd',
|
|
80
90
|
describe: 'Run without making changes',
|
|
81
91
|
default: false
|
|
82
92
|
}).option('install', {
|
|
83
93
|
type: 'boolean',
|
|
84
94
|
describe: 'Run npm install',
|
|
85
95
|
default: true
|
|
86
|
-
}).version(pkg.version).
|
|
96
|
+
}).version(pkg.version).help().alias('v', 'version').alias('h', 'help').strict().parse();
|
|
97
|
+
console.log(`[deplift] v${pkg.version}\n`);
|
|
87
98
|
return argv;
|
|
88
99
|
};
|
|
89
100
|
async function main() {
|
|
90
101
|
const {
|
|
91
102
|
dryRun,
|
|
92
103
|
install: runInstall,
|
|
93
|
-
major: majorCaps
|
|
104
|
+
major: majorCaps,
|
|
105
|
+
pkgPath
|
|
94
106
|
} = await parseArgs();
|
|
95
107
|
if (dryRun) console.log('💡 Dry run enabled — no files will be changed or installed.');
|
|
96
108
|
const config = await loadConfig();
|
|
97
109
|
const ignorePatterns = Array.isArray(config.ignore) ? Array.from(new Set([...defaultIgnore, ...config.ignore])) : defaultIgnore;
|
|
98
|
-
const
|
|
110
|
+
const searchPath = pkgPath && (pkgPath.endsWith('/') ? pkgPath : `${pkgPath}/`);
|
|
111
|
+
const packageFiles = await fg.glob(`${searchPath != null ? searchPath : '**/'}package.json`, {
|
|
99
112
|
ignore: ignorePatterns
|
|
100
113
|
});
|
|
101
114
|
if (packageFiles.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deplift",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "CLI to update deps in monorepos",
|
|
5
5
|
"author": "Zheng Song",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"@babel/preset-typescript": "^7.28.5",
|
|
41
41
|
"@rollup/plugin-babel": "^6.1.0",
|
|
42
42
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
43
|
-
"@types/node": "^25.3.
|
|
43
|
+
"@types/node": "^25.3.2",
|
|
44
44
|
"@types/yargs": "^17.0.35",
|
|
45
45
|
"npm-run-all2": "^8.0.4",
|
|
46
46
|
"prettier": "^3.8.1",
|
|
47
|
-
"rollup": "^4.
|
|
47
|
+
"rollup": "^4.59.0",
|
|
48
48
|
"typescript": "^5.9.3"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|