Skip to content
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

v7 GA #621

Merged
merged 168 commits into from
May 10, 2024
Merged

v7 GA #621

merged 168 commits into from
May 10, 2024

Conversation

cb1kenobi
Copy link
Contributor

@cb1kenobi cb1kenobi commented Jan 11, 2024

This is a major release. See the changelog for details.

@cb1kenobi cb1kenobi marked this pull request as ready for review March 6, 2024 05:46
@@ -1,3 +1,69 @@
7.0.0
-------------------
* Require Node.js 18 or newer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the CLI is only released with the next major release? Otherwise, some builds will fail after the package update, although the rest of the SDK is 16+

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v7 is slated for release Friday May 10, 2024. I've published 9 beta releases and 2 release candidates. I have resolved all issues. Nobody has reported a failed build using RC2. The CLI requires Node 18 because we don't have the resources to support Node 16. The next major release of the SDK can bump the required Node version to 18, but we don't have to until we update the dependencies in the SDK. This may not happen until 2 major releases from now, but by then we'll drop Node 18 too.

- Removed `haxm` info
- Removed `sdk` setup
- Removed user locale setup
- Removed Xcode CLI tools detection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the replacement here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. The SDK hasn't needed the Xcode CLI tools in years. It was dead code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why new files were created without TypeScript? It seems a bit oldskool :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not getting paid. 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫣 Nevermind the whole review then I guess.

clean: 'removes previous build directories',
create: 'creates a new project',
project: 'get and set tiapp.xml settings'
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom indentation should be prevented

*/
class GracefulShutdown extends Error {}

process.setMaxListeners(666);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for this amount of listeners?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node.js prints a warning if more than 10 listeners are added to an EventEmitter and the CLI plugin system uses an EventEmitter under the hood and 10 is not enough. Plus this line has been in the CLI for 11 years :) https://github.com/tidev/titanium-cli/blob/master/lib/titanium.js#L158

src/cli.js Outdated
* @access private
*/
applyArgv(cmd) {
if (Array.isArray(cmd?.options)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exit early

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

src/cli.js Outdated
const argv = this.argv;
const cargv = cmd.opts();
this.debugLogger.trace(`Copying ${cmd.options.length} options... (${cmd.name()})`);
for (const o of cmd.options) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Named properties

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

this.debugLogger.trace(`Creating ${hookType} hook "${name}"`);

return (...args) => {
let data = Object.assign(dataPayload || {}, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why not to use ?? ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're not wrong, but I've spent more time fixing bugs in this hook code than anywhere else. I don't want to touch this code if I don't have to.

({
data,
platformInfo
} = await detect(cli.debugLogger, config, cli, types));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks odd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how you destructure into existing variables.

const types = {};
let i = 0;
const specifiedTypes = (cli.argv.types || 'all').toLowerCase().split(',');
for (let t of specifiedTypes) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Named properties

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

async fn(logger, config, cli) {
const isJson = cli.argv.json || cli.argv.output === 'json';
let projectDir;
let p = expand(cli.argv['project-dir'] || '.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general: Check for nullish coalescing operators

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The || was intentional for those who pass in --project-dir "". || will handle empty strings while ?? will not.

let name = process.platform;
let version = '?';
let m;
let n;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not good to follow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should see the original code. 🤣

I will fix the variable names here. Stay tuned!

Copy link
Contributor

@hansemannn hansemannn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the changes are great and should be included asap. Some remarks that I found during a first quick review:

  1. New files should be written in TypeScript to make sure they can be better maintained long-term
  2. Abbreviations in property names should be omitted
  3. We have to make sure that this either gets released via a major SDK update (e.g. SDK 13) or remain Node-16 compatible in a "bridge" version. I would prefer the first choice.

@cb1kenobi cb1kenobi merged commit 73977b2 into master May 10, 2024
19 checks passed
@cb1kenobi cb1kenobi deleted the 7_0_X branch May 10, 2024 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants