# @taraflex/clasp

> Develop Apps Script Projects locally

Latest version **2.4.1001** (published 2022-08-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @taraflex/clasp
pnpm add @taraflex/clasp
yarn add @taraflex/clasp
bun add @taraflex/clasp
```

Provides the command `clasp`.

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.4.1001 |
| Published | 2022-08-23 |
| First published | 2022-08-23 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 28 |
| Unpacked size | 280.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5908 |
| Author | Grant Timmerman |
| Maintainers | taraflex |
| Keywords | Apps, Script, SDK, API, script.google.com, extension, add-on |

## Links

- npm: https://www.npmjs.com/package/@taraflex/clasp
- Repository: https://github.com/google/clasp
- Homepage: https://github.com/google/clasp#readme
- Issues: https://github.com/google/clasp/issues
- npm.io page: https://npm.io/package/@taraflex/clasp

## Dependencies (28)

- [ora](https://npm.io/package/ora.md) ^6.0.0
- [dotf](https://npm.io/package/dotf.md) ^2.0.2
- [open](https://npm.io/package/open.md) ^8.2.1
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [fuzzy](https://npm.io/package/fuzzy.md) ^0.1.3
- [p-map](https://npm.io/package/p-map.md) ^5.1.0
- [find-up](https://npm.io/package/find-up.md) ^6.0.0
- [chokidar](https://npm.io/package/chokidar.md) ^3.5.2
- [debounce](https://npm.io/package/debounce.md) ^1.2.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.0.0
- [inquirer](https://npm.io/package/inquirer.md) ^8.1.2
- [make-dir](https://npm.io/package/make-dir.md) ^3.1.0
- [commander](https://npm.io/package/commander.md) ^8.1.0
- [strip-bom](https://npm.io/package/strip-bom.md) ^5.0.0
- [googleapis](https://npm.io/package/googleapis.md) ^84.0.0
- [multimatch](https://npm.io/package/multimatch.md) ^5.0.0
- [log-symbols](https://npm.io/package/log-symbols.md) ^5.0.0
- [read-pkg-up](https://npm.io/package/read-pkg-up.md) ^8.0.0
- [split-lines](https://npm.io/package/split-lines.md) ^3.0.0
- [cli-truncate](https://npm.io/package/cli-truncate.md) ^3.0.0
- [is-reachable](https://npm.io/package/is-reachable.md) ^5.0.0
- [loud-rejection](https://npm.io/package/loud-rejection.md) ^2.2.0
- [server-destroy](https://npm.io/package/server-destroy.md) ^1.0.1
- [@sindresorhus/is](https://npm.io/package/@sindresorhus/is.md) ^4.0.1
- [normalize-newline](https://npm.io/package/normalize-newline.md) ^4.1.0
- [recursive-readdir](https://npm.io/package/recursive-readdir.md) ^2.2.2
- [google-auth-library](https://npm.io/package/google-auth-library.md) ^7.6.2
- [inquirer-autocomplete-prompt-ipt](https://npm.io/package/inquirer-autocomplete-prompt-ipt.md) ^2.0.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.4.1001 (latest) — 2022-08-23

## README

# Clasp without ts2gas

Like https://github.com/google/clasp but without useless typescript transpilations 

## Why ts2gas useless

* ts2gas supports a limited subset of typescript
* Modern js development is almost impossible without the use of a modular system and third-party libraries.
ts2gas does not solve the need to build the application into a single js file. It would seem there is no problem to just use webpack/rollup/your_favorite_bundler, but in this case ts->js transpilation is required before the build step.

## Simple example how to build ts app with rollup

code.ts
```ts
//mark main functions with "export" to protect from rollup tree-shake 
export function hello() {
    Logger.log('hello world')
}
```

tsconfig.json
```json
{
    "compilerOptions": {
        "target": "ES2019",
        "noImplicitUseStrict": true,
        "removeComments": true,
        "checkJs": false,
        "allowJs": false,
        "lib": [
            "ES2019",
        ],
        "types": [
            "google-apps-script"
        ]
    },
    "files": [
        "code.ts"
    ],
    "exclude": [
        "node_modules"
    ]
}
```

rollup.js
```js
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import ts from 'rollup-plugin-ts';

export default {
    input: './code.ts',
    strictDeprecations: true,
    external: [],
    output: {
        //mark "export" syntax more detectable
        generatedCode: { objectShorthand: true, constBindings: true },
        externalLiveBindings: false,
        minifyInternalExports: false,
        freeze: false,
        inlineDynamicImports: true,
        format: 'es',
        file: 'code.gs',
        sourcemap: false
    },
    plugins: [
        resolve({ browser: true, preferBuiltins: false }),
        commonjs({ sourceMap: false }),
        ts({
            browserslist: false,
            include: '*.ts'
        }),
        {
            generateBundle(_, files, isWrite) {
                if (isWrite) {
                    for (let f in files) {
                        const i = files[f];
                        if (i.type === 'chunk' && i.exports.length) {
                            //remove invalid for gscript "export" syntax
                            i.code = i.code.replace(`export { ` + i.exports.join(`, `) + ` };`, '')
                        }
                    }
                }
            }
        }
    ]
}
```

.claspignore ( WARNING!!! syntax not same as .gitignore. Folders like "node_modules" not supported - use "node_modules/**" )
```
**/**

!appsscript.json
!*.gs
```

---
_Source: https://npm.io/package/@taraflex/clasp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
