xplat
xplat copied to clipboard
[Suggestion]: Rename NPM Scripts
Dear @NathanWalker ,
i would like to make a suggestion for @nstudio/xplat. I recently installed your framework and really like it as an addition to @nrwl/nx.
When i added my ionic application, i noticed that a lot of additional npm scripts where added to my package.json file, like so:
"build.ionic.xxx": "nx build ionic-xxx",
"clean": "npx rimraf -- hooks node_modules package-lock.json && npm i",
"clean.ionic.xxx": "cd apps/ionic-xxx && npx rimraf -- hooks node_modules platforms www plugins ios android package-lock.json && npm i && rimraf -- package-lock.json",
"open.ionic.xxx.android": "cd apps/ionic-xxx && npm run cap.android",
"open.ionic.xxx.ios": "cd apps/ionic-xxx && npm run cap.ios",
"prepare.ionic.xxx": "npm run clean && npm run clean.ionic.xxx && npm run build.ionic.xxx",
"prepare.ionic.xxx.android": "npm run prepare.ionic.xxx && cd apps/ionic-xxx && npm run cap.add.android",
"prepare.ionic.xxx.ios": "npm run prepare.ionic.xxx && cd apps/ionic-xxx && npm run cap.add.ios",
"sync.ionic.xxx": "cd apps/ionic-xxx && npm run cap.copy"
Please note, that i like to keep my package.json file well-structured, i.e., i would like to sort it alphabetically. This means, however, that all my xplat related commands are "scattered" across the npm scripts part. Which hurts my brain :smile:
Therefore, i would like to suggest, to prepend an xplat. to all commands. For example, this would then look like this:
...
"xplat.prepare.ionic.xxx.ios": "npm run prepare.ionic.xxx && cd apps/ionic-xxx && npm run cap.add.ios",
"xplat.sync.ionic.xxx": "cd apps/ionic-xxx && npm run cap.copy"
When sorting the files alphabetically, it would automatically be one large block for the xplat-related commands.. how wonderful :smile:
What do you think? All the best, Johannes
@johannesschobel good suggestion - actually we've wanted to cleanup npm scripts quite a bit and move most into the workspace.json as Nx builder run commands. Would love some help on a PR with something like that 😄
Dear @NathanWalker ,
thanks for your reply. I am not sure, if i understand you correctly. What do you mean with the workspace.json file? You mean the top-most package.json file in the root directory?
I will try digging through the code to find the npm script commands and create a PR with new command names!
All the best, Johannes
When using nx cli you'll have a workspace.json file.
When using ng cli you'll have a angular.json file.
They both are the same. So just depends which cli you used to setup Nx with. 👍
These 2 video's have most of the details needed: https://nxplaybook.com/courses/701247/lectures/12570366 https://nxplaybook.com/courses/701247/lectures/12570377
These 2 video's have most of the details needed: https://nxplaybook.com/courses/701247/lectures/12570366 https://nxplaybook.com/courses/701247/lectures/12570377
@NathanWalker in a workspace created with th --cli=nx, ng add doesn't work any more, because @angular/cli is no longer installed. How can I add for example angular material without @angular/cli?