This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
How to create new extension
Théo edited this page Aug 30, 2023
·
2 revisions
Here is the structure of osmium. To create a new extension, you need to create a new folder in the wanted toolchain folder (ex: linter in the solidity folder)
It needs to respect the following structure:
.
├── libs
├── manager
├── packages
└── toolchains
└── solidity
└── linter -> Your new feature folder (linter in this case)
├── core
│ ├── src
│ └── package.json
├── extension
│ ├── .vscode
│ ├── src
│ ├── .eslintrc.json
│ ├── .vscodeignore
│ ├── tsconfig.json
│ └── package.json
└── package.json
This folder is where you will put all the core code of the extension.
For the proper work of the core, you need to implement some rule that can be called by the main script of the toolchain:
-
build
- Build the core -
test
- Run the tests -
lint
- Run the linter
yarn global add yo generator-code
cd toolchains/solidity/linter
yo code .
# ? What type of extension do you want to create? New Extension (TypeScript)
# ? What's the name of your extension? HelloWorld
### Press <Enter> to choose default for all options below ###
# ? What's the identifier of your extension? solidity-linter
# ? What's the description of your extension? A basic description
# ? Initialize a git repository? No
# ? Bundle the source code with webpack? No
# ? Which package manager to use? yarn
# ? Do you want to open the new folder with Visual Studio Code? Open with `code`
Inside the vscode editor, press F5. This will compile and run the extension in a new Extension Development Host window.
The scaffold provides some scripts to help you develop your extension:
-
compile
- Compile your code -
watch
- Watch your code and compile it on change -
pretest
- Run tests and lint -
lint
- Run eslint on your code -
test
- Run tests
For the proper work of the extension, you need to implement some rule that can be called by the main script of the toolchain:
-
build
- Build the core -
test
- Run the tests -
lint
- Run the linter