Skip to content

Commit 3975f1a

Browse files
committed
Merge remote-tracking branch 'nativescript/master'
2 parents 3ef5d47 + 3a71e79 commit 3975f1a

File tree

9 files changed

+68
-18
lines changed

9 files changed

+68
-18
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## [8.3.3](https://github.com/NativeScript/nativescript-cli/compare/v8.3.2...v8.3.3) (2022-08-22)
2+
3+
4+
### Bug Fixes
5+
6+
* **console:** disable long line splitting ([be8274d](https://github.com/NativeScript/nativescript-cli/commit/be8274d7dce5f9d43a4aa3bf78d6beb414115dfc))
7+
* **preview:** windows spawn error ([f737579](https://github.com/NativeScript/nativescript-cli/commit/f73757929550f54fca4509f597da4dd746297ba7))
8+
9+
10+
### Features
11+
12+
* ensure App_Resources exists before running ([#5689](https://github.com/NativeScript/nativescript-cli/issues/5689)) ([ba8dd58](https://github.com/NativeScript/nativescript-cli/commit/ba8dd58e289c0e2b8a3bc847a4c8a4e5d1bc0d73))
13+
14+
15+
116
## [8.3.2](https://github.com/NativeScript/nativescript-cli/compare/v8.3.1...v8.3.2) (2022-07-31)
217

318

lib/commands/preview.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,13 @@ export class PreviewCommand implements ICommand {
8282

8383
const commandIndex = process.argv.indexOf("preview");
8484
const commandArgs = process.argv.slice(commandIndex + 1);
85-
this.$childProcess.spawn(previewCLIBinPath, commandArgs, {
86-
stdio: "inherit",
87-
});
85+
this.$childProcess.spawn(
86+
process.execPath,
87+
[previewCLIBinPath, ...commandArgs],
88+
{
89+
stdio: "inherit",
90+
}
91+
);
8892
}
8993

9094
async canExecute(args: string[]): Promise<boolean> {

lib/common/mobile/device-log-provider.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,26 @@ export class DeviceLogProvider extends DeviceLogProviderBase {
155155
}
156156

157157
private printLine(prefix: string, ...parts: string[]) {
158-
const maxWidth = process.stdout.columns - 2;
159158
const fullLine = parts.join(" ");
160-
161-
// console.log(prefix, fullLine);
162-
// return;
163-
if (!maxWidth || maxWidth < 10 || fullLine.length < maxWidth) {
164-
console.log(prefix, fullLine);
165-
} else {
166-
for (let i = 0; i < fullLine.length; i += maxWidth) {
167-
const part = fullLine.substring(i, i + maxWidth);
168-
console.log(prefix, part);
169-
}
170-
}
159+
console.log(prefix, fullLine);
160+
161+
/**
162+
* Note: Disabled
163+
*
164+
* This splits the output into lines that fit within the current
165+
* terminal width, however this makes copying json objects that
166+
* span across multiple lines difficult, as it introduces
167+
* whitespace & line breaks
168+
*/
169+
// const maxWidth = process.stdout.columns - 2;
170+
// if (!maxWidth || maxWidth < 10 || fullLine.length < maxWidth) {
171+
// console.log(prefix, fullLine);
172+
// } else {
173+
// for (let i = 0; i < fullLine.length; i += maxWidth) {
174+
// const part = fullLine.substring(i, i + maxWidth);
175+
// console.log(prefix, part);
176+
// }
177+
// }
171178
}
172179
}
173180
injector.register("deviceLogProvider", DeviceLogProvider);

lib/controllers/prepare-controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
IProjectConfigService,
1919
IProjectData,
2020
IProjectDataService,
21+
IProjectService,
2122
} from "../definitions/project";
2223
import {
2324
INodeModulesDependenciesBuilder,
@@ -64,7 +65,8 @@ export class PrepareController extends EventEmitter {
6465
private $watchIgnoreListService: IWatchIgnoreListService,
6566
private $analyticsService: IAnalyticsService,
6667
private $markingModeService: IMarkingModeService,
67-
private $projectConfigService: IProjectConfigService
68+
private $projectConfigService: IProjectConfigService,
69+
private $projectService: IProjectService
6870
) {
6971
super();
7072
}
@@ -127,6 +129,7 @@ export class PrepareController extends EventEmitter {
127129
prepareData: IPrepareData,
128130
projectData: IProjectData
129131
): Promise<IPrepareResultData> {
132+
await this.$projectService.ensureAppResourcesExist(projectData.projectDir);
130133
await this.$platformController.addPlatformIfNeeded(
131134
prepareData,
132135
projectData

lib/definitions/project.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ interface IProjectService {
8888
* @returns {boolean} returns true if the project is valid NativeScript project.
8989
*/
9090
isValidNativeScriptProject(pathToProject?: string): boolean;
91+
92+
/**
93+
* Checks if App_Resources exists, or pulls down a fresh set
94+
* from the default template otherwise.
95+
* @param {string} projectDir
96+
*/
97+
ensureAppResourcesExist(projectDir: string): Promise<void>;
9198
}
9299

93100
interface INsConfigPlaform {

lib/services/project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export class ProjectService implements IProjectService {
224224
}
225225

226226
@performanceLog()
227-
private async ensureAppResourcesExist(projectDir: string): Promise<void> {
227+
public async ensureAppResourcesExist(projectDir: string): Promise<void> {
228228
const projectData = this.$projectDataService.getProjectData(projectDir);
229229
const appResourcesDestinationPath = projectData.getAppResourcesDirectoryPath(
230230
projectDir

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "nativescript",
33
"preferGlobal": true,
4-
"version": "8.3.2",
4+
"version": "8.3.3",
55
"author": "NativeScript <support@nativescript.org>",
66
"description": "Command-line interface for building NativeScript projects",
77
"bin": {

test/controllers/prepare-controller.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const prepareData = {
1919
let isCompileWithWatchCalled = false;
2020
let isCompileWithoutWatchCalled = false;
2121
let isNativePrepareCalled = false;
22+
let isEnsuringAppResourcesExist = false;
2223
let emittedEventNames: string[] = [];
2324
let emittedEventData: any[] = [];
2425

@@ -64,6 +65,12 @@ function createTestInjector(data: { hasNativeChanges: boolean }): IInjector {
6465
});
6566

6667
injector.register("tempService", TempServiceStub);
68+
injector.register("projectService", {
69+
ensureAppResourcesExist(projectDir: string): Promise<void> {
70+
isEnsuringAppResourcesExist = true;
71+
return;
72+
},
73+
});
6774

6875
const prepareController: PrepareController = injector.resolve(
6976
"prepareController"
@@ -84,6 +91,7 @@ describe("prepareController", () => {
8491
isNativePrepareCalled = false;
8592
isCompileWithWatchCalled = false;
8693
isCompileWithoutWatchCalled = false;
94+
isEnsuringAppResourcesExist = false;
8795

8896
emittedEventNames = [];
8997
emittedEventData = [];
@@ -102,6 +110,7 @@ describe("prepareController", () => {
102110

103111
assert.isTrue(isCompileWithWatchCalled);
104112
assert.isTrue(isNativePrepareCalled);
113+
assert.isTrue(isEnsuringAppResourcesExist);
105114
});
106115
});
107116
it(`should respect native changes that are made before the initial preparation of the project had been done for ${platform}`, async () => {
@@ -161,6 +170,7 @@ describe("prepareController", () => {
161170
assert.isTrue(isNativePrepareCalled);
162171
assert.isTrue(isCompileWithoutWatchCalled);
163172
assert.isFalse(isCompileWithWatchCalled);
173+
assert.isTrue(isEnsuringAppResourcesExist);
164174
});
165175
});
166176
});

test/project-commands.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ class ProjectServiceMock implements IProjectService {
9696
isValidNativeScriptProject(pathToProject?: string): boolean {
9797
return true;
9898
}
99+
100+
ensureAppResourcesExist(projectDir: string): Promise<void> {
101+
return;
102+
}
99103
}
100104

101105
class ProjectNameValidatorMock implements IProjectNameValidator {

0 commit comments

Comments
 (0)