Skip to content

Commit 82edc85

Browse files
committed
initial commit centralizing files from canvas creator and method repositories
1 parent c006fbf commit 82edc85

56 files changed

Lines changed: 12482 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,118 @@
1-
# apiops-cycles-method-data
2-
The APIOps Cycles method as json-files, including stations, lines, resources, and canvases. Gives a standardized base for tooling, AI and other use cases.
1+
# APIOps Cycles Method
2+
3+
Read more about the method at (https://www.apiopscycles.com/)
4+
5+
This repository contains the source for the APIOps Cycles method, including resources such as canvases. It can be used for multiple purposes, such as the method website (https://www.apiopscycles.com/), which is generated from these files, and the Canvas Creator tool that allows creating, importing and exporting the canvases, and provides a UI. (https://canvascreator.apiopscycles.com/).
6+
7+
## Requirements
8+
9+
You can use the JSON files as is and download a .zip file or clone the repository. You can also install them using `npm install apiops-cycles-method-data`.
10+
11+
- **Node.js 22** or newer
12+
- npm
13+
14+
Install dependencies once with:
15+
16+
```bash
17+
npm install
18+
```
19+
20+
### Canvas editor
21+
22+
Interactive canvases on the site are powered by the [Canvas Creator](https://canvascreator.apiopscycles.com) tool. The component is installed from npm so make sure to run `npm install` before building or running the dev server.
23+
24+
## Local development
25+
26+
Run a local dev server:
27+
28+
```bash
29+
npm run dev
30+
```
31+
32+
This command copies the resource files to `public/` so that links to canvas JSON
33+
files work during development.
34+
35+
Build the production site:
36+
37+
```bash
38+
npm run build
39+
```
40+
41+
## Contributing
42+
43+
### Reporting issues or requesting features
44+
45+
If you spot a problem in the documentation or have an idea for new content, please open an issue in this repository. Include links to the relevant page or JSON file and describe the change you would like to see.
46+
47+
### Editing or adding content
48+
49+
Most pages are generated from the JSON files in `src/data/method/`. These base files (`lines.json`, `stations.json`, `resources.json`, `criteria.json` and `station-criteria.json`) are not localized and live at the root of the folder. Textual values in them reference label keys. English labels are in `src/data/method/en-US` and translations are provided in `labels.lines.json`, `labels.stations.json`, `labels.resources.json` and `labels.criteria.json` under each locale folder. Some longer or more complex resource pages like the API Audit Checklist also use markdown snippets `src/snippets/` linked to the `resources.json`. Do not use any frontmatter in the snippet files. Any supported markdown markup is ok. See references from [Starlight markdown reference](https://starlight.astro.build/guides/authoring-content/) and [Extended markdown reference](https://www.markdownguide.org/extended-syntax/).
50+
51+
Each station page lists the station's entry criteria followed by the next core station's criteria as exit criteria.
52+
53+
After editing these files, run `npm run generate:method` to update the Markdown files in `src/content/docs/`. Note that the generated markdown files are not inlcuded in version control to avoid confusion on where editing should happen.
54+
55+
For fixes in the Markdown files included in version control under `src/content/docs/`, edit them directly.
56+
57+
#### Editing existing content of Method pages (metrolines, core- and substations, resources).
58+
1. Go to `src/data/method/en` and edit the content in English (English is considered the master langauge, and for the translations to work for other languages, it must always be the first to be edited).
59+
2. Validate that your changes work TODO
60+
3. Follow the translation guide if you are able to translate the content to other languages manually or automatically.
61+
4. Commit your code and make a pull request.
62+
5. If you were not able to create the translations of your changes to all languages, create an issue for in the repository for the translations.
63+
64+
#### Translating the language manually or with automated services (new or existing languages with new or changed content)
65+
66+
There are some pure markdown pages in the repository, and they can be translated "normally" and stored to the correct folders e.g. for Finnish language this would be `src/content/fi` .
67+
68+
Content under `src/snippets/` and `src/assets/resource/` can be localized by placing translated files inside a locale folder. For example a Finnish snippet would live at `src/snippets/fi/your-snippet.md` and an image at `src/assets/resource/fi/your-image.svg`. The generation script automatically uses these locale-specific files when building pages.
69+
70+
**These steps below are to translate any content under the "Method":**
71+
72+
Create/Edit the translaton files and put them in to the `src/data/method/` with correct language subfolder manually, or...
73+
74+
1. Create a copy of the `src/data/method/` folder as `.json-autotranslate-cache` (in the root of the project). The cache is not under version control.
75+
2. Create a new folder under the `src/data/locale` (this is a temporary folder, not versioned ) using the 2-letter ISO-code for the new language you are about to translate, e.g. `src/data/locale/fi` if creating translations for Finnish language.
76+
3. Make sure the target language folder is *empty*, e.g. `src/data/locale/fi`. The folder really needs to be empty, even if there are already translations done for this language.
77+
4. Copy the English files you want to translate (`labels.lines.json`, `labels.stations.json`, `labels.resources.json`, `labels.criteria.json`) from `src/data/method/en` to `src/data/locale/en` folder.
78+
5. Make sure you have installed the dependencies for the project with `npm install`.
79+
6. For testing that the plugin works (or for actually doing manual translations), run the json-autotranslate in manual-mode `npx json-autotranslate -i src/data/locales --type key-based -s manual` and it will request you to provide translations to any new or changed (in the English version) language strings.
80+
7. For automatic translations: if you have an API key for any of the automated services, you can use the commands below.
81+
82+
While working with JSON translations, the translation cache `.json-autotranslate-cache` is important to keep in sync because it helps making sure that nothing that has been already automatically been translated with the json-autotranslate plugin (https://github.com/leolabs/json-autotranslate) will be translated again. This is important for the quota / costs of using good quality automated translations.
83+
84+
Command line for running the json-autotranslate in this project using Deepl.com free API account.
85+
```
86+
npx json-autotranslate -i src/data/locales --type key-based -s deepl-free -c [Your Deepl free API key here],,
87+
```
88+
And the same if you are using Azure Translator services
89+
```
90+
npx json-autotranslate -i src/data/locales --type key-based -s azure -c [Your Azure Translator service API key here],[Azure region here like this: northeurope]
91+
```
92+
8. Check that the translations are done. There should now be `.json` files in the target language folder, in our example: `src/data/locale/fi`.
93+
9. If the translated files look ok, go to the translation cache folder `.json-autotranslate-cache` and look for the folder in the target language, i.e. `.json-autotranslate-cache/fi`.
94+
- (Explanation: For some strange reason the plugin writes the contents in different (nested) format in the source folder (i.e. `locales`) than what it can actually read during the next translation round. The flat format it uses in the cache is perfect for it and also the most efficient for our page generation scripts).
95+
10. These files are in the correct flat format for our page generation scripts, so copy these files and paste them to `src/data/method/` folder for the target language, in this case `src/data/method/fi`
96+
11. Validate that your changes work TODO
97+
12. Commit your code and make a pull request.
98+
13. After your pull request has been merged, remember to pull changes so that your local branch is deleted, too. (Make sure you don't leave locally any old files under `.json-autotranslate-cache`.)
99+
100+
If you are planning to use automated translation services: Note that there are some languages that are supported by some of the translation services with local varieties. Check the documentation (https://github.com/leolabs/json-autotranslate) of supported automated translation services and how to see which languages they support.
101+
102+
103+
## Repository structure
104+
105+
```
106+
├── src/
107+
│ ├── assets/ # APIOps Cycles logos and other core assets which you might need in your tooling or product
108+
│ ├── data/method/ # The Method JSON files (structure, relationship, and guideline content)
109+
│ ├── data/method/canvas/ # The Canvases included in the method as JSON files (also used by tools like Canvas Creator)
110+
│ ├── snippets/ # Raw markdown files used for long content for resource docs (only essential extensions for the json files)
111+
├── scripts/ # Utility scripts
112+
└── package.json
113+
```
114+
115+
## License
116+
117+
All content in this repository is provided under Apache 2 license for programmable use, the content and the design of the canvases is under the CC BY-SA 4.0 license unless noted otherwise.
118+
APIOps and APIOps Cycles are trademarks owned by Osaango Oy (https://www.osaango.com). Permission is given to use them in connection with the method, for community purposes. Contact Osaango for partnerships, or sponsoring to support the method development. See method website for current partners (https://www.apiopscycles.com/)

0 commit comments

Comments
 (0)