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

chore: add runner script to create packages in math/iter/special #2927

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

gunjjoshi
Copy link
Member

Description

What is the purpose of this pull request?

This pull request:

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@gunjjoshi gunjjoshi marked this pull request as draft September 20, 2024 18:43
@gunjjoshi
Copy link
Member Author

While running this, I get the following error:

Screenshot 2024-09-21 at 00 16 34

@gunjjoshi
Copy link
Member Author

I thought to update scaffold.sh once we have a basic working script.

Along with that, are we also thinking to update our scaffolding structure (https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/_tools/scaffold/math-iter-unary/data), as our meta data does not contain some of the fields used in that.

} else {
log( 'Creating package: @%s...', 'stdlib/math/iter/special/' + o.alias );
}
names = objectKeys( o );
Copy link
Member

Choose a reason for hiding this comment

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

@gunjjoshi You need to be more selective in what you extract from the JSON file. You need to map the JSON value to a corresponding environment variable in the scaffold script. You cannot just copy-paste the runner.js from the random-array-unary scaffold.

envs.push( str );
}
cmd = envs.join( ' ' ) + ' . ' + SCAFFOLD_SCRIPT;
shell( cmd );
Copy link
Member

Choose a reason for hiding this comment

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

During development, you can print the expected command by commenting out this line and adding a console.log( cmd ).

@gunjjoshi
Copy link
Member Author

What are we using this for: https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/_tools/scaffold/math-iter-unary/scripts/data.json#L3 ?
With this included, I get the error:

/bin/sh: =math/[email protected]: No such file or directory

When I remove this from data.json, it works, and the packages are being made at the required path.

Comment on lines 77 to 84
for ( j = 0; j < names.length; j++ ) {
k = names[ j ];
v = o[ k ];
str = uppercase( k );
str += '=';
str += '\'' + v + '\'';
envs.push( str );
}
Copy link
Member

Choose a reason for hiding this comment

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

@gunjjoshi The reason why you are getting the errors is that you are still passing everything to the scaffold.sh script. You need to explicitly map fields in the data.json to environment variables in the scaffold.sh file. We shouldn't expect these to be 1:1. Meaning, you actually need to perform data transformations.

Copy link
Member

Choose a reason for hiding this comment

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

Furthermore, I wouldn't expect that we'd need everything in the data.json file. I would expect that we pick and choose the appropriate data fields.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, got it. Thanks!

@gunjjoshi
Copy link
Member Author

Made a few changes, the structure is generated correctly now.

@gunjjoshi gunjjoshi marked this pull request as ready for review September 29, 2024 04:24
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