From 0350080d30a7dcce0cca282536d14aba5bbe5562 Mon Sep 17 00:00:00 2001 From: Mike Gray Date: Fri, 1 Mar 2024 15:19:49 -0600 Subject: [PATCH] chore: change import to support OVOS 0.1.0 libraries --- API.md | 13 +++++++++---- src/files/__init__.py | 2 +- src/index.ts | 4 ++-- test/__snapshots__/OVOSSkillProject.test.ts.snap | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/API.md b/API.md index 9cebfa1..fb1a67b 100644 --- a/API.md +++ b/API.md @@ -22,9 +22,14 @@ Add that to your `~/.bashrc` or `~/.zshrc` file to make it permanent. Be sure to In a new directory, run: -`projen new ovosskill --from "@mikejgray/ovos-skill-projen"` +`projen new ovosskill --from "@mikejgray/ovos-skill-projen@latest"` -**NOTE**: This repo is not yet available on NPM. Please add the following to your `~/.npmrc` file (create one if it doesn't exist): `@mikejgray:registry=https://npm.pkg.github.com` +**NOTE**: This repo is not yet available on NPM. Please add the following to your `~/.npmrc` file (create one if it doesn't exist), with [a GitHub token that has packages:read permissions](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry): + +``` +//npm.pkg.github.com/:_authToken=ghp_aeojghxotdj583r38fgzrh48 +@mikejgray:registry=https://npm.pkg.github.com +``` After the skill has been created with default options, a file called `.projenrc.json` will be generated. This file contains all of the options used to create the skill, and can be edited to change the skill's configuration. For a full list of supported options, see [`API.md`](API.md). @@ -55,11 +60,11 @@ Note that projen takes ownership of the `setup.py` file, and the expectation is If you prefer not to keep the skill repository under projen's management, simply delete `node_modules`, `.projenrc.json`, `.gitattributes`, `.projen`, and `package.json` from the skill directory. You can also delete `.github/workflows` if you do not want to use GitHub Actions automation workflows. -## Retrofitting Mycroft skills (WIP) +## Retrofitting Mycroft skills (WIP, please open issues if it doesn't work for your use case) If you have an existing Mycroft skill that you'd like to convert to an OVOS skill, you can do so by running the following command in your skill directory: -`projen new ovosskill --from "@mikejgray/ovos-skill-projen" --retrofit` +`projen new ovosskill --from "@mikejgray/ovos-skill-projen@latest" --retrofit` This will: diff --git a/src/files/__init__.py b/src/files/__init__.py index d5cfd0c..4683bd7 100644 --- a/src/files/__init__.py +++ b/src/files/__init__.py @@ -1,6 +1,6 @@ from ovos_utils import classproperty -from ovos_utils.intents import IntentBuilder from ovos_utils.process_utils import RuntimeRequirements +from ovos_workshop.intents import IntentBuilder from ovos_workshop.decorators import intent_handler # from ovos_workshop.intents import IntentHandler # Uncomment to use Adapt intents from ovos_workshop.skills import OVOSSkill diff --git a/src/index.ts b/src/index.ts index 907b2d1..46b4992 100644 --- a/src/index.ts +++ b/src/index.ts @@ -103,12 +103,12 @@ export class OVOSSkillProject extends GitHubProject { let existingSkillFileContents = readFileSync(file).toString(); let ovosImports = `# TODO: Remove unused OVOS imports from ovos_workshop.decorators import intent_handler +from ovos_workshop.intents import IntentBuilder from ovos_workshop.skills import OVOSSkill -from ovos_utils.intents import IntentBuilder from ovos_bus_client.message import Message`; // Replacements if (existingSkillFileContents.includes('AdaptIntent')) { - ovosImports += '\nfrom ovos_utils.intents import AdaptIntent'; + ovosImports += '\nfrom ovos_workshop.intents import AdaptIntent'; } let skillFileArray = existingSkillFileContents.split('\n'); skillFileArray.forEach((line, index) => { diff --git a/test/__snapshots__/OVOSSkillProject.test.ts.snap b/test/__snapshots__/OVOSSkillProject.test.ts.snap index 9ba76ae..cbdb7d2 100644 --- a/test/__snapshots__/OVOSSkillProject.test.ts.snap +++ b/test/__snapshots__/OVOSSkillProject.test.ts.snap @@ -534,8 +534,8 @@ setup( ", "skill.json": Object {}, "src/__init__.py": "from ovos_utils import classproperty -from ovos_utils.intents import IntentBuilder from ovos_utils.process_utils import RuntimeRequirements +from ovos_workshop.intents import IntentBuilder from ovos_workshop.decorators import intent_handler # from ovos_workshop.intents import IntentHandler # Uncomment to use Adapt intents from ovos_workshop.skills import OVOSSkill @@ -1739,8 +1739,8 @@ setup( ", "skill.json": Object {}, "src/__init__.py": "from ovos_utils import classproperty -from ovos_utils.intents import IntentBuilder from ovos_utils.process_utils import RuntimeRequirements +from ovos_workshop.intents import IntentBuilder from ovos_workshop.decorators import intent_handler # from ovos_workshop.intents import IntentHandler # Uncomment to use Adapt intents from ovos_workshop.skills import OVOSSkill