Skip to content

Instantly share code, notes, and snippets.

@TAKEDA-Takashi
Last active August 26, 2019 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TAKEDA-Takashi/74c68c24a440c7cfbd78ccce5e9652d4 to your computer and use it in GitHub Desktop.
Save TAKEDA-Takashi/74c68c24a440c7cfbd78ccce5e9652d4 to your computer and use it in GitHub Desktop.
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