Skip to content

chore: merge release in master #5165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
45e97d6
chore:bump version to 6.2.1
KristianDD Oct 18, 2019
1e9a55e
chore: add trace for shouldMigrate caching
KristianDD Oct 23, 2019
4658457
Merge pull request #5095 from NativeScript/kddimirov/add-shouldMigrat…
KristianDD Oct 23, 2019
516fd31
fix: handle correctly the situation when the compilation hash is the …
Fatme Oct 29, 2019
7f2933b
Merge pull request #5101 from NativeScript/fatme/hmr-hash
Fatme Oct 30, 2019
61237bb
chore: create changelog for 6.2.0 release
Fatme Nov 1, 2019
a0434f3
Merge pull request #5108 from NativeScript/fatme/changelog-6.2.0
KristianDD Nov 1, 2019
5ccfba6
fix: values-v<sdk> directories are not prepared correctly
rosen-vladimirov Nov 8, 2019
dc65d52
Merge pull request #5121 from NativeScript/vladimirov/fix-values-filt…
rosen-vladimirov Nov 11, 2019
954189b
Merge pull request #5130 from NativeScript/release-patch
Fatme Nov 13, 2019
a6d5eb5
fix: fix livesync when `--no-hmr` option is provided and changes are …
Fatme Nov 15, 2019
cc7a937
Merge pull request #5137 from NativeScript/fatme/fix-no-hmr-sync
rosen-vladimirov Nov 15, 2019
f3171a8
fix: generate iOS images when we have their sizes
rosen-vladimirov Nov 15, 2019
27375b6
chore: create changelog for 6.2.1 release
endarova Nov 18, 2019
829b836
Merge pull request #5144 from NativeScript/endarova/changelog-6.2.1
endarova Nov 18, 2019
60fc024
chore: set version to 6.2.2
rosen-vladimirov Nov 18, 2019
051fb7e
Merge pull request #5139 from NativeScript/vladimirov/fix-image-gener…
rosen-vladimirov Nov 18, 2019
d2aceaa
chore: add script for automatic changelog generation
rosen-vladimirov Nov 21, 2019
78f8f0e
Merge pull request #5152 from NativeScript/vladimirov/automate-change…
rosen-vladimirov Nov 21, 2019
425a32d
Update CHANGELOG.md
miroslavaivanova Nov 22, 2019
7aaaaf3
Merge pull request #5157 from NativeScript/miroslavaivanova-patch-2
miroslavaivanova Nov 22, 2019
605d8be
chore: merge release into master
rosen-vladimirov Nov 26, 2019
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
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ scratch/
docs/html/
dev/

.travis/**/*
.travis/**/*
generate_changelog.js
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
NativeScript CLI Changelog
================
6.2.2 (2019, November 22)
==

### Fixed
* [Fixed #5126](https://github.com/NativeScript/nativescript-cli/issues/5126): CLI does not generate all icons

6.2.1 (2019, November 18)
==

### Fixed
* [Fixed #5120](https://github.com/NativeScript/nativescript-cli/issues/5120): Android resource directories are not prepared correctly
* [Fixed #5105](https://github.com/NativeScript/nativescript-cli/issues/5105): App restarts when changing platform specific scss

6.2.0 (2019, November 1)
==

### New
* [Implemented #5038](https://github.com/NativeScript/nativescript-cli/issues/5038): Deprecate support for markingMode:full
* [Implemented #5049](https://github.com/NativeScript/nativescript-cli/issues/5049): Android App Bundle Improvements
* [Implemented #5060](https://github.com/NativeScript/nativescript-cli/issues/5060): Kotlin usage tracking in android builds
* [Implemented #5096](https://github.com/NativeScript/nativescript-cli/issues/5096): Reduce the npm requests when checking if the project should be migrated
* [Implemented #5104](https://github.com/NativeScript/nativescript-cli/pull/5104): Allow tag and range versions in the preview app plugin versions validation
* [Implemented #5107](https://github.com/NativeScript/nativescript-cli/issues/5107): Support V8 Snapshots on Windows

### Fixed
* [Fixed #3785](https://github.com/NativeScript/nativescript-cli/issues/3785): NativeScript CLI doesn't pause on webpack compilation errors
* [Fixed #4681](https://github.com/NativeScript/nativescript-cli/issues/4681): `tns update ios` is not working
* [Fixed #4963](https://github.com/NativeScript/nativescript-cli/issues/4963): Difference in hookArgs.prepareData.platform on prepare and run command
* [Fixed #4995](https://github.com/NativeScript/nativescript-cli/issues/4995): Building plugin and running demo app fails if plugins has a surrounding gradle build
* [Fixed #5005](https://github.com/NativeScript/nativescript-cli/issues/5005): Apple Watch extension with space in the name of `.entitlements` file is not working
* [Fixed #5020](https://github.com/NativeScript/nativescript-cli/issues/5020): Stuck at "Restarting application on device" on Windows 10, iPad mini 2, compiled with NativeScript Sidekick cloud service.
* [Fixed #5030](https://github.com/NativeScript/nativescript-cli/issues/5030): The `tns devices` command lists appletv as iOS platform
* [Fixed #5034](https://github.com/NativeScript/nativescript-cli/issues/5034): Broken build when passing --i-cloud-container-environment
* [Fixed #5056](https://github.com/NativeScript/nativescript-cli/issues/5056): Unable to process native iOS files and frameworks from scoped packages
* [Fixed #5061](https://github.com/NativeScript/nativescript-cli/issues/5061): Unable to resolve cocoapods version conflicts
* [Fixed #5063](https://github.com/NativeScript/nativescript-cli/issues/5063): Splash Screen asset generation fails for iOS
* [Fixed #5070](https://github.com/NativeScript/nativescript-cli/issues/5070): The `tns test` command cannot work if the source code is not in `src` or `app` folder
* [Fixed #5077](https://github.com/NativeScript/nativescript-cli/pull/5077): Pass allowProvisioningUpdates to xcodebuild only when building for device
* [Fixed #5094](https://github.com/NativeScript/nativescript-cli/issues/5094): Add Theme v2 name to non-extenal modules when starting webpack

6.1.2 (2019, September 18)
==
Expand Down
195 changes: 195 additions & 0 deletions generate_changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
"use strict";

const _ = require("lodash");
const request = require("request");
const fs = require("fs");
const path = require("path");
require("colors");

const argv = process.argv;
if (argv.length < 3 || argv.length > 4) {
console.error(`Incorrect usage. You need to pass the milestone and optionally the Authorization token.\n`.red +
`### Example:
node generate_changelog.js 6.2.2 2d2156c261bb1494f7a6e22f11fa446c7ca0e6b7\n`.yellow);
process.exit(127);
}

const selectedMilestone = process.argv[2];
const token = process.argv[3] || process.env.NS_CLI_CHANGELOG_AUTHORIZATION;
if (!token) {
console.error(`Unable to find Authorization token.\n`.red +
`You must either set NS_CLI_CHANGELOG_AUTHORIZATION environment variable or pass the token as an argument to the script:\n`.yellow +
`node generate_changelog.js 6.2.2 2d2156c261bb1494f7a6e22f11fa446c7ca0e6b7\n`.green);
process.exit(127);
}

const sendRequest = (query) => {
return new Promise((resolve, reject) => {
request.post("https://api.github.com/graphql", {
headers: {
"Accept": "application/json",
"Authorization": `Bearer ${token}`,
"User-Agent": "NativeScript CLI Changelog Generator"
},
body: JSON.stringify(query),
followAllRedirects: true
}, (err, response, body) => {
if (err) {
reject(err);
return;
}
resolve(JSON.parse(body));
});
});
};

const getMilestonesInfoQuery = {
query: `{
repository(owner:"NativeScript", name:"nativescript-cli") {
milestones(first: 100, states: OPEN) {
nodes {
number
id
title
url
}
}
}
}`
};

sendRequest(getMilestonesInfoQuery)
.then(result => {
const milestones = result && result.data && result.data.repository && result.data.repository.milestones && result.data.repository.milestones.nodes || [];
const matchingMilestone = _.find(milestones, m => m.title === selectedMilestone);
if (!matchingMilestone) {
throw new Error(`Unable to find milestone ${selectedMilestone} in the milestones. Current milestones info is: ${JSON.stringify(milestones, null, 2)}`);
}
return matchingMilestone.number;
})
.then((milestone) => {
const getItemsForMilestoneQuery = {
query: `{
repository(owner:"NativeScript", name:"nativescript-cli") {
milestone(number: ${milestone}) {
number
id
issuePrioritiesDebug
url
issues(first: 100) {
nodes {
title
url
number
labels(first:100) {
edges {
node {
name
}
}
}
projectCards(first: 100) {
nodes {
column {
name
}
project {
name
number
}
state
}
}
}
}
}
}
}`
};
return sendRequest(getItemsForMilestoneQuery);
})
.then((milestoneQueryResult) => {
const issues = (milestoneQueryResult && milestoneQueryResult.data && milestoneQueryResult.data.repository &&
milestoneQueryResult.data.repository.milestone && milestoneQueryResult.data.repository.milestone.issues &&
milestoneQueryResult.data.repository.milestone.issues.nodes) || [];
const finalIssuesForChangelog = [];
issues.forEach((issue) => {
const labels = ((issue.labels && issue.labels.edges) || []).map((lblObj) => lblObj && lblObj.node && lblObj.node.name);
const isFeature = labels.indexOf("feature") !== -1;
const isBug = labels.indexOf("bug") !== -1;
const shouldBeSkipped = labels.indexOf("no-changelog") !== -1;
if (isFeature && isBug) {
console.error(`The item '${issue.title}' has both bug and feature label. Clear one of them and try again.`.red);
process.exit(1);
} else if (shouldBeSkipped) {
console.log(`Item ${issue && issue.url}(${issue && issue.title}) will not be included in changelog as it has no-changelog label`.yellow);
} else {
// check if we have resolved it:
const columns = (issue && issue.projectCards && issue.projectCards.nodes || []).map(c => c && c.column && c.column.name);
// There shouldn't be more than one columns.
const column = _.first(columns);
if (columns && column === "Ready for Test" || column === "In Testing" || column === "Done") {
finalIssuesForChangelog.push({
type: isFeature ? "feature" : "bug",
number: issue && issue.number,
title: issue && issue.title,
url: issue && issue.url
});
} else {
console.log(`Item ${issue && issue.url}(${issue && issue.title}) will not be included in changelog as its status is ${columns}`.yellow);
}
}
});

return finalIssuesForChangelog;
})
.then(data => {
const features = [];
const bugs = [];

_.sortBy(data, (d) => d.number)
.forEach(d => {
if (d.type === "feature") {
features.push(`* [Implemented #${d.number}](${d.url}): ${d.title}`);
} else {
bugs.push(`* [Fixed #${d.number}](${d.url}): ${d.title}`);
}
});

const pathToChangelog = path.join(__dirname, "CHANGELOG.md");
let changelogContent = fs.readFileSync(pathToChangelog).toString();

if (features.length === 0 && bugs.length === 0) {
console.error(`Unable to find anything ready for milestone ${selectedMilestone}`.red);
process.exit(2);
}

const monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
const currentDate = new Date();

let newChangelogContent = `\n${selectedMilestone} (${currentDate.getFullYear()}, ${monthNames[currentDate.getMonth()]} ${currentDate.getDate()})
===
`;
if (features.length > 0) {
newChangelogContent += `
### New

${features.join("\n")}
`;
}
if (bugs.length) {
newChangelogContent += `
### Fixed

${bugs.join("\n")}
`;
}

changelogContent = changelogContent.replace(/(NativeScript CLI Changelog\r?\n=+\r?\n)([\s\S]*)/m, `$1${newChangelogContent}\n$2`);
fs.writeFileSync(pathToChangelog, changelogContent);
console.log(`Successfully added Changelog for ${selectedMilestone}`.green);
console.log("Commit the local changes and send a PR.".magenta);
})
.catch(error => console.error(error));
3 changes: 3 additions & 0 deletions lib/controllers/migrate-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,14 @@ Running this command will ${MigrateController.COMMON_MIGRATE_MESSAGE}`;
const cachedResult = await this.getCachedShouldMigrate(projectDir, platform);
if (cachedResult !== false) {
remainingPlatforms.push(platform);
} else {
this.$logger.trace(`Got cached result for shouldMigrate for platform: ${platform}`);
}
}

if (remainingPlatforms.length > 0) {
shouldMigrate = await this._shouldMigrate({ projectDir, platforms: remainingPlatforms, allowInvalidVersions });
this.$logger.trace(`Executed shouldMigrate for platforms: ${remainingPlatforms}. Result is: ${shouldMigrate}`);

if (!shouldMigrate) {
for (const remainingPlatform of remainingPlatforms) {
Expand Down
45 changes: 37 additions & 8 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,23 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject

this.copy(this.getPlatformData(projectData).projectRoot, frameworkDir, "*", "-R");

// TODO: Check if we actually need this and if it should be targetSdk or compileSdk
this.cleanResValues(targetSdkVersion, projectData);
}

private getResDestinationDir(projectData: IProjectData): string {
const appResourcesDirStructureHasMigrated = this.$androidResourcesMigrationService.hasMigrated(projectData.getAppResourcesDirectoryPath());

if (appResourcesDirStructureHasMigrated) {
const appResourcesDestinationPath = this.getUpdatedAppResourcesDestinationDirPath(projectData);
return path.join(appResourcesDestinationPath, constants.MAIN_DIR, constants.RESOURCES_DIR);
} else {
return this.getLegacyAppResourcesDestinationDirPath(projectData);
}
}

private cleanResValues(targetSdkVersion: number, projectData: IProjectData): void {
const resDestinationDir = this.getAppResourcesDestinationDirectoryPath(projectData);
const resDestinationDir = this.getResDestinationDir(projectData);
const directoriesInResFolder = this.$fs.readDirectory(resDestinationDir);
const directoriesToClean = directoriesInResFolder
.map(dir => {
Expand Down Expand Up @@ -283,7 +295,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
const projectAppResourcesPath = projectData.getAppResourcesDirectoryPath(projectData.projectDir);
const platformsAppResourcesPath = this.getAppResourcesDestinationDirectoryPath(projectData);

this.cleanUpPreparedResources(projectAppResourcesPath, projectData);
this.cleanUpPreparedResources(projectData);

this.$fs.ensureDirectoryExists(platformsAppResourcesPath);

Expand All @@ -296,6 +308,10 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
// App_Resources/Android/libs is reserved to user's aars and jars, but they should not be copied as resources
this.$fs.deleteDirectory(path.join(platformsAppResourcesPath, "libs"));
}

const androidToolsInfo = this.$androidToolsInfo.getToolsInfo({ projectDir: projectData.projectDir });
const compileSdkVersion = androidToolsInfo && androidToolsInfo.compileSdkVersion;
this.cleanResValues(compileSdkVersion, projectData);
}

public async preparePluginNativeCode(pluginData: IPluginData, projectData: IProjectData): Promise<void> {
Expand Down Expand Up @@ -431,18 +447,31 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
return path.join(this.getPlatformData(projectData).projectRoot, ...resourcePath);
}

private cleanUpPreparedResources(appResourcesDirectoryPath: string, projectData: IProjectData): void {
let resourcesDirPath = path.join(appResourcesDirectoryPath, this.getPlatformData(projectData).normalizedPlatformName);
/**
* The purpose of this method is to delete the previously prepared user resources.
* The content of the `<platforms>/android/.../res` directory is based on user's resources and gradle project template from android-runtime.
* During preparation of the `<path to user's App_Resources>/Android` we want to clean all the users files from previous preparation,
* but keep the ones that were introduced during `platform add` of the android-runtime.
* Currently the Gradle project template contains resources only in values and values-v21 directories.
* So the current logic of the method is cleaning al resources from `<platforms>/android/.../res` that are not in `values.*` directories
* and that exist in the `<path to user's App_Resources>/Android/.../res` directory
* This means that if user has a resource file in values-v29 for example, builds the project and then deletes this resource,
* it will be kept in platforms directory. Reference issue: `https://github.com/NativeScript/nativescript-cli/issues/5083`
* Same is valid for files in `drawable-<resolution>` directories - in case in user's resources there's drawable-hdpi directory,
* which is deleted after the first build of app, it will remain in platforms directory.
*/
private cleanUpPreparedResources(projectData: IProjectData): void {
let resourcesDirPath = path.join(projectData.appResourcesDirectoryPath, this.getPlatformData(projectData).normalizedPlatformName);
if (this.$androidResourcesMigrationService.hasMigrated(projectData.appResourcesDirectoryPath)) {
resourcesDirPath = path.join(resourcesDirPath, constants.MAIN_DIR, constants.RESOURCES_DIR);
resourcesDirPath = path.join(resourcesDirPath, constants.SRC_DIR, constants.MAIN_DIR, constants.RESOURCES_DIR);
}

const valuesDirRegExp = /^values/;
if (this.$fs.exists(resourcesDirPath)) {
const resourcesDirs = this.$fs.readDirectory(resourcesDirPath).filter(resDir => !resDir.match(valuesDirRegExp));
const appResourcesDestinationDirectoryPath = this.getAppResourcesDestinationDirectoryPath(projectData);
_.each(resourcesDirs, resourceDir => {
this.$fs.deleteDirectory(path.join(appResourcesDestinationDirectoryPath, resourceDir));
const resDestinationDir = this.getResDestinationDir(projectData);
_.each(resourcesDirs, currentResource => {
this.$fs.deleteDirectory(path.join(resDestinationDir, currentResource));
});
}
}
Expand Down
11 changes: 9 additions & 2 deletions lib/services/project-data-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,15 @@ export class ProjectDataService implements IProjectDataService {
}
});

if (!foundMatchingDefinition && image.filename) {
this.$logger.warn(`Didn't find a matching image definition for file ${path.join(path.basename(dirPath), image.filename)}. This file will be skipped from reources generation.`);
if (!foundMatchingDefinition) {
if (image.height && image.width) {
this.$logger.trace("Missing data for image", image, " in CLI's resource file, but we will try to generate images based on the size from Contents.json");
finalContent.images.push(image);
} else if (image.filename) {
this.$logger.warn(`Didn't find a matching image definition for file ${path.join(path.basename(dirPath), image.filename)}. This file will be skipped from resources generation.`);
} else {
this.$logger.trace(`Unable to detect data for image generation of image`, image);
}
}
});

Expand Down
7 changes: 6 additions & 1 deletion lib/services/webpack/webpack-compiler-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
if (message.emittedFiles) {
if (isFirstWebpackWatchCompilation) {
isFirstWebpackWatchCompilation = false;
this.expectedHashes[platformData.platformNameLowerCase] = message.hash;
this.expectedHashes[platformData.platformNameLowerCase] = prepareData.hmr ? message.hash : "";
return;
}

// the hash of the compilation is the same as the previous one
if (this.expectedHashes[platformData.platformNameLowerCase] === message.hash) {
return;
}

Expand Down
Loading