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

feat: add example command and update docs #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danielbarion
Copy link

@danielbarion danielbarion commented Mar 25, 2024

Changes

My VSCode has autoformat enabled on save, I'll add the changes into this PR description to be easier.

  • lib/index.mjs
/** Supported commands */
const Command = {
  Build: "build",
  Bump: "bump",
  Bundle: "bundle",
  Clean: "clean",
  Deploy: "deploy",
  Docs: "docs",
  GitPush: "git-push",
  Lint: "lint",
  Pack: "pack",
  Publish: "publish",
  Release: "release",
  Serve: "serve",
  Test: "test",
  Types: "types",
  Upload: "upload",
  Version: "version",
  Watch: "watch",
  Example: "example", <-------------- added
};


...


Case for Example command added.


    case Command.Example:
      /**
       * Copy the dist folder to the examples folder, so the files generated on build can be used on the examples.
       * As this will be run on Plugin projects, the path reference will work as expected.
       */
      await promises.cp(
        "./dist",
        "./examples/dist",
        { recursive: true },
        (err) => {
          if (err) {
            console.error(err);
          }
        }
      );
  • package.json

Version updated to "version": "2.5.0"

How to Test

npm i -g yalc

  • Checkout to this branch git checkout feat/example-command
  • Publish the library locally: yalc publish. You should see the following message: @pixi/[email protected] published in the store.
  • Go to the plugin project, ex: https://github.com/pixijs/tilemap
  • Link the xs from the local registry into the project by running yalc add @pixi/[email protected] --link. the --link is to reflect all changes from the local registry, ex: I did one update on xs package, if it's already published I just need to run yalc push, with this command Yalc will push the change into the local registry for this package, with the --link this will be reflected to all local projects using this package with Yalc.

PS: you should see the package reference like that: "@pixi/extension-scripts": "link:.yalc/@pixi/extension-scripts",

  • Build the project: npm run build
  • Add the following script into the package.json scripts object: "example": "xs example",.
  • Run the example script npm run example (this should be run after the build, so the script will copy the dist folder to inside the examples folder).

@bigtimebuddy
Copy link
Member

Thanks, could you revert all the auto format style changes?

@bigtimebuddy
Copy link
Member

Also, please don't bump the version as part of the PR. We do that as part of the release process.

@danielbarion
Copy link
Author

danielbarion commented Mar 26, 2024

Hey @bigtimebuddy!

Sure, I reverted the version now, I'll check how to save without applying the style formatting.

Ivan will check this PR when he has some time available to validate the idea that we are talking about on Discord, I believe this PR can be refined, like: "is example the best name for the new command? should we include the http-server in the end? ..."

If you have any ideas or suggestions, it would be nice to have your feedback

I'll sleep now and I'll finish the changes you requested tomorrow @bigtimebuddy

@danielbarion danielbarion force-pushed the feat/example-command branch from 51f628a to c06df5b Compare March 26, 2024 13:12
@danielbarion
Copy link
Author

@bigtimebuddy I disabled the save on format on my VSCode and I updated the PR :)

Please let me know your thoughts about it, thanks!

@ivanpopelyshev
Copy link

Oh right, I have no rights to merge it, @bigtimebuddy , what to we do?

@bigtimebuddy
Copy link
Member

I don't see the need for this @ivanpopelyshev. The deploy task copies dist, docs and examples. Just make your examples relatively link to ../dist. This is better for developing with examples anyways because dist files are watched.

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.

3 participants