@mschauer5/spfx-toolkit 1.0.26 → 1.0.28
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/.vscode/settings.json +22 -22
- package/LICENSE +21 -21
- package/README.md +72 -72
- package/lib/commands/index.js +5 -3
- package/lib/commands/index.js.map +1 -1
- package/lib/commands/{open-solution.command.js → open.command.js} +29 -4
- package/lib/commands/open.command.js.map +1 -0
- package/lib/commands/projects.command.js +46 -0
- package/lib/commands/projects.command.js.map +1 -0
- package/lib/commands/repo.command.js +7 -18
- package/lib/commands/repo.command.js.map +1 -1
- package/lib/common/util.js +13 -1
- package/lib/common/util.js.map +1 -1
- package/lib/index.js +36 -9
- package/lib/index.js.map +1 -1
- package/package.json +8 -3
- package/src/commands/env.commands.ts +63 -63
- package/src/commands/index.ts +12 -10
- package/src/commands/installer.command.ts +134 -134
- package/src/commands/nvmrc.command.ts +76 -76
- package/src/commands/open.command.ts +51 -0
- package/src/commands/projects.command.ts +37 -0
- package/src/commands/repo.command.ts +206 -218
- package/src/commands/scripts.command.ts +139 -139
- package/src/common/index.ts +5 -5
- package/src/common/util.ts +114 -104
- package/src/index.ts +261 -230
- package/lib/commands/install.command.js +0 -28
- package/lib/commands/install.command.js.map +0 -1
- package/lib/commands/open-solution.command.js.map +0 -1
- package/lib/commands/serve.command.js +0 -27
- package/lib/commands/serve.command.js.map +0 -1
- package/lib/commands/settings.js +0 -68
- package/lib/commands/settings.js.map +0 -1
- package/lib/package.json +0 -45
- package/lib/src/commands/alias.command.js +0 -104
- package/lib/src/commands/alias.command.js.map +0 -1
- package/lib/src/commands/build.command.js +0 -61
- package/lib/src/commands/build.command.js.map +0 -1
- package/lib/src/commands/bundle.command.js +0 -70
- package/lib/src/commands/bundle.command.js.map +0 -1
- package/lib/src/commands/eslint.command.js +0 -34
- package/lib/src/commands/eslint.command.js.map +0 -1
- package/lib/src/commands/index.js +0 -49
- package/lib/src/commands/index.js.map +0 -1
- package/lib/src/commands/serve.command.js +0 -27
- package/lib/src/commands/serve.command.js.map +0 -1
- package/lib/src/commands/version.command.js +0 -98
- package/lib/src/commands/version.command.js.map +0 -1
- package/lib/src/common/constants.js +0 -10
- package/lib/src/common/constants.js.map +0 -1
- package/lib/src/common/index.js +0 -43
- package/lib/src/common/index.js.map +0 -1
- package/lib/src/common/logger.js +0 -42
- package/lib/src/common/logger.js.map +0 -1
- package/lib/src/common/util.js +0 -80
- package/lib/src/common/util.js.map +0 -1
- package/lib/src/index.js +0 -146
- package/lib/src/index.js.map +0 -1
- package/lib/test/index.test.js +0 -17
- package/lib/test/index.test.js.map +0 -1
- package/mschauer5-spfx-toolkit-1.0.25.tgz +0 -0
- package/src/commands/open-solution.command.ts +0 -25
package/.vscode/settings.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"workbench.colorCustomizations": {
|
|
3
|
-
"activityBar.activeBackground": "#3399ff",
|
|
4
|
-
"activityBar.background": "#3399ff",
|
|
5
|
-
"activityBar.foreground": "#15202b",
|
|
6
|
-
"activityBar.inactiveForeground": "#15202b99",
|
|
7
|
-
"activityBarBadge.background": "#bf0060",
|
|
8
|
-
"activityBarBadge.foreground": "#e7e7e7",
|
|
9
|
-
"commandCenter.border": "#e7e7e799",
|
|
10
|
-
"sash.hoverBorder": "#3399ff",
|
|
11
|
-
"statusBar.background": "#007fff",
|
|
12
|
-
"statusBar.foreground": "#e7e7e7",
|
|
13
|
-
"statusBarItem.hoverBackground": "#3399ff",
|
|
14
|
-
"statusBarItem.remoteBackground": "#007fff",
|
|
15
|
-
"statusBarItem.remoteForeground": "#e7e7e7",
|
|
16
|
-
"titleBar.activeBackground": "#007fff",
|
|
17
|
-
"titleBar.activeForeground": "#e7e7e7",
|
|
18
|
-
"titleBar.inactiveBackground": "#007fff99",
|
|
19
|
-
"titleBar.inactiveForeground": "#e7e7e799"
|
|
20
|
-
},
|
|
21
|
-
"peacock.color": "#007fff"
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"workbench.colorCustomizations": {
|
|
3
|
+
"activityBar.activeBackground": "#3399ff",
|
|
4
|
+
"activityBar.background": "#3399ff",
|
|
5
|
+
"activityBar.foreground": "#15202b",
|
|
6
|
+
"activityBar.inactiveForeground": "#15202b99",
|
|
7
|
+
"activityBarBadge.background": "#bf0060",
|
|
8
|
+
"activityBarBadge.foreground": "#e7e7e7",
|
|
9
|
+
"commandCenter.border": "#e7e7e799",
|
|
10
|
+
"sash.hoverBorder": "#3399ff",
|
|
11
|
+
"statusBar.background": "#007fff",
|
|
12
|
+
"statusBar.foreground": "#e7e7e7",
|
|
13
|
+
"statusBarItem.hoverBackground": "#3399ff",
|
|
14
|
+
"statusBarItem.remoteBackground": "#007fff",
|
|
15
|
+
"statusBarItem.remoteForeground": "#e7e7e7",
|
|
16
|
+
"titleBar.activeBackground": "#007fff",
|
|
17
|
+
"titleBar.activeForeground": "#e7e7e7",
|
|
18
|
+
"titleBar.inactiveBackground": "#007fff99",
|
|
19
|
+
"titleBar.inactiveForeground": "#e7e7e799"
|
|
20
|
+
},
|
|
21
|
+
"peacock.color": "#007fff"
|
|
22
|
+
}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Matt Schauer
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Matt Schauer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
# SPFx Toolkit
|
|
2
|
-
|
|
3
|
-
A CLI toolkit to help with SharePoint Framework (SPFx) project development, supporting both classic (gulp) and modern (Heft) build systems.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- Add and clear shell aliases for the toolkit
|
|
8
|
-
- Build and bundle SPFx projects (auto-detects Gulp or Heft)
|
|
9
|
-
- Serve/start the SPFx dev server
|
|
10
|
-
- Backup and restore ESLint config
|
|
11
|
-
- Version management for SPFx projects
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
```sh
|
|
16
|
-
npm install -g @mschauer5/spfx-toolkit
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
After installation, run:
|
|
22
|
-
|
|
23
|
-
```sh
|
|
24
|
-
spfx-toolkit --help
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Common Commands
|
|
28
|
-
|
|
29
|
-
- `spfx-toolkit build` — Build the project (auto-detects Gulp or Heft)
|
|
30
|
-
- `spfx-toolkit bundle [--increment <part>]` — Bundle the project (auto-detects Gulp or Heft, optionally increment version)
|
|
31
|
-
- `spfx-toolkit serve` — Start the SPFx dev server
|
|
32
|
-
- `spfx-toolkit add-alias <name>` — Add a shell alias for the toolkit
|
|
33
|
-
- `spfx-toolkit clear-alias` — Remove the shell alias for the toolkit
|
|
34
|
-
- `spfx-toolkit run <name>` — Run a script from package.json by name
|
|
35
|
-
- `spfx-toolkit open-global-config` — Open the global package.json for toolkit scripts in VS Code
|
|
36
|
-
- `spfx-toolkit global-config-init [--force]` — Initialize global package.json with default scripts (use --force to overwrite)
|
|
37
|
-
- `spfx-toolkit sync-script <name> <global|local>` — Sync a script name between global and local package.json
|
|
38
|
-
- `spfx-toolkit open-solution` — Open the solution folder in VS Code
|
|
39
|
-
- `spfx-toolkit set-heft-dotenv-plugin` — Installs and configures dotenv plugin for Heft
|
|
40
|
-
- `spfx-toolkit eslint --backup|--restore` — Backup or restore ESLint config
|
|
41
|
-
- `spfx-toolkit version --list|--sync|--increment <part>` — Version management
|
|
42
|
-
|
|
43
|
-
## Example
|
|
44
|
-
|
|
45
|
-
```sh
|
|
46
|
-
spfx-toolkit build
|
|
47
|
-
spfx-toolkit bundle
|
|
48
|
-
spfx-toolkit serve
|
|
49
|
-
spfx-toolkit add-alias st
|
|
50
|
-
spfx-toolkit clear-alias
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Requirements
|
|
54
|
-
|
|
55
|
-
- Node.js 18+
|
|
56
|
-
- For SPFx 1.22+ projects, Heft must be installed in your project
|
|
57
|
-
- For older SPFx projects, Gulp must be installed
|
|
58
|
-
- npm install -g @rushstack/heft to run heft commands from this tool
|
|
59
|
-
|
|
60
|
-
## License
|
|
61
|
-
|
|
62
|
-
MIT
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
**Disclaimer:**
|
|
67
|
-
|
|
68
|
-
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
Developed by Matt Schauer
|
|
1
|
+
# SPFx Toolkit
|
|
2
|
+
|
|
3
|
+
A CLI toolkit to help with SharePoint Framework (SPFx) project development, supporting both classic (gulp) and modern (Heft) build systems.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Add and clear shell aliases for the toolkit
|
|
8
|
+
- Build and bundle SPFx projects (auto-detects Gulp or Heft)
|
|
9
|
+
- Serve/start the SPFx dev server
|
|
10
|
+
- Backup and restore ESLint config
|
|
11
|
+
- Version management for SPFx projects
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install -g @mschauer5/spfx-toolkit
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
After installation, run:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
spfx-toolkit --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Common Commands
|
|
28
|
+
|
|
29
|
+
- `spfx-toolkit build` — Build the project (auto-detects Gulp or Heft)
|
|
30
|
+
- `spfx-toolkit bundle [--increment <part>]` — Bundle the project (auto-detects Gulp or Heft, optionally increment version)
|
|
31
|
+
- `spfx-toolkit serve` — Start the SPFx dev server
|
|
32
|
+
- `spfx-toolkit add-alias <name>` — Add a shell alias for the toolkit
|
|
33
|
+
- `spfx-toolkit clear-alias` — Remove the shell alias for the toolkit
|
|
34
|
+
- `spfx-toolkit run <name>` — Run a script from package.json by name
|
|
35
|
+
- `spfx-toolkit open-global-config` — Open the global package.json for toolkit scripts in VS Code
|
|
36
|
+
- `spfx-toolkit global-config-init [--force]` — Initialize global package.json with default scripts (use --force to overwrite)
|
|
37
|
+
- `spfx-toolkit sync-script <name> <global|local>` — Sync a script name between global and local package.json
|
|
38
|
+
- `spfx-toolkit open-solution` — Open the solution folder in VS Code
|
|
39
|
+
- `spfx-toolkit set-heft-dotenv-plugin` — Installs and configures dotenv plugin for Heft
|
|
40
|
+
- `spfx-toolkit eslint --backup|--restore` — Backup or restore ESLint config
|
|
41
|
+
- `spfx-toolkit version --list|--sync|--increment <part>` — Version management
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
spfx-toolkit build
|
|
47
|
+
spfx-toolkit bundle
|
|
48
|
+
spfx-toolkit serve
|
|
49
|
+
spfx-toolkit add-alias st
|
|
50
|
+
spfx-toolkit clear-alias
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Requirements
|
|
54
|
+
|
|
55
|
+
- Node.js 18+
|
|
56
|
+
- For SPFx 1.22+ projects, Heft must be installed in your project
|
|
57
|
+
- For older SPFx projects, Gulp must be installed
|
|
58
|
+
- npm install -g @rushstack/heft to run heft commands from this tool
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
**Disclaimer:**
|
|
67
|
+
|
|
68
|
+
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
Developed by Matt Schauer
|
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.repo = exports.envCommands = exports.nvmrc = exports.installer = exports.
|
|
36
|
+
exports.projects = exports.repo = exports.envCommands = exports.nvmrc = exports.installer = exports.open = exports.scripts = exports.version = exports.env = 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"));
|
|
@@ -42,8 +42,8 @@ const version = __importStar(require("./version.command"));
|
|
|
42
42
|
exports.version = version;
|
|
43
43
|
const scripts = __importStar(require("./scripts.command"));
|
|
44
44
|
exports.scripts = scripts;
|
|
45
|
-
const
|
|
46
|
-
|
|
45
|
+
const open = __importStar(require("./open.command"));
|
|
46
|
+
exports.open = open;
|
|
47
47
|
const installer = __importStar(require("./installer.command"));
|
|
48
48
|
exports.installer = installer;
|
|
49
49
|
const nvmrc = __importStar(require("./nvmrc.command"));
|
|
@@ -52,4 +52,6 @@ const envCommands = __importStar(require("./env.commands"));
|
|
|
52
52
|
exports.envCommands = envCommands;
|
|
53
53
|
const repo = __importStar(require("./repo.command"));
|
|
54
54
|
exports.repo = repo;
|
|
55
|
+
const projects = __importStar(require("./projects.command"));
|
|
56
|
+
exports.projects = projects;
|
|
55
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAyC;AAWhC,sBAAK;AAVd,yDAA2C;AAUjB,qBAAG;AAT7B,2DAA6C;AASd,0BAAO;AARtC,2DAA6C;AAQL,0BAAO;AAP/C,qDAAuC;AAOU,oBAAI;AANrD,+DAAiD;AAMM,8BAAS;AALhE,uDAAyC;AAKyB,sBAAK;AAJvE,4DAA8C;AAI2B,kCAAW;AAHpF,qDAAuC;AAG+C,oBAAI;AAF1F,6DAA+C;AAE6C,4BAAQ"}
|
|
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.vs = exports.directory = exports.solution = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const child_process_1 = __importDefault(require("child_process"));
|
|
9
9
|
const common_1 = require("../common");
|
|
10
|
-
const
|
|
10
|
+
const solution = () => {
|
|
11
11
|
let solutionPath = path_1.default.resolve(common_1.constants.WORKING_DIRECTORY, 'sharepoint', 'solution');
|
|
12
12
|
var cmd = ``;
|
|
13
13
|
switch (require(`os`).platform().toLowerCase().replace(/[0-9]/g, ``).replace(`darwin`, `macos`)) {
|
|
@@ -26,5 +26,30 @@ const openSolution = () => {
|
|
|
26
26
|
}
|
|
27
27
|
child_process_1.default.spawn(cmd, [solutionPath]);
|
|
28
28
|
};
|
|
29
|
-
exports.
|
|
30
|
-
|
|
29
|
+
exports.solution = solution;
|
|
30
|
+
const directory = () => {
|
|
31
|
+
let path = process.cwd();
|
|
32
|
+
var cmd = ``;
|
|
33
|
+
switch (require(`os`).platform().toLowerCase().replace(/[0-9]/g, ``).replace(`darwin`, `macos`)) {
|
|
34
|
+
case `win`:
|
|
35
|
+
path = path || '=';
|
|
36
|
+
cmd = `explorer`;
|
|
37
|
+
break;
|
|
38
|
+
case `linux`:
|
|
39
|
+
path = path || '/';
|
|
40
|
+
cmd = `xdg-open`;
|
|
41
|
+
break;
|
|
42
|
+
case `macos`:
|
|
43
|
+
path = path || '/';
|
|
44
|
+
cmd = `open`;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
child_process_1.default.spawn(cmd, [path]);
|
|
48
|
+
};
|
|
49
|
+
exports.directory = directory;
|
|
50
|
+
const vs = () => {
|
|
51
|
+
let path = process.cwd();
|
|
52
|
+
common_1.util.openVSCodeInDirectory(path);
|
|
53
|
+
};
|
|
54
|
+
exports.vs = vs;
|
|
55
|
+
//# sourceMappingURL=open.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.command.js","sourceRoot":"","sources":["../../src/commands/open.command.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,kEAAuC;AACvC,sCAA4C;AAErC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,IAAI,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,kBAAS,CAAC,iBAAiB,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;IAEvF,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,QAAQ,OAAO,CAAC,IAAI,CAAC,CAA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AAC,CAAC;AAChC,CAAC,CAAC;AAnBW,QAAA,SAAS,aAmBpB;AAEK,MAAM,EAAE,GAAG,GAAG,EAAE;IACrB,IAAI,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACzB,aAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;AAHW,QAAA,EAAE,MAGb"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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.openProject = exports.addProject = void 0;
|
|
13
|
+
const logger_1 = require("../common/logger");
|
|
14
|
+
const fs_1 = require("fs");
|
|
15
|
+
const util_1 = require("../common/util");
|
|
16
|
+
const util_2 = require("../common/util");
|
|
17
|
+
const addProject = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const path = process.cwd();
|
|
19
|
+
if (!name) {
|
|
20
|
+
name = path.split('\\').pop();
|
|
21
|
+
}
|
|
22
|
+
yield (0, util_1.ensureGlobalPackageJsonExists)();
|
|
23
|
+
const { configPath } = (0, util_1.getGlobalConfigPaths)();
|
|
24
|
+
const packageJsonContent = yield fs_1.promises.readFile(configPath, 'utf-8');
|
|
25
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
26
|
+
if (!packageJson.projects) {
|
|
27
|
+
packageJson.projects = {};
|
|
28
|
+
}
|
|
29
|
+
packageJson.projects[name] = path;
|
|
30
|
+
yield fs_1.promises.writeFile(configPath, JSON.stringify(packageJson, null, 2), 'utf-8');
|
|
31
|
+
logger_1.logger.success(`Project '${name}' added for path: ${path}`);
|
|
32
|
+
});
|
|
33
|
+
exports.addProject = addProject;
|
|
34
|
+
const openProject = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
const { configPath } = (0, util_1.getGlobalConfigPaths)();
|
|
36
|
+
const packageJsonContent = yield fs_1.promises.readFile(configPath, 'utf-8');
|
|
37
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
38
|
+
if (!packageJson.projects || !packageJson.projects[name]) {
|
|
39
|
+
logger_1.logger.error(`Project name '${name}' not found in global package.json!`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const projectPath = packageJson.projects[name];
|
|
43
|
+
(0, util_2.openVSCodeInDirectory)(projectPath);
|
|
44
|
+
});
|
|
45
|
+
exports.openProject = openProject;
|
|
46
|
+
//# sourceMappingURL=projects.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects.command.js","sourceRoot":"","sources":["../../src/commands/projects.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA0C;AAC1C,2BAA4C;AAC5C,yCAAqF;AACrF,yCAAuD;AAEhD,MAAM,UAAU,GAAG,CAAO,IAAY,EAAE,EAAE;IAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC3B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;IAChC,CAAC;IACD,MAAM,IAAA,oCAA6B,GAAE,CAAC;IAEtC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,2BAAoB,GAAE,CAAC;IAC9C,MAAM,kBAAkB,GAAG,MAAM,a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|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.goToRepo = exports.
|
|
15
|
+
exports.goToRepo = exports.SetRepo = exports.getRepo = void 0;
|
|
16
16
|
const logger_1 = require("../common/logger");
|
|
17
17
|
const common_1 = require("../common");
|
|
18
18
|
const fs_1 = require("fs");
|
|
19
19
|
const path_1 = __importDefault(require("path"));
|
|
20
20
|
const readline_1 = __importDefault(require("readline"));
|
|
21
21
|
const chalk_1 = __importDefault(require("chalk"));
|
|
22
|
+
const util_1 = require("../common/util");
|
|
22
23
|
const codeEmoji = '</>';
|
|
23
24
|
const dirEmpoji = '📁 ';
|
|
24
|
-
const openVSCodeInDirectory = (directory) => {
|
|
25
|
-
const spawn = require('child_process').spawn;
|
|
26
|
-
// Open the selected directory in VS Code
|
|
27
|
-
spawn(process.platform === 'win32' ? 'code.cmd' : 'code', [directory], {
|
|
28
|
-
stdio: 'inherit',
|
|
29
|
-
shell: true
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
25
|
const displayOptions = (location) => {
|
|
33
26
|
const fs = require('fs');
|
|
34
27
|
const rootPackageJsonPath = path_1.default.join(location, 'package.json');
|
|
35
28
|
const hasPackageJson = fs.existsSync(rootPackageJsonPath);
|
|
36
29
|
if (hasPackageJson) {
|
|
37
|
-
openVSCodeInDirectory(location);
|
|
30
|
+
(0, util_1.openVSCodeInDirectory)(location);
|
|
38
31
|
return;
|
|
39
32
|
}
|
|
40
33
|
const childDirs = fs.readdirSync(location).filter((file) => {
|
|
@@ -63,7 +56,7 @@ const displayOptions = (location) => {
|
|
|
63
56
|
const newPath = options[idx].path;
|
|
64
57
|
if (options[idx].hasPackageJson || vsFlag) {
|
|
65
58
|
// Valid selection or forced VS Code open
|
|
66
|
-
openVSCodeInDirectory(newPath);
|
|
59
|
+
(0, util_1.openVSCodeInDirectory)(newPath);
|
|
67
60
|
rl.close();
|
|
68
61
|
return;
|
|
69
62
|
}
|
|
@@ -76,7 +69,7 @@ const displayOptions = (location) => {
|
|
|
76
69
|
}
|
|
77
70
|
else if (numPart === '0') {
|
|
78
71
|
if (vsFlag) {
|
|
79
|
-
openVSCodeInDirectory(location);
|
|
72
|
+
(0, util_1.openVSCodeInDirectory)(location);
|
|
80
73
|
}
|
|
81
74
|
rl.close();
|
|
82
75
|
return;
|
|
@@ -130,7 +123,7 @@ const findDirectory = (location, chars) => {
|
|
|
130
123
|
const idx = parseInt(numPart, 10) - 1;
|
|
131
124
|
if (idx >= 0 && idx < options.length) {
|
|
132
125
|
if (vsFlag) {
|
|
133
|
-
openVSCodeInDirectory(options[idx].path);
|
|
126
|
+
(0, util_1.openVSCodeInDirectory)(options[idx].path);
|
|
134
127
|
rl.close();
|
|
135
128
|
resolve('***');
|
|
136
129
|
return;
|
|
@@ -141,7 +134,7 @@ const findDirectory = (location, chars) => {
|
|
|
141
134
|
}
|
|
142
135
|
else if (numPart === '0') {
|
|
143
136
|
if (vsFlag) {
|
|
144
|
-
openVSCodeInDirectory(location);
|
|
137
|
+
(0, util_1.openVSCodeInDirectory)(location);
|
|
145
138
|
rl.close();
|
|
146
139
|
resolve('***');
|
|
147
140
|
return;
|
|
@@ -192,10 +185,6 @@ const SetRepo = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
192
185
|
yield fs_1.promises.writeFile(globalPath.configPath, JSON.stringify(packageJson, null, 2), 'utf-8');
|
|
193
186
|
});
|
|
194
187
|
exports.SetRepo = SetRepo;
|
|
195
|
-
const goToRepoFromProject = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
196
|
-
logger_1.logger.info('Looking for repository from global package.json based on project shortcut...');
|
|
197
|
-
});
|
|
198
|
-
exports.goToRepoFromProject = goToRepoFromProject;
|
|
199
188
|
const goToRepo = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
200
189
|
const repo = yield (0, exports.getRepo)();
|
|
201
190
|
if (repo === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.command.js","sourceRoot":"","sources":["../../src/commands/repo.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA0C;AAC1C,sCAAiC;AACjC,2BAA4C;AAC5C,gDAAwB;AACxB,wDAAgC;AAChC,kDAA0B;
|
|
1
|
+
{"version":3,"file":"repo.command.js","sourceRoot":"","sources":["../../src/commands/repo.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA0C;AAC1C,sCAAiC;AACjC,2BAA4C;AAC5C,gDAAwB;AACxB,wDAAgC;AAChC,kDAA0B;AAC1B,yCAAuD;AAEvD,MAAM,SAAS,GAAG,KAAK,CAAC;AACxB,MAAM,SAAS,GAAG,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC1C,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAChE,MAAM,cAAc,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAC1D,IAAI,cAAc,EAAE,CAAC;QACnB,IAAA,4BAAqB,EAAC,QAAQ,CAAC,CAAC;QAChC,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,IAAY,EAAE,EAAE;QACjE,OAAO,EAAE,CAAC,QAAQ,CAAC,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE;QAC3D,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC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,EAAE,GAAG,CAAC,CAAC;QAClD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,eAAM,CAAC,KAAK,CAAC,sCAAsC,GAAG,aAAa,CAAC,CAAC;YACrE,OAAO;QACT,CAAC;aAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,8CAA8C;YAC9C,2DAA2D;YAC3D,OAAO;QACT,CAAC;IACH,CAAC;IACD,cAAc,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC,CAAA,CAAC;AA1BW,QAAA,QAAQ,YA0BnB"}
|
package/lib/common/util.js
CHANGED
|
@@ -12,9 +12,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.openVSCodeInDirectory = void 0;
|
|
15
16
|
exports.checkIfFileExistsAsync = checkIfFileExistsAsync;
|
|
16
17
|
exports.getGlobalConfigPaths = getGlobalConfigPaths;
|
|
17
18
|
exports.isUsingGulp = isUsingGulp;
|
|
19
|
+
exports.ensureGlobalPackageJsonExists = ensureGlobalPackageJsonExists;
|
|
18
20
|
exports.openGlobalPackageJsonInEditor = openGlobalPackageJsonInEditor;
|
|
19
21
|
exports.initGlobalPackageJsonWithDefaults = initGlobalPackageJsonWithDefaults;
|
|
20
22
|
const fs_1 = require("fs");
|
|
@@ -49,6 +51,7 @@ function ensureGlobalPackageJsonExists() {
|
|
|
49
51
|
const { configDir, configPath } = getGlobalConfigPaths();
|
|
50
52
|
const exists = yield checkIfFileExistsAsync(configPath, false);
|
|
51
53
|
if (!exists) {
|
|
54
|
+
logger_1.logger.info('Global package.json for spfx-toolkit not found. Creating one...');
|
|
52
55
|
// Create the directory if it doesn't exist and then create an empty package.json
|
|
53
56
|
yield fs_1.promises.mkdir(configDir, { recursive: true });
|
|
54
57
|
yield fs_1.promises.writeFile(configPath, JSON.stringify({ scripts: {} }, null, 2), 'utf-8');
|
|
@@ -70,7 +73,7 @@ function openGlobalPackageJsonInEditor() {
|
|
|
70
73
|
function initGlobalPackageJsonWithDefaults(force) {
|
|
71
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
75
|
const { configPath } = getGlobalConfigPaths();
|
|
73
|
-
ensureGlobalPackageJsonExists();
|
|
76
|
+
yield ensureGlobalPackageJsonExists();
|
|
74
77
|
const defaultScripts = {
|
|
75
78
|
'build:gulp': 'gulp build',
|
|
76
79
|
'build:heft': 'heft build',
|
|
@@ -113,4 +116,13 @@ function initGlobalPackageJsonWithDefaults(force) {
|
|
|
113
116
|
logger_1.logger.success(`Global package.json initialized at ${configPath}`);
|
|
114
117
|
});
|
|
115
118
|
}
|
|
119
|
+
const openVSCodeInDirectory = (directory) => {
|
|
120
|
+
const spawn = require('child_process').spawn;
|
|
121
|
+
// Open the selected directory in VS Code
|
|
122
|
+
spawn(process.platform === 'win32' ? 'code.cmd' : 'code', [directory], {
|
|
123
|
+
stdio: 'inherit',
|
|
124
|
+
shell: true
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
exports.openVSCodeInDirectory = openVSCodeInDirectory;
|
|
116
128
|
//# sourceMappingURL=util.js.map
|
package/lib/common/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/common/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/common/util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMA,wDASC;AAED,oDAKC;AAED,kCAGC;AAED,sEAYC;AAED,sEAUC;AAED,8EAiDC;AAxGD,2BAA4C;AAC5C,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,qCAAkC;AAElC,SAAsB,sBAAsB;yDAAC,QAAgB,EAAE,YAAY,GAAG,IAAI;QAChF,IAAI,CAAC,YAAE,CAA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
|
.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.27');
|
|
52
52
|
program
|
|
53
53
|
.command('add-alias')
|
|
54
54
|
.description('add alias')
|
|
@@ -56,6 +56,25 @@ program
|
|
|
56
56
|
.action((name) => {
|
|
57
57
|
commands.alias.addAlias(name, defaultToolkitName);
|
|
58
58
|
});
|
|
59
|
+
program
|
|
60
|
+
.command('add-project')
|
|
61
|
+
.description('add project shortcut')
|
|
62
|
+
.addArgument(new commander.Argument('[name]', 'give the project a name or default to folder name'))
|
|
63
|
+
.action((name) => {
|
|
64
|
+
commands.projects.addProject(name);
|
|
65
|
+
});
|
|
66
|
+
program
|
|
67
|
+
.command('open-project')
|
|
68
|
+
.alias('op')
|
|
69
|
+
.description('open project')
|
|
70
|
+
.addArgument(new commander.Argument('[name]', 'project name to open'))
|
|
71
|
+
.action((name) => {
|
|
72
|
+
if (!name) {
|
|
73
|
+
common_1.logger.error('Project name is required.');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
commands.projects.openProject(name);
|
|
77
|
+
});
|
|
59
78
|
program
|
|
60
79
|
.command('clear-alias')
|
|
61
80
|
.description('remove any alias for spfx-toolkit')
|
|
@@ -71,13 +90,7 @@ program
|
|
|
71
90
|
program
|
|
72
91
|
.command('repo [args...]')
|
|
73
92
|
.description('Go to repository location')
|
|
74
|
-
.
|
|
75
|
-
.action((args, options) => {
|
|
76
|
-
console.log('options:', options);
|
|
77
|
-
if (options.project) {
|
|
78
|
-
commands.repo.goToRepoFromProject(Array.isArray(args) ? args : []);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
93
|
+
.action((args) => {
|
|
81
94
|
commands.repo.goToRepo(Array.isArray(args) ? args : []);
|
|
82
95
|
});
|
|
83
96
|
program
|
|
@@ -191,7 +204,21 @@ program
|
|
|
191
204
|
.alias('os')
|
|
192
205
|
.description('Open solution folder')
|
|
193
206
|
.action(() => {
|
|
194
|
-
commands.
|
|
207
|
+
commands.open.solution();
|
|
208
|
+
});
|
|
209
|
+
program
|
|
210
|
+
.command('open-directory')
|
|
211
|
+
.alias('od')
|
|
212
|
+
.description('Open directory folder')
|
|
213
|
+
.action(() => {
|
|
214
|
+
commands.open.directory();
|
|
215
|
+
});
|
|
216
|
+
program
|
|
217
|
+
.command('open-vs')
|
|
218
|
+
.alias('vs')
|
|
219
|
+
.description('Open current directory in VS Code')
|
|
220
|
+
.action(() => {
|
|
221
|
+
commands.open.vs();
|
|
195
222
|
});
|
|
196
223
|
program
|
|
197
224
|
.command('eslint')
|