@gibme/depupdate 0.0.5

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/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2016-2022 Brandon Lehmann
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/cli.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('./dist/index');
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ // Copyright (c) 2021-2023, Brandon Lehmann <brandonlehmann@gmail.com>
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ // of this software and associated documentation files (the "Software"), to deal
6
+ // in the Software without restriction, including without limitation the rights
7
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ // copies of the Software, and to permit persons to whom the Software is
9
+ // furnished to do so, subject to the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included in all
12
+ // copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ // SOFTWARE.
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ var _a;
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ const fs_1 = require("fs");
36
+ const path_1 = require("path");
37
+ const child_process_1 = require("child_process");
38
+ const logger_1 = __importDefault(require("@gibme/logger"));
39
+ const cwd = (_a = process.cwd()) !== null && _a !== void 0 ? _a : './';
40
+ const run = (cmd) => __awaiter(void 0, void 0, void 0, function* () {
41
+ return new Promise(resolve => {
42
+ (0, child_process_1.exec)(cmd, (error, stdout, stderr) => {
43
+ return resolve([stdout, stderr, error]);
44
+ });
45
+ });
46
+ });
47
+ const format_dep = (dependencies, latest = false) => (latest ? dependencies.map(dep => `${dep}@latest`) : dependencies)
48
+ .join(' ');
49
+ (() => __awaiter(void 0, void 0, void 0, function* () {
50
+ var _b, _c, _d, _e;
51
+ const is_yarn = (0, fs_1.existsSync)((0, path_1.resolve)(cwd, './yarn.lock'));
52
+ const is_npm = (0, fs_1.existsSync)((0, path_1.resolve)(cwd, './package-lock.json'));
53
+ const latest = process.argv.map(e => e.toLowerCase().trim())
54
+ .includes('latest');
55
+ const config = require((0, path_1.resolve)(cwd, './package.json'));
56
+ const dependencies = Object.keys((_b = config.dependencies) !== null && _b !== void 0 ? _b : []);
57
+ const devDependencies = Object.keys((_c = config.devDependencies) !== null && _c !== void 0 ? _c : []);
58
+ const peerDependencies = Object.keys((_d = config.peerDependencies) !== null && _d !== void 0 ? _d : []);
59
+ const optionalDependencies = Object.keys((_e = config.optionalDependencies) !== null && _e !== void 0 ? _e : []);
60
+ let cmd = 'yarn';
61
+ if (is_npm && is_yarn) {
62
+ logger_1.default.error('Cannot run while both yarn.lock and package-lock.json both exist...');
63
+ return process.exit(1);
64
+ }
65
+ else if (is_npm) {
66
+ logger_1.default.warn('NPM detected...');
67
+ if (latest) {
68
+ cmd = 'npm install --save';
69
+ }
70
+ else {
71
+ cmd = 'npm update --save';
72
+ }
73
+ }
74
+ else if (is_yarn) {
75
+ logger_1.default.warn('Yarn detected...');
76
+ }
77
+ else {
78
+ logger_1.default.error('Cannot detect package management system');
79
+ return process.exit(1);
80
+ }
81
+ if (latest) {
82
+ logger_1.default.warn('Set to update all dependencies to the latest version...');
83
+ }
84
+ else {
85
+ logger_1.default.warn('Set to update all dependencies to latest version within the rules in package.json...');
86
+ }
87
+ if (!is_yarn) {
88
+ if (dependencies.length !== 0) {
89
+ logger_1.default.info('Updating %s dependencies...', dependencies.length);
90
+ const [stdout] = yield run(`${cmd} ${format_dep(dependencies, latest)}`);
91
+ stdout.split('\n')
92
+ .map(line => logger_1.default.debug(line));
93
+ }
94
+ if (devDependencies.length !== 0) {
95
+ logger_1.default.info('Updating %s development dependencies...', devDependencies.length);
96
+ const [stdout] = yield run(`${cmd} --dev ${format_dep(devDependencies, latest)}`);
97
+ stdout.split('\n')
98
+ .map(line => logger_1.default.debug(line));
99
+ }
100
+ if (peerDependencies.length !== 0) {
101
+ logger_1.default.info('Updating %s peer dependencies...', peerDependencies.length);
102
+ const [stdout] = yield run(`${cmd} --dev ${format_dep(peerDependencies, latest)}`);
103
+ stdout.split('\n')
104
+ .map(line => logger_1.default.debug(line));
105
+ }
106
+ if (optionalDependencies.length !== 0) {
107
+ logger_1.default.info('Updating %s dependencies...', optionalDependencies.length);
108
+ const [stdout] = yield run(`${cmd} ${format_dep(optionalDependencies, latest)}`);
109
+ stdout.split('\n')
110
+ .map(line => logger_1.default.debug(line));
111
+ }
112
+ }
113
+ else {
114
+ logger_1.default.info('Updating %s dependencies', dependencies.length + devDependencies.length + peerDependencies.length + optionalDependencies.length);
115
+ const [stdout] = yield run(`${cmd} upgrade${latest ? ' --latest' : ''}`);
116
+ stdout.split('\n')
117
+ .map(line => logger_1.default.debug(line));
118
+ }
119
+ logger_1.default.warn('Running audit checks...');
120
+ if (is_npm) {
121
+ const [stdout, stderr, error] = yield run('npm audit fix');
122
+ stdout.split('\n')
123
+ .map(line => logger_1.default.debug(line));
124
+ if (error || stderr.length !== 0) {
125
+ stderr.split('\n')
126
+ .map(line => logger_1.default.error(line));
127
+ }
128
+ }
129
+ else {
130
+ const [stdout, stderr, error] = yield run('yarn audit');
131
+ stdout.split('\n')
132
+ .map(line => logger_1.default.debug(line));
133
+ if (error || stderr.length !== 0) {
134
+ stderr.split('\n')
135
+ .map(line => logger_1.default.error(line));
136
+ }
137
+ }
138
+ }))();
139
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,EAAE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CAAC,CAAC,CAAC;QAErC,IAAI,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;iBACb,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;SACxC;KACJ;SAAM;QACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,CAAC;QAExD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;aACb,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAErC,IAAI,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;iBACb,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;SACxC;KACJ;AACL,CAAC,CAAA,CAAC,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@gibme/depupdate",
3
+ "version": "0.0.5",
4
+ "description": "Webpack with a twist",
5
+ "bin": {
6
+ "depupdate": "cli.js"
7
+ },
8
+ "files": [
9
+ "dist/*",
10
+ "cli.js"
11
+ ],
12
+ "license": "MIT",
13
+ "scripts": {
14
+ "build": "yarn build:typescript",
15
+ "build:docs": "./node_modules/.bin/typedoc",
16
+ "build:typescript": "./node_modules/.bin/tsc",
17
+ "test": "yarn test:style && yarn test:mocha",
18
+ "test:style": "yarn style",
19
+ "test:mocha": "./node_modules/.bin/mocha --exit --timeout 30000 --require ts-node/register test/test.ts",
20
+ "style": "./node_modules/.bin/eslint src/**/*.ts test/**/*.ts",
21
+ "fix-style": "./node_modules/.bin/eslint --fix src/**/*.ts test/**/*.ts",
22
+ "fix:style": "yarn fix-style",
23
+ "prepublishOnly": "yarn build"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/depupdate/webpack.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/gibme-npm/depupdate/issues"
31
+ },
32
+ "engines": {
33
+ "node": ">=16"
34
+ },
35
+ "engineStrict": true,
36
+ "author": {
37
+ "name": "Brandon Lehmann",
38
+ "email": "brandonlehmann@gmail.com"
39
+ },
40
+ "dependencies": {
41
+ "@gibme/logger": "^1.0.2"
42
+ },
43
+ "devDependencies": {
44
+ "@types/mocha": "^10.0.0",
45
+ "@types/node": "^18.15.11",
46
+ "@typescript-eslint/eslint-plugin": "^5.42.0",
47
+ "@typescript-eslint/parser": "^5.42.0",
48
+ "eslint": "^8.26.0",
49
+ "eslint-config-standard": "^17.0.0",
50
+ "eslint-plugin-import": "^2.26.0",
51
+ "eslint-plugin-n": "^15.4.0",
52
+ "eslint-plugin-node": "^11.1.0",
53
+ "eslint-plugin-promise": "^6.1.1",
54
+ "mocha": "^10.1.0",
55
+ "ts-node": "^10.9.1",
56
+ "typedoc": "^0.23.28",
57
+ "typescript": "^5.0.3"
58
+ }
59
+ }