{"id":23495179,"url":"https://github.com/willklein/sandbox-canvas-kit-7-react-17","last_synced_at":"2025-04-18T05:14:07.064Z","repository":{"id":145189050,"uuid":"567114704","full_name":"willklein/sandbox-canvas-kit-7-react-17","owner":"willklein","description":"A little sandbox for testing code mods for upgrades","archived":false,"fork":false,"pushed_at":"2022-11-17T05:12:21.000Z","size":318,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T14:01:04.048Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willklein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-17T05:08:23.000Z","updated_at":"2023-03-07T13:34:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"28296505-0694-479a-aea0-fa045f22a4c4","html_url":"https://github.com/willklein/sandbox-canvas-kit-7-react-17","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willklein%2Fsandbox-canvas-kit-7-react-17","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willklein%2Fsandbox-canvas-kit-7-react-17/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willklein%2Fsandbox-canvas-kit-7-react-17/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willklein%2Fsandbox-canvas-kit-7-react-17/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willklein","download_url":"https://codeload.github.com/willklein/sandbox-canvas-kit-7-react-17/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249193688,"owners_count":21228024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-25T03:14:38.715Z","updated_at":"2025-04-16T03:54:37.403Z","avatar_url":"https://github.com/willklein.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sandbox: Canvas Kit 7 + React 17\n\n\u003e A little sandbox for testing code mods for upgrades\n\nThis README contains some quick notes and references for a meetup talk I prepared for [React Denver](https://github.com/reactdenver).\n\n---\n\nThis project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).\n\n[Canvas Kit from Workday](https://canvas.workday.com/) was added for some components to work with.\n\n## Stuff to run\n\n### Canvas Kit Upgrade\n\nLet's bump Canvas Kit to the latest version, and see what happens.\n\n```\nnpm install -S @workday/canvas-kit-react@8 @workday/canvas-kit-preview-react@8 @workday/canvas-kit-labs-react@8\n```\n\nDo things still run?\n\nCheck the upgrade guide:\n\nInstall the codemod as a dev dependency:\n\n```\nnpm install -D @workday/canvas-kit-codemod\n```\n\nRun the code mod (yarn is easiest):\n\n```\nyarn canvas-kit-codemod v8 src\n```\n\nCheckout what changed.\n\n### Conventions in ESLint\n\nTree-shaking with slash imports\n\nTime to explore with astexplorer.net!\n\n#### The rule\n\n```\nexport const meta = {\n  type: 'problem',\n  hasSuggestions: true,\n  fixable: false,\n};\n\nexport function create(context) {\n  return {\n    ImportDeclaration(node) {\n      if(node.source.value === '@workday/canvas-kit-react')\n\n      context.report({\n        node: node.source,\n        message: 'Use a slash import for better tree shaking',\n      });\n    }\n  };\n};\n```\n\n#### Setting it up locally\n\nAdd a way to run ESLint directly by adding this to the `scripts` in `package.json`:\n\n```\n\"lint\": \"eslint src\"\n```\n\nMake sure it works:\n\n```\nnpm run lint\n```\n\nFollowing the [developer guide](https://eslint.org/docs/latest/developer-guide/working-with-plugins#rules-in-plugins), create a blank rule in `local-eslint-rules/index.js`:\n\n```\nmodule.exports = {\n  rules: {\n    \"use-slash-imports\": {\n      create: function (context) {\n        // rule implementation ...\n      },\n    },\n  },\n};\n```\n\nRegister it in `devDependencies`:\n\n```\n\"eslint-plugin-local-rules\": \"file:./local-eslint-rules\"\n```\n\nAdd the rule to the config:\n\n```\n  \"eslintConfig\": {\n    \"extends\": [\n      \"react-app\",\n      \"react-app/jest\"\n    ],\n    \"plugins\": [\n      \"local-rules\"\n    ],\n    \"rules\": {\n      \"local-rules/use-slash-imports\": 1\n    }\n  },\n```\n\nDoes it work?\n\n```\nnpm run lint\n```\n\nOh, we need this!\n\n```\nnpm install\n```\n\nRun it again!\n\n```\nnpm run lint\n```\n\nOK, now what? Let's [explore](https://astexplorer.net/).\n\n### React Upgrade\n\nUpgrade React to 18.\n\nReference: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#installing\n\nThat's insufficient! Try this instead:\n\n```\nnpm install -S react@18 react-dom@18\n```\n\n## Available Scripts\n\nIn the project directory, you can run:\n\n### `npm start`\n\nRuns the app in the development mode.\\\nOpen [http://localhost:3000](http://localhost:3000) to view it in your browser.\n\nThe page will reload when you make changes.\\\nYou may also see any lint errors in the console.\n\n### `npm test`\n\nLaunches the test runner in the interactive watch mode.\\\nSee the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.\n\n### `npm run build`\n\nBuilds the app for production to the `build` folder.\\\nIt correctly bundles React in production mode and optimizes the build for the best performance.\n\nThe build is minified and the filenames include the hashes.\\\nYour app is ready to be deployed!\n\nSee the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.\n\n### `npm run eject`\n\n**Note: this is a one-way operation. Once you `eject`, you can't go back!**\n\nIf you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.\n\nInstead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.\n\nYou don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.\n\n## Learn More\n\nYou can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).\n\nTo learn React, check out the [React documentation](https://reactjs.org/).\n\n### Code Splitting\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)\n\n### Analyzing the Bundle Size\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)\n\n### Making a Progressive Web App\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)\n\n### Advanced Configuration\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)\n\n### Deployment\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)\n\n### `npm run build` fails to minify\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillklein%2Fsandbox-canvas-kit-7-react-17","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillklein%2Fsandbox-canvas-kit-7-react-17","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillklein%2Fsandbox-canvas-kit-7-react-17/lists"}