Skip to content

Instantly share code, notes, and snippets.

@TAKEDA-Takashi

TAKEDA-Takashi/README.md

Last active Aug 26, 2019
Embed
What would you like to do?
create clasp app project.

How to use

npx https://gist.github.com/74c68c24a440c7cfbd78ccce5e9652d4 test-app
#!/usr/bin/env node
const fs = require('fs');
const { spawnSync } = require('child_process');
const [,, ...args] = process.argv;
const project_dir = args[0];
try {
fs.mkdirSync(project_dir);
process.chdir(project_dir);
spawnSync('git', ['init'], { stdio: 'inherit' });
fs.writeFileSync('README.md', `# ${project_dir}`);
fs.writeFileSync('.gitignore', 'node_modules/');
spawnSync('npm', ['init', '-y'], { stdio: 'inherit' });
spawnSync('npm', ['install', '-D', '@google/clasp'], { stdio: 'inherit' });
spawnSync('npm', ['install', '-D', '@types/google-apps-script'], { stdio: 'inherit' });
spawnSync('git', ['add', '.'], { stdio: 'inherit' });
spawnSync('git', ['commit', '-m', 'initial commit'], { stdio: 'inherit' });
} catch (err) {
console.log(err);
}
{"name": "create-clasp-app", "version": "0.0.0", "bin": "./index.js"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.