string.is/ is an open-source, privacy-friendly toolkit for developers.
Install dependencies:
yarn install
Then run the development server:
yarn dev
Open http://localhost:3000 with your browser to see the result.
To run all linting checks, type checks, tests, and build for production:
yarn all
- Decide what formats you are converting from and to. As an example, let's pretend you are writing a converter from plain text to reversed-text.
- Check that there is an
identity
(under src/lib/identities) for the from format. In this case we are converting from plain text, and we already have a PlainIdentity, so we don't need to add a new identity. Anidentity
should export (a) aconfidence
function which, given an input string, returns a number out of 100 describing the confidence that the given input matches the identity, and (b) an array ofconverters
that the identity can be used with. - If you added a new
identity
in step (2), make sure to add it to the list of available identities in src/lib/identities/index.ts. - Check that there is an
output
(under src/lib/outputs) for the to format. An output should should export anoutput
function which, given an input string (or possibly object, depending on the conversion taking place) and anoptions
object, will convert the input into the desired output string. - If you added a new
output
in step (4), make sure to export it in src/lib/outputs/index.ts. - Add a new
converter
(under src/lib/converters) for theinput
+output
combination. A converter should export (a) anoperation
function which passes the input string and anoptions
object to the appropriateoutput
, and (b) anoutputId
, which identifies which output is being used (this is needed later to decide which component to render to display the conversion). Make sure to export your new converter in src/lib/converters/index.ts after you have added it. - If you defined a new
outputId
in step (6), add a React output component (under src/components/domain/convert/outputs) to render the new kind of output. If you are re-using an existing kind of output (eg. converting to JSON or YAML) you can re-use an existing output here. - If you added a new React component in step (7), make sure to add it to the list of available components in src/components/domain/convert/outputs.
If all of the appropriate inputs
, outputs
, converters
and React components are in place and exported correctly, you should be able to use your new converter, given the appropriate input string that triggers a non-zero confidence
.
The easiest way to deploy string.is is to use the Vercel Platform.
Check out their Next.js deployment documentation for more details.
Once you've made your commits:
- Fork string-is
- Create a topic branch -
git checkout -b feature/add-my-new-converter
- Push to your branch -
git push origin feature/add-my-new-converter
- Create a Pull Request from your branch
- That's it!
Dave Perrett :: [email protected] :: @daveperrett
See License.txt for details.