npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ti.transform

v0.2.0

Published

A Titanium CLI plugin that allows you to transform your source files the way you want

Downloads

4

Readme

npm

ti.transform

This Titanium CLI plugin keeps track of changes in source files and fires the CLI hook ti.transform.file to allow other plugins to transform source code the way you want.

Note 1: The plugin is under active development and hasn't been thoroughly tested. Only use it for projects under source control.

Note 2: The plugin implies that you store your source files in a separate directory. By default it expects that source files are located in the directory /src and generated files are stored in the directory /app. See the section Options.

Note 3: The plugin does not transform the source files. It is a support plugin for other CLI plugins. See the sections Existing plugins and How it works?.

Installation & Configuration

NPM (recommended)

Run this command in a Titanium project directory

npm install --save-dev ti.transform

The plugin will install itself to the project's local /plugins directory.

After that you need to enable the plugin in your tiapp.xml. Add the following XML element to the <plugins/> section: <plugins/> section:

<plugins>
  ...
  <plugin version="0.1.0">ti.transform</plugin>
</plugins>

Manual

At first, download the plugin.

Then copy the plugin code into the project's local /plugins directory:

${project}/plugins/ti.transform/0.1.0/{plugin_files}

After that add the following XML element to the <plugins/> section:

<plugins>
  ...
  <plugin version="0.1.0">ti.transform</plugin>
</plugins>

Options

You can pass options to the plugin by adding properties to your tiapp.xml.

This plugin supports the following options:

  • ti-transform-src-dir: Default src. The directory, relative to the project root directory, where your source files live in. The plugin tracks files only in this directory.
  • ti-transform-dst-dir: Default app. The directory, relative to the project root directory, where generated files should be written.

By default this options are set to src and app respectively, implying the Alloy project structure.

If you want to maintain other project structure specify ti.transform options in your tiapp.xml. For example:

<ti:app xmlns:ti="http://ti.appcelerator.org">
  ...
  <property name="ti-transform-src-dir" type="string">src</property>
  <property name="ti-transform-dst-dir" type="string">Resources</property>
  ...
</ti:app>

Existing plugins

| Plugin | Version | Description | |--------|---------|-------------| | ti.transform.babel | npm | Transforms JS files using Babel | | ti.transform.pug | npm | Transforms *.pug|jade files using Pug | | ti.transform.stss | npm | Transforms style files using STSS |

Example

See the example project ti.transform-example

How it works?

This plugin binds to the pre-compile event hook, and every time you run your project the plugin scans your source directory for changes. For each changed file it emits the event ti.transform.file, to which other CLI plugins can bind and transform the file. If no plugin transforms the file, the ti.transform plugin will copy it as is, retaining the original relative path and extension, for example:

${project}/src/lib/a.js -> ${project}/app/lib/a.js

Tracking changes

The plugin uses a lock file to keep track of source files and to avoid transforming unmodified files. The lock file is stored in your project's build directory:

${project}/build/.ti.transform.lock

It has the following JSON structure:

{
  "${src_file_path}": {
    "gen": [
      "${gen_file1_path}",
      "${gen_file2_path}",
      ...
    ],
    "mtime": "${last_modified_time_of_src_file}"
  }
}

LiveView support

The plugin supports LiveView feature. If you run your project with the flag --liveview or by using the LiveView switch in the Appcelerator Studio IDE, the plugin creates a chokidar instance that watches changes in the source directory. Upon a modification, the plugin fires the event ti.transform.file for each modified file.

License

MIT