@mschauer5/spfx-toolkit 1.0.15 → 1.0.16
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/lib/commands/index.js +3 -3
- package/lib/commands/index.js.map +1 -1
- package/lib/commands/installer.command.js +64 -0
- package/lib/commands/installer.command.js.map +1 -0
- package/lib/index.js +30 -3
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/index.ts +2 -2
- package/src/commands/installer.command.ts +55 -0
- package/src/index.ts +35 -3
- package/src/commands/install.command.ts +0 -17
package/lib/commands/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.installer = exports.openSolution = exports.scripts = exports.version = exports.eslint = exports.alias = void 0;
|
|
37
37
|
const alias = __importStar(require("./alias.command"));
|
|
38
38
|
exports.alias = alias;
|
|
39
39
|
const eslint = __importStar(require("./eslint.command"));
|
|
@@ -44,6 +44,6 @@ const scripts = __importStar(require("./scripts.command"));
|
|
|
44
44
|
exports.scripts = scripts;
|
|
45
45
|
const open_solution_command_1 = require("./open-solution.command");
|
|
46
46
|
Object.defineProperty(exports, "openSolution", { enumerable: true, get: function () { return open_solution_command_1.openSolution; } });
|
|
47
|
-
const
|
|
48
|
-
exports.
|
|
47
|
+
const installer = __importStar(require("./installer.command"));
|
|
48
|
+
exports.installer = installer;
|
|
49
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAyC;AAMhC,sBAAK;AALd,yDAA2C;AAK3B,wBAAM;AAJtB,2DAA6C;AAIrB,0BAAO;AAH/B,2DAA6C;AAGZ,0BAAO;AAFxC,mEAAuD;AAEb,6FAFjC,oCAAY,OAEiC;AADtD
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAyC;AAMhC,sBAAK;AALd,yDAA2C;AAK3B,wBAAM;AAJtB,2DAA6C;AAIrB,0BAAO;AAH/B,2DAA6C;AAGZ,0BAAO;AAFxC,mEAAuD;AAEb,6FAFjC,oCAAY,OAEiC;AADtD,+DAAiD;AACO,8BAAS"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.uninstall = exports.install = void 0;
|
|
13
|
+
const detect_package_manager_1 = require("detect-package-manager");
|
|
14
|
+
const scripts_command_1 = require("./scripts.command");
|
|
15
|
+
const logger_1 = require("../common/logger");
|
|
16
|
+
const install = (name, fromScripts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const usercommand = yield (0, detect_package_manager_1.detect)();
|
|
18
|
+
if (!fromScripts) {
|
|
19
|
+
const getScriptByNameValue = yield (0, scripts_command_1.getScriptByName)(`install:${name}`);
|
|
20
|
+
if (getScriptByNameValue !== undefined) {
|
|
21
|
+
const args = getScriptByNameValue.split(' ');
|
|
22
|
+
// add install to the command
|
|
23
|
+
args.unshift('install');
|
|
24
|
+
const spawn = require('cross-spawn');
|
|
25
|
+
spawn.sync(usercommand, args, { stdio: 'inherit' });
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
logger_1.logger.error(`No install script found with name ${name} in global or local package.json`);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const args = name.split(' ');
|
|
34
|
+
args.unshift('install');
|
|
35
|
+
const spawn = require('cross-spawn');
|
|
36
|
+
spawn.sync(usercommand, args, { stdio: 'inherit' });
|
|
37
|
+
return;
|
|
38
|
+
});
|
|
39
|
+
exports.install = install;
|
|
40
|
+
const uninstall = (name, fromScripts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
const usercommand = yield (0, detect_package_manager_1.detect)();
|
|
42
|
+
if (!fromScripts) {
|
|
43
|
+
const getScriptByNameValue = yield (0, scripts_command_1.getScriptByName)(`install:${name}`);
|
|
44
|
+
if (getScriptByNameValue !== undefined) {
|
|
45
|
+
const args = getScriptByNameValue.split(' ');
|
|
46
|
+
// add install to the command
|
|
47
|
+
args.unshift('uninstall');
|
|
48
|
+
const spawn = require('cross-spawn');
|
|
49
|
+
spawn.sync(usercommand, args, { stdio: 'inherit' });
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
logger_1.logger.error(`No install script found with name ${name} in global or local package.json so can't uninstall`);
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const args = name.split(' ');
|
|
58
|
+
args.unshift('uninstall');
|
|
59
|
+
const spawn = require('cross-spawn');
|
|
60
|
+
spawn.sync(usercommand, args, { stdio: 'inherit' });
|
|
61
|
+
return;
|
|
62
|
+
});
|
|
63
|
+
exports.uninstall = uninstall;
|
|
64
|
+
//# sourceMappingURL=installer.command.js.map
|
|
@@ -0,0 +1 @@
|
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AAM,WAAW,GAAG,MAAM,IAAA,+BAAM,GAAE,CAAC;IAEnC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,oBAAoB,GAAG,MAAM,IAAA,iCAAe,EAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QACtE,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,IAAI,GAAG,oBAAoB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7C,6BAA6B;YAC7B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAE1B,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YACpD,OAAO;QACT,CAAC;aAAM,CAAC;YACN,eAAM,CAAC,KAAK,CAAC,qCAAqC,IAAI,qDAAqD,CAAC,CAAC;QAC/G,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACrC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACpD,OAAO;AACT,CAAC,CAAA,CAAC;AAxBW,QAAA,SAAS,aAwBpB"}
|
package/lib/index.js
CHANGED
|
@@ -48,7 +48,7 @@ program
|
|
|
48
48
|
.name('Matt Schauer SPFx Toolkit')
|
|
49
49
|
.description('CLI to help with SPFx development')
|
|
50
50
|
.addHelpText('beforeAll', chalk_1.default.blueBright('Developed by Matt Schauer'))
|
|
51
|
-
.version('1.0.
|
|
51
|
+
.version('1.0.16');
|
|
52
52
|
program
|
|
53
53
|
.command('add-alias')
|
|
54
54
|
.description('add alias')
|
|
@@ -64,18 +64,21 @@ program
|
|
|
64
64
|
});
|
|
65
65
|
program
|
|
66
66
|
.command('serve')
|
|
67
|
+
.alias('s')
|
|
67
68
|
.description('Serve / Start the SPFx Project')
|
|
68
69
|
.action(() => {
|
|
69
70
|
commands.scripts.run('serve');
|
|
70
71
|
});
|
|
71
72
|
program
|
|
72
73
|
.command('build')
|
|
74
|
+
.alias('bl')
|
|
73
75
|
.description('Build Project')
|
|
74
76
|
.action(() => {
|
|
75
77
|
commands.scripts.run('build');
|
|
76
78
|
});
|
|
77
79
|
program
|
|
78
80
|
.command('bundle')
|
|
81
|
+
.alias('bn')
|
|
79
82
|
.description('Bundle Project')
|
|
80
83
|
.option('-i, --increment <part>', 'Increment package version (major, minor, patch)', (value) => {
|
|
81
84
|
if (!['major', 'minor', 'patch'].includes(value)) {
|
|
@@ -97,10 +100,34 @@ program
|
|
|
97
100
|
program
|
|
98
101
|
.command('install')
|
|
99
102
|
.alias('i')
|
|
103
|
+
.description('Run an install')
|
|
104
|
+
.addArgument(new commander.Argument('<packages>', 'script name in global config or local OR package(s) to install'))
|
|
105
|
+
.action((packages) => {
|
|
106
|
+
commands.installer.install(packages, false);
|
|
107
|
+
});
|
|
108
|
+
program
|
|
109
|
+
.command('install-script')
|
|
110
|
+
.alias('is')
|
|
100
111
|
.description('Run an install script from package.json by name')
|
|
101
|
-
.addArgument(new commander.Argument('<name>', 'script name
|
|
112
|
+
.addArgument(new commander.Argument('<name>', 'script name in global config or local to install'))
|
|
113
|
+
.action((name) => {
|
|
114
|
+
commands.installer.install(name, true);
|
|
115
|
+
});
|
|
116
|
+
program
|
|
117
|
+
.command('uninstall')
|
|
118
|
+
.alias('un')
|
|
119
|
+
.description('Run an uninstall')
|
|
120
|
+
.addArgument(new commander.Argument('<packages>', 'script name in global config or local OR package(s) to uninstall'))
|
|
121
|
+
.action((packages) => {
|
|
122
|
+
commands.installer.uninstall(packages, false);
|
|
123
|
+
});
|
|
124
|
+
program
|
|
125
|
+
.command('uninstall-script')
|
|
126
|
+
.alias('uns')
|
|
127
|
+
.description('Run an uninstall script from package.json by name')
|
|
128
|
+
.addArgument(new commander.Argument('<name>', 'script name in global config or local to uninstall'))
|
|
102
129
|
.action((name) => {
|
|
103
|
-
commands.
|
|
130
|
+
commands.installer.uninstall(name, true);
|
|
104
131
|
});
|
|
105
132
|
program
|
|
106
133
|
.command('open-global-config')
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAA0B;AAC1B,qDAAuC;AACvC,yCAAoC;AACpC,qDAAuC;AACvC,qCAAwC;AACxC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAE1C,OAAO;KACJ,IAAI,CAAC,2BAA2B,CAAC;KACjC,WAAW,CAAC,mCAAmC,CAAC;KAChD,WAAW,CAAC,WAAW,EAAE,eAAK,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC;KACvE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAErB,OAAO;KACJ,OAAO,CAAC,WAAW,CAAC;KACpB,WAAW,CAAC,WAAW,CAAC;KACxB,WAAW,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,oCAAoC,CAAC,CAAC;KACnF,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;IACf,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,mCAAmC,CAAC;KAChD,MAAM,CAAC,GAAG,EAAE;IACX,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAChD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C;QAChB,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC;SAAM,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QAC7B,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;SAAM,CAAC;QACN,eAAM,CAAC,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/commands/index.ts
CHANGED
|
@@ -3,5 +3,5 @@ import * as eslint from './eslint.command';
|
|
|
3
3
|
import * as version from './version.command';
|
|
4
4
|
import * as scripts from './scripts.command';
|
|
5
5
|
import { openSolution } from './open-solution.command';
|
|
6
|
-
import * as
|
|
7
|
-
export { alias, eslint, version, scripts, openSolution,
|
|
6
|
+
import * as installer from './installer.command';
|
|
7
|
+
export { alias, eslint, version, scripts, openSolution, installer };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { detect } from 'detect-package-manager';
|
|
2
|
+
import { getScriptByName } from './scripts.command';
|
|
3
|
+
import { logger } from '../common/logger';
|
|
4
|
+
|
|
5
|
+
export const install = async (name: string, fromScripts: boolean) => {
|
|
6
|
+
const usercommand = await detect();
|
|
7
|
+
|
|
8
|
+
if (!fromScripts) {
|
|
9
|
+
const getScriptByNameValue = await getScriptByName(`install:${name}`);
|
|
10
|
+
if (getScriptByNameValue !== undefined) {
|
|
11
|
+
const args = getScriptByNameValue.split(' ');
|
|
12
|
+
// add install to the command
|
|
13
|
+
args.unshift('install');
|
|
14
|
+
|
|
15
|
+
const spawn = require('cross-spawn');
|
|
16
|
+
spawn.sync(usercommand, args, { stdio: 'inherit' });
|
|
17
|
+
return;
|
|
18
|
+
} else {
|
|
19
|
+
logger.error(`No install script found with name ${name} in global or local package.json`);
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const args = name.split(' ');
|
|
25
|
+
args.unshift('install');
|
|
26
|
+
const spawn = require('cross-spawn');
|
|
27
|
+
spawn.sync(usercommand, args, { stdio: 'inherit' });
|
|
28
|
+
return;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const uninstall = async (name: string, fromScripts: boolean) => {
|
|
32
|
+
const usercommand = await detect();
|
|
33
|
+
|
|
34
|
+
if (!fromScripts) {
|
|
35
|
+
const getScriptByNameValue = await getScriptByName(`install:${name}`);
|
|
36
|
+
if (getScriptByNameValue !== undefined) {
|
|
37
|
+
const args = getScriptByNameValue.split(' ');
|
|
38
|
+
// add install to the command
|
|
39
|
+
args.unshift('uninstall');
|
|
40
|
+
|
|
41
|
+
const spawn = require('cross-spawn');
|
|
42
|
+
spawn.sync(usercommand, args, { stdio: 'inherit' });
|
|
43
|
+
return;
|
|
44
|
+
} else {
|
|
45
|
+
logger.error(`No install script found with name ${name} in global or local package.json so can't uninstall`);
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const args = name.split(' ');
|
|
51
|
+
args.unshift('uninstall');
|
|
52
|
+
const spawn = require('cross-spawn');
|
|
53
|
+
spawn.sync(usercommand, args, { stdio: 'inherit' });
|
|
54
|
+
return;
|
|
55
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ program
|
|
|
12
12
|
.name('Matt Schauer SPFx Toolkit')
|
|
13
13
|
.description('CLI to help with SPFx development')
|
|
14
14
|
.addHelpText('beforeAll', chalk.blueBright('Developed by Matt Schauer'))
|
|
15
|
-
.version('1.0.
|
|
15
|
+
.version('1.0.16');
|
|
16
16
|
|
|
17
17
|
program
|
|
18
18
|
.command('add-alias')
|
|
@@ -31,6 +31,7 @@ program
|
|
|
31
31
|
|
|
32
32
|
program
|
|
33
33
|
.command('serve')
|
|
34
|
+
.alias('s')
|
|
34
35
|
.description('Serve / Start the SPFx Project')
|
|
35
36
|
.action(() => {
|
|
36
37
|
commands.scripts.run('serve');
|
|
@@ -38,6 +39,7 @@ program
|
|
|
38
39
|
|
|
39
40
|
program
|
|
40
41
|
.command('build')
|
|
42
|
+
.alias('bl')
|
|
41
43
|
.description('Build Project')
|
|
42
44
|
.action(() => {
|
|
43
45
|
commands.scripts.run('build');
|
|
@@ -45,6 +47,7 @@ program
|
|
|
45
47
|
|
|
46
48
|
program
|
|
47
49
|
.command('bundle')
|
|
50
|
+
.alias('bn')
|
|
48
51
|
.description('Bundle Project')
|
|
49
52
|
.option('-i, --increment <part>', 'Increment package version (major, minor, patch)', (value: string) => {
|
|
50
53
|
if (!['major', 'minor', 'patch'].includes(value)) {
|
|
@@ -68,10 +71,39 @@ program
|
|
|
68
71
|
program
|
|
69
72
|
.command('install')
|
|
70
73
|
.alias('i')
|
|
74
|
+
.description('Run an install')
|
|
75
|
+
.addArgument(new commander.Argument('<packages>', 'script name in global config or local OR package(s) to install'))
|
|
76
|
+
.action((packages) => {
|
|
77
|
+
commands.installer.install(packages, false);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
program
|
|
81
|
+
.command('install-script')
|
|
82
|
+
.alias('is')
|
|
71
83
|
.description('Run an install script from package.json by name')
|
|
72
|
-
.addArgument(new commander.Argument('<name>', 'script name
|
|
84
|
+
.addArgument(new commander.Argument('<name>', 'script name in global config or local to install'))
|
|
85
|
+
|
|
86
|
+
.action((name) => {
|
|
87
|
+
commands.installer.install(name, true);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
program
|
|
91
|
+
.command('uninstall')
|
|
92
|
+
.alias('un')
|
|
93
|
+
.description('Run an uninstall')
|
|
94
|
+
.addArgument(new commander.Argument('<packages>', 'script name in global config or local OR package(s) to uninstall'))
|
|
95
|
+
.action((packages) => {
|
|
96
|
+
commands.installer.uninstall(packages, false);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
program
|
|
100
|
+
.command('uninstall-script')
|
|
101
|
+
.alias('uns')
|
|
102
|
+
.description('Run an uninstall script from package.json by name')
|
|
103
|
+
.addArgument(new commander.Argument('<name>', 'script name in global config or local to uninstall'))
|
|
104
|
+
|
|
73
105
|
.action((name) => {
|
|
74
|
-
commands.
|
|
106
|
+
commands.installer.uninstall(name, true);
|
|
75
107
|
});
|
|
76
108
|
|
|
77
109
|
program
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { detect } from 'detect-package-manager';
|
|
2
|
-
import { getScriptByName } from './scripts.command';
|
|
3
|
-
|
|
4
|
-
export const run = async (name: string) => {
|
|
5
|
-
const usercommand = await detect();
|
|
6
|
-
|
|
7
|
-
const getScriptByNameValue = await getScriptByName(`install:${name}`);
|
|
8
|
-
if (getScriptByNameValue !== undefined) {
|
|
9
|
-
const args = getScriptByNameValue.split(' ');
|
|
10
|
-
// add install to the command
|
|
11
|
-
args.unshift('install');
|
|
12
|
-
|
|
13
|
-
const spawn = require('cross-spawn');
|
|
14
|
-
spawn.sync(usercommand, args, { stdio: 'inherit' });
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
};
|