-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtranspile.ts
39 lines (32 loc) · 1.02 KB
/
transpile.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import fs from 'fs-extra';
import path from 'path';
import chalk from 'chalk';
import {
execSync
} from 'child_process';
/** Clean, compile and transpile project */
['clean', 'compile:production', 'transpile:tsc'].forEach((command) =>
{
execSync(`npm run ${command}`, {
stdio: 'inherit',
cwd: __dirname
});
});
/** Compiled directory */
const compileDirectory = path.join(__dirname, 'packed');
/** Prepare required package directories */
['views', 'dist'].forEach((directory) =>
{
fs.copySync(path.join(__dirname, directory), path.join(compileDirectory, directory));
});
/** Prepare required package files */
['package.json', '.npmignore', 'README.md', 'logo.svg', 'LICENSE'].forEach((file) =>
{
fs.copySync(path.join(__dirname, file), path.join(compileDirectory, file));
});
/** Pack source */
execSync(`npm pack`, {
stdio: 'inherit',
cwd: compileDirectory
});
console.log(chalk.yellow(`\n\nAttempted to create pack in: ${compileDirectory}\n\nExiting.`));