@nstudio/focus 13.0.1 → 13.4.2-rc.1
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/package.json +2 -2
- package/src/schematics/mode/index.js +5 -5
- package/src/utils/index.js +20 -20
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nstudio/focus",
|
3
|
-
"version": "13.
|
3
|
+
"version": "13.4.2-rc.1",
|
4
4
|
"description": "Focus helpers for monorepos in various IDEs",
|
5
5
|
"homepage": "https://nstudio.io/xplat",
|
6
6
|
"repository": {
|
@@ -32,7 +32,7 @@
|
|
32
32
|
"dependencies": {
|
33
33
|
"@angular-devkit/core": "^12.0.0",
|
34
34
|
"@angular-devkit/schematics": "^12.0.0",
|
35
|
-
"@nstudio/xplat-utils": "13.
|
35
|
+
"@nstudio/xplat-utils": "13.4.2-rc.1",
|
36
36
|
"xml2js": "~0.4.23"
|
37
37
|
}
|
38
38
|
}
|
@@ -8,7 +8,7 @@ let name;
|
|
8
8
|
function default_1(options) {
|
9
9
|
if (!options.name) {
|
10
10
|
name = 'fullstack';
|
11
|
-
const extraNote = xplat_utils_1.isXplatWorkspace()
|
11
|
+
const extraNote = (0, xplat_utils_1.isXplatWorkspace)()
|
12
12
|
? ` Currently supported: fullstack,${xplat_utils_1.supportedPlatformsWithNx}. Example: nx g mode nativescript`
|
13
13
|
: '';
|
14
14
|
console.warn(`Defaulting to 'fullstack' and showing everything since no focus was specified.${extraNote}`);
|
@@ -16,9 +16,9 @@ function default_1(options) {
|
|
16
16
|
else {
|
17
17
|
name = options.name;
|
18
18
|
}
|
19
|
-
return schematics_1.chain([
|
19
|
+
return (0, schematics_1.chain)([
|
20
20
|
// init xplat settings
|
21
|
-
xplat_utils_1.prerun(),
|
21
|
+
(0, xplat_utils_1.prerun)(),
|
22
22
|
// update tsconfig based on mode
|
23
23
|
// (tree: Tree) => {
|
24
24
|
// return isXplatWorkspace() ? updateExcludes(name)(tree) : noop();
|
@@ -26,7 +26,7 @@ function default_1(options) {
|
|
26
26
|
// update IDE settings
|
27
27
|
(tree, context) => {
|
28
28
|
// apps
|
29
|
-
const appPaths = xplat_utils_1.getAppPaths(tree);
|
29
|
+
const appPaths = (0, xplat_utils_1.getAppPaths)(tree);
|
30
30
|
const allApps = [];
|
31
31
|
for (const appPath of appPaths) {
|
32
32
|
allApps.push(`**${appPath}`);
|
@@ -54,7 +54,7 @@ function default_1(options) {
|
|
54
54
|
let focusOnApps = [];
|
55
55
|
if (name !== 'fullstack' && options.projects) {
|
56
56
|
focusOnApps = options.projects.split(',').map((p) => p.trim());
|
57
|
-
if (xplat_utils_1.isXplatWorkspace()) {
|
57
|
+
if ((0, xplat_utils_1.isXplatWorkspace)()) {
|
58
58
|
// allows for shorthand project/app names omitting platform from the app name
|
59
59
|
// just add platform to the name to be specific
|
60
60
|
for (let i = 0; i < focusOnApps.length; i++) {
|
package/src/utils/index.js
CHANGED
@@ -4,21 +4,21 @@ exports.FocusHelpers = void 0;
|
|
4
4
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
5
5
|
const path_1 = require("path");
|
6
6
|
const fs_1 = require("fs");
|
7
|
-
const
|
7
|
+
const devkit_1 = require("@nrwl/devkit");
|
8
8
|
const xml2js = require("xml2js");
|
9
9
|
var FocusHelpers;
|
10
10
|
(function (FocusHelpers) {
|
11
11
|
function updateIDESettings(options) {
|
12
12
|
return (tree, context) => {
|
13
|
-
if (xplat_utils_1.isTesting()) {
|
13
|
+
if ((0, xplat_utils_1.isTesting)()) {
|
14
14
|
// ignore node file modifications when just testing
|
15
15
|
return tree;
|
16
16
|
}
|
17
17
|
try {
|
18
18
|
// console.log('workspace dir:', process.cwd());
|
19
19
|
// const dirName = process.cwd().split('/').slice(-1);
|
20
|
-
const groupByName = xplat_utils_1.getGroupByName();
|
21
|
-
const framework = xplat_utils_1.getFrontendFramework();
|
20
|
+
const groupByName = (0, xplat_utils_1.getGroupByName)();
|
21
|
+
const framework = (0, xplat_utils_1.getFrontendFramework)();
|
22
22
|
let frameworkSuffix = framework ? `-${framework}` : '';
|
23
23
|
let isFullstack = false;
|
24
24
|
let isExcluding = false;
|
@@ -27,7 +27,7 @@ var FocusHelpers;
|
|
27
27
|
if (!options.devMode || options.devMode === 'fullstack') {
|
28
28
|
// show all
|
29
29
|
isFullstack = true;
|
30
|
-
if (xplat_utils_1.isXplatWorkspace()) {
|
30
|
+
if ((0, xplat_utils_1.isXplatWorkspace)()) {
|
31
31
|
for (const p of xplat_utils_1.supportedPlatformsWithNx) {
|
32
32
|
const appFilter = groupByName ? `*-${p}` : `${p}*`;
|
33
33
|
userUpdates[`**/apps/${appFilter}`] = false;
|
@@ -50,8 +50,8 @@ var FocusHelpers;
|
|
50
50
|
}
|
51
51
|
}
|
52
52
|
else if (options.platforms) {
|
53
|
-
const platforms = xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms);
|
54
|
-
if (xplat_utils_1.isXplatWorkspace()) {
|
53
|
+
const platforms = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms);
|
54
|
+
if ((0, xplat_utils_1.isXplatWorkspace)()) {
|
55
55
|
// switch on/off platforms
|
56
56
|
for (const p of xplat_utils_1.supportedPlatformsWithNx) {
|
57
57
|
const excluded = platforms.includes(p) ? false : true;
|
@@ -131,7 +131,7 @@ var FocusHelpers;
|
|
131
131
|
allPackages: options.allPackages,
|
132
132
|
isFullstack,
|
133
133
|
});
|
134
|
-
if (xplat_utils_1.isXplatWorkspace() && !options.devMode) {
|
134
|
+
if ((0, xplat_utils_1.isXplatWorkspace)() && !options.devMode) {
|
135
135
|
// only when not specifying a dev mode
|
136
136
|
const workspaceUpdates = {
|
137
137
|
'**/node_modules': true,
|
@@ -203,18 +203,18 @@ var FocusHelpers;
|
|
203
203
|
: '/var/local/Code/User/settings.json';
|
204
204
|
const windowsHome = process.env.APPDATA;
|
205
205
|
if (windowsHome) {
|
206
|
-
userSettingsVSCodePath = path_1.join(windowsHome, 'Code', 'User', 'settings.json');
|
206
|
+
userSettingsVSCodePath = (0, path_1.join)(windowsHome, 'Code', 'User', 'settings.json');
|
207
207
|
}
|
208
208
|
// console.log('userSettingsVSCodePath:',userSettingsVSCodePath);
|
209
|
-
isVsCode = fs_1.existsSync(userSettingsVSCodePath);
|
209
|
+
isVsCode = (0, fs_1.existsSync)(userSettingsVSCodePath);
|
210
210
|
let vscodeCreateSettingsNote = `It's possible you don't have a user settings.json yet. If so, open VS Code User settings and save any kind of setting to have it created.`;
|
211
211
|
// console.log('isVsCode:',isVsCode);
|
212
212
|
if (isVsCode) {
|
213
|
-
const userSettings = fs_1.readFileSync(userSettingsVSCodePath, {
|
213
|
+
const userSettings = (0, fs_1.readFileSync)(userSettingsVSCodePath, {
|
214
214
|
encoding: 'utf-8',
|
215
215
|
});
|
216
216
|
if (userSettings) {
|
217
|
-
const userSettingsJson = xplat_utils_1.jsonParse(userSettings);
|
217
|
+
const userSettingsJson = (0, xplat_utils_1.jsonParse)(userSettings);
|
218
218
|
let exclude = userSettingsJson['files.exclude'];
|
219
219
|
if (!exclude) {
|
220
220
|
exclude = {};
|
@@ -225,7 +225,7 @@ var FocusHelpers;
|
|
225
225
|
}
|
226
226
|
userSettingsJson['files.exclude'] = Object.assign(exclude, options.userUpdates);
|
227
227
|
userSettingsJson['search.exclude'] = Object.assign(searchExclude, options.userUpdates);
|
228
|
-
if (xplat_utils_1.isXplatWorkspace()) {
|
228
|
+
if ((0, xplat_utils_1.isXplatWorkspace)()) {
|
229
229
|
if (options.allApps.length) {
|
230
230
|
// always reset specific app filters
|
231
231
|
for (const app of options.allApps) {
|
@@ -271,7 +271,7 @@ var FocusHelpers;
|
|
271
271
|
}
|
272
272
|
}
|
273
273
|
}
|
274
|
-
fs_1.writeFileSync(userSettingsVSCodePath,
|
274
|
+
(0, fs_1.writeFileSync)(userSettingsVSCodePath, (0, devkit_1.serializeJson)(userSettingsJson));
|
275
275
|
// TODO: print out the updates made
|
276
276
|
// Example of how the updates are represented
|
277
277
|
// true === hidden
|
@@ -303,23 +303,23 @@ var FocusHelpers;
|
|
303
303
|
/**
|
304
304
|
* Workspace settings
|
305
305
|
*/
|
306
|
-
const workspaceSettingsPath = path_1.join(process.cwd(), '.vscode', 'settings.json');
|
306
|
+
const workspaceSettingsPath = (0, path_1.join)(process.cwd(), '.vscode', 'settings.json');
|
307
307
|
// console.log('workspaceSettingsPath:',workspaceSettingsPath);
|
308
308
|
let workspaceSettingsJson = {};
|
309
|
-
if (fs_1.existsSync(workspaceSettingsPath)) {
|
310
|
-
const workspaceSettings = fs_1.readFileSync(workspaceSettingsPath, {
|
309
|
+
if ((0, fs_1.existsSync)(workspaceSettingsPath)) {
|
310
|
+
const workspaceSettings = (0, fs_1.readFileSync)(workspaceSettingsPath, {
|
311
311
|
encoding: 'utf-8',
|
312
312
|
});
|
313
|
-
workspaceSettingsJson = xplat_utils_1.jsonParse(workspaceSettings);
|
313
|
+
workspaceSettingsJson = (0, xplat_utils_1.jsonParse)(workspaceSettings);
|
314
314
|
const exclude = workspaceSettingsJson['files.exclude'];
|
315
315
|
workspaceSettingsJson['files.exclude'] = Object.assign(exclude, options.workspaceUpdates);
|
316
316
|
}
|
317
317
|
else {
|
318
318
|
// console.log('creating workspace settings...');
|
319
|
-
fs_1.mkdirSync('.vscode');
|
319
|
+
(0, fs_1.mkdirSync)('.vscode');
|
320
320
|
workspaceSettingsJson['files.exclude'] = options.workspaceUpdates;
|
321
321
|
}
|
322
|
-
fs_1.writeFileSync(workspaceSettingsPath,
|
322
|
+
(0, fs_1.writeFileSync)(workspaceSettingsPath, (0, devkit_1.serializeJson)(workspaceSettingsJson));
|
323
323
|
}
|
324
324
|
return isVsCode;
|
325
325
|
}
|