Skip to content

Commit 4461db3

Browse files
Merge pull request #643 from NativeScript/vladimirov/merge-appbuilder-fixes
Merge release in master
2 parents 728d295 + 5b8c431 commit 4461db3

6 files changed

+20
-8
lines changed

lib/declarations.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ interface IOptions extends ICommonOptions {
6565
keyStoreAlias: string;
6666
keyStoreAliasPassword: string;
6767
sdk: string;
68+
ignoreScripts: boolean;
6869
}
6970

7071
interface IProjectFilesManager {

lib/node-package-manager.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export class NodePackageManager implements INodePackageManager {
2828
}
2929

3030
public install(packageName: string, pathToSave: string, config?: any): IFuture<any> {
31+
if(this.$options.ignoreScripts) {
32+
config = config || {};
33+
config["ignore-scripts"] = true;
34+
}
35+
3136
return this.loadAndExecute("install", [pathToSave, packageName], { config: config });
3237
}
3338

lib/options.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export class Options extends commonOptionsLibPath.OptionsBase {
2727
keyStorePassword: { type: OptionType.String,},
2828
keyStoreAlias: { type: OptionType.String },
2929
keyStoreAliasPassword: { type: OptionType.String },
30-
sdk: { type: OptionType.String }
30+
sdk: { type: OptionType.String },
31+
ignoreScripts: {type: OptionType.Boolean }
3132
},
3233
path.join($hostInfo.isWindows ? process.env.LocalAppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
3334
$errors, $staticConfig);

lib/services/android-project-service.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class AndroidProjectService implements IPlatformProjectService {
189189
public isPlatformPrepared(projectRoot: string): IFuture<boolean> {
190190
return this.$fs.exists(path.join(projectRoot, "assets", constants.APP_FOLDER_NAME));
191191
}
192-
192+
193193
private getProjectPropertiesManager(filePath: string): IAndroidProjectPropertiesManager {
194194
if(!this._androidProjectPropertiesManagers[filePath]) {
195195
this._androidProjectPropertiesManagers[filePath] = this.$injector.resolve(androidProjectPropertiesManagerLib.AndroidProjectPropertiesManager, { directoryPath: filePath });
@@ -252,17 +252,18 @@ class AndroidProjectService implements IPlatformProjectService {
252252
public prepareProject(): IFuture<void> {
253253
return (() => { }).future<void>()();
254254
}
255-
255+
256256
public prepareAppResources(appResourcesDirectoryPath: string): IFuture<void> {
257257
return (() => {
258258
let resourcesDirPath = path.join(appResourcesDirectoryPath, this.platformData.normalizedPlatformName);
259-
let resourcesDirs = this.$fs.readDirectory(resourcesDirPath).wait();
259+
let valuesDirRegExp = /^values/;
260+
let resourcesDirs = this.$fs.readDirectory(resourcesDirPath).wait().filter(resDir => !resDir.match(valuesDirRegExp));
260261
_.each(resourcesDirs, resourceDir => {
261-
this.$fs.deleteDirectory(path.join(this.platformData.appResourcesDestinationDirectoryPath, resourceDir)).wait();
262+
this.$fs.deleteDirectory(path.join(this.platformData.appResourcesDestinationDirectoryPath, resourceDir)).wait();
262263
});
263264
}).future<void>()();
264265
}
265-
266+
266267
public preparePluginNativeCode(pluginData: IPluginData): IFuture<void> {
267268
return (() => {
268269
let pluginPlatformsFolderPath = this.getPluginPlatformsFolderPath(pluginData);

lib/services/platform-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class PlatformService implements IPlatformService {
169169
var appResourcesDirectoryPath = path.join(appDestinationDirectoryPath, constants.APP_RESOURCES_FOLDER_NAME);
170170
if (this.$fs.exists(appResourcesDirectoryPath).wait()) {
171171
platformData.platformProjectService.prepareAppResources(appResourcesDirectoryPath).wait();
172-
shell.cp("-R", path.join(appResourcesDirectoryPath, platformData.normalizedPlatformName, "*"), platformData.appResourcesDestinationDirectoryPath);
172+
shell.cp("-Rf", path.join(appResourcesDirectoryPath, platformData.normalizedPlatformName, "*"), platformData.appResourcesDestinationDirectoryPath);
173173
this.$fs.deleteDirectory(appResourcesDirectoryPath).wait();
174174
}
175175

lib/services/plugins-service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ export class PluginsService implements IPluginsService {
129129
}
130130

131131
public ensureAllDependenciesAreInstalled(): IFuture<void> {
132-
return this.$childProcess.exec("npm install ", { cwd: this.$projectData.projectDir });
132+
let command = "npm install ";
133+
if(this.$options.ignoreScripts) {
134+
command += "--ignore-scripts";
135+
}
136+
return this.$childProcess.exec(command, { cwd: this.$projectData.projectDir });
133137
}
134138

135139
public getAllInstalledPlugins(): IFuture<IPluginData[]> {

0 commit comments

Comments
 (0)