/**
 * In TypeScript, updates are not like PUTs, you
 * need to create a file before updating it.
 *
 * This method lets us treat the two as the same.
 */
function createOrUpdateFile(env, path, code) {
    const existing = env.getSourceFile(path);
    if (existing) {
        if (code === existing.getFullText())
            return false;
        env.updateFile(path, code);
        return true;
    }
    env.createFile(path, code);
    return true;
}

export { createOrUpdateFile };
