Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/definitions/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export interface IReleaseNativeScriptCommand extends IReleaseBaseCommand {
keystorePassword?: string;
keystoreAlias?: string;
keystoreAliasPassword?: string;
appResourcesPath?: string;
}

export interface IRollbackCommand extends ICommand {
Expand Down
26 changes: 21 additions & 5 deletions cli/script/command-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1478,24 +1478,34 @@ export var releaseNativeScript = (command: cli.IReleaseNativeScriptCommand): Pro
throw new Error("Unable to find or read \"package.json\" in the CWD. The \"release\" command must be executed in a NativeScript project folder.");
}

if (!projectPackageJson.nativescript) {
//ns 7 files
var projectRoot: string = process.cwd();
var tsConfig = path.join(projectRoot, 'nativescript.config.ts');
var jsConfig = path.join(projectRoot, 'nativescript.config.js');

if (!(fs.existsSync(tsConfig) || fs.existsSync(jsConfig) || projectPackageJson.nativescript)) {
throw new Error("The project in the CWD is not a NativeScript project.");
}

var platform: string = command.platform.toLowerCase();
var projectRoot: string = process.cwd();
var platformFolder: string = path.join(projectRoot, "platforms", platform);
var iOSFolder = path.basename(projectRoot).replace(/[-]+/g, ''); // removes dashes
var outputFolder: string;
var appResourcesFolder: string = path.join(projectRoot, "app", "App_Resources");
var appResourcesFolder: string;
var nsConfigPackageJson: any;
try {
nsConfigPackageJson = require(path.join(process.cwd(), "nsconfig.json"));
if (nsConfigPackageJson.appResourcesPath) {
appResourcesFolder = path.join(projectRoot, nsConfigPackageJson.appResourcesPath);
}
} catch (ignore) {
// no nsconfig.json found, so using defaults for app and app_resources folders
// no nsconfig.json found, so ns7 project
// no easy way to find appResources folder so using defaults or rely on options paramter "appResourcesPath"
if(command.appResourcesPath) {
appResourcesFolder = path.join(projectRoot,command.appResourcesPath);
} else {
appResourcesFolder = path.join(projectRoot, "App_Resources")
}
}

if (platform === "ios") {
Expand All @@ -1516,7 +1526,13 @@ export var releaseNativeScript = (command: cli.IReleaseNativeScriptCommand): Pro
try {
which.sync(nativeScriptCLI);
} catch (e) {
throw new Error(`Unable to run "${nativeScriptCLI} ${nativeScriptCommand}". Please ensure that the NativeScript CLI is installed.`);
//try for ns7 or up
try {
nativeScriptCLI = "ns"
which.sync(nativeScriptCLI);
} catch(e) {
throw new Error(`Unable to run "${nativeScriptCLI} ${nativeScriptCommand}". Please ensure that the NativeScript CLI is installed.`);
}
}

var nativeScriptCommand: string = "build " + platform;
Expand Down
2 changes: 2 additions & 0 deletions cli/script/command-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ var argv = yargs.usage(USAGE_PREFIX + " <command>")
.option("noDuplicateReleaseError", { default: false, demand: false, description: "When this flag is set, releasing a package that is identical to the latest release will produce a warning instead of an error", type: "boolean" })
.option("rollout", { alias: "r", default: "100%", demand: false, description: "Percentage of users this release should be immediately available to", type: "string" })
.option("targetBinaryVersion", { alias: "t", default: null, demand: false, description: "Semver expression that specifies the binary app version(s) this release is targeting (e.g. 1.1.0, ~1.2.3). If omitted, the release will target the exact version specified in \"Info.plist\" (iOS) or \"AndroidManifest.xml\" (Android).", type: "string" })
.option("appResourcesPath", { alias: "a", default: "App_Resources", demand: false, description: "Specify the relative path of the app resources from project root", type: "string" })
.check((argv: any, aliases: { [aliases: string]: string }): any => { return checkValidReleaseOptions(argv); });

addCommonConfiguration(yargs);
Expand Down Expand Up @@ -919,6 +920,7 @@ function createCommand(): cli.ICommand {
releaseNativeScriptCommand.keystorePassword = argv["keystorePassword"];
releaseNativeScriptCommand.keystoreAlias = argv["keystoreAlias"];
releaseNativeScriptCommand.keystoreAliasPassword = argv["keystoreAliasPassword"];
releaseNativeScriptCommand.appResourcesPath = argv["appResourcesPath"];
}
break;

Expand Down