Skip to content

Commit 4f0a14e

Browse files
committed
Add bin directory back.
1 parent 8e5c92b commit 4f0a14e

File tree

2 files changed

+132
-2
lines changed

2 files changed

+132
-2
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
vendor
2-
node_modules
3-
bin
2+
node_modules

bin/release.js

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#! /usr/bin/env node
2+
const shell = require('shelljs')
3+
4+
const silent = { silent: true }
5+
const releaseBranchName = 'release'
6+
const masterBranchName = 'ci'
7+
8+
// create the release branch
9+
const releaseBranchCreate = shell.exec(`git branch ${releaseBranchName}`, silent)
10+
if (releaseBranchCreate.code === 0) {
11+
shell.echo(`Created ${releaseBranchName} branch`)
12+
} else {
13+
shell.echo(`Error: Could not create ${releaseBranchName} branch.`)
14+
console.log(releaseBranchCreate.stderr || releaseBranchCreate.stdout)
15+
shell.exit(1)
16+
}
17+
18+
// checkout the release branch
19+
const releaseBranchCheckout = shell.exec(`git checkout ${releaseBranchName}`, silent)
20+
if (releaseBranchCheckout.code === 0) {
21+
shell.echo(`Checked out the ${releaseBranchName} branch.`)
22+
} else {
23+
shell.echo(`Error: Could not checkout the ${releaseBranchName} branch.`)
24+
console.log(releaseBranchCheckout.stderr || releaseBranchCheckout.stdout)
25+
shell.exit(1)
26+
}
27+
28+
// remove the unwanted files
29+
const removeDirs = shell.rm('-rf', [
30+
'bin',
31+
'imgs',
32+
'test',
33+
'vendor',
34+
'.travis.yml',
35+
'Changelog.md',
36+
'composer.lock',
37+
'package-lock.json',
38+
'package.json',
39+
'ScreenCast.md',
40+
'Todo.md',
41+
'.gitignore',
42+
], silent)
43+
if (removeDirs.code === 0) {
44+
shell.echo('Removed extraneous files.')
45+
} else {
46+
shell.echo('Error: Could not remove files.')
47+
shell.exit(1)
48+
49+
}
50+
51+
// add all changes to stage
52+
const stageChanges = shell.exec('git add . && git reset node_modules', silent)
53+
if (stageChanges.code === 0) {
54+
shell.echo('Added changes to stage.')
55+
} else {
56+
shell.echo(`Error: Could not stage changes.`)
57+
console.log(stageChanges.stderr || stageChanges.stdout)
58+
shell.exit(1)
59+
}
60+
61+
// install vendor dependencies
62+
const vendorInstall = shell.exec('composer install --no-dev', silent)
63+
if (vendorInstall.code === 0) {
64+
shell.echo('Installed vendor dependencies')
65+
} else {
66+
shell.echo('Error: Could not install vendor dependencies.')
67+
console.log(vendorInstall.stderr)
68+
shell.exit(1)
69+
}
70+
71+
// remove vendor extraneous files
72+
const vendorRemoveFiles = shell.rm('-rf', [
73+
'vendor/youshido/graphql/examples',
74+
'vendor/youshido/graphql/Tests',
75+
'vendor/youshido/graphql/.gitignore',
76+
'vendor/youshido/graphql/.scrutinizer.yml',
77+
'vendor/youshido/graphql/.travis.yml',
78+
'vendor/youshido/graphql/CHANGELOG-1.1.md',
79+
'vendor/youshido/graphql/composer.json',
80+
'vendor/youshido/graphql/LICENSE',
81+
'vendor/youshido/graphql/phpunit.xml.dist',
82+
'vendor/youshido/graphql/README.md',
83+
'vendor/youshido/graphql/UPGRADE-1.1.md',
84+
])
85+
if (vendorRemoveFiles.code === 0) {
86+
shell.echo('Removed extraneous vendor files.')
87+
} else {
88+
shell.echo('Error: Could not remove extraneous vendor files.')
89+
console.log(vendorRemoveFiles.stderr)
90+
shell.exit(1)
91+
}
92+
93+
// stage vendor changes
94+
const stageVendorChanges = shell.exec('git add vendor composer.lock')
95+
if (stageVendorChanges.code === 0) {
96+
shell.echo('Staged vendor changes.')
97+
} else {
98+
shell.echo('Error: Could not stage vendor changes.')
99+
console.log(stageVendorChanges.stderr)
100+
shell.exit(1)
101+
}
102+
103+
// commit all changes
104+
const commitChanges = shell.exec("git commit -m 'Remove extraneous files for release.'", silent)
105+
if (commitChanges.code === 0) {
106+
shell.echo('Changes committed.')
107+
} else {
108+
shell.echo('Error: Could not commit changes.')
109+
console.log(commitChanges.stderr || commitChanges.stdout)
110+
shell.exit(1)
111+
}
112+
113+
// checkout the master branch
114+
const masterCheckout = shell.exec(`git checkout ${masterBranchName}`, silent)
115+
if (masterCheckout.code === 0) {
116+
shell.echo(`Checked out the ${masterBranchName} branch`)
117+
} else {
118+
shell.echo(`Error: Could not checkout the ${masterBranchName} branch.`)
119+
console.log(masterCheckout.stderr || masterCheckout.stdout)
120+
shell.exit(1)
121+
}
122+
123+
// delete the release branch
124+
// const releaseBranchDelete = shell.exec(`git branch -D ${releaseBranchName}`, silent)
125+
// if (releaseBranchDelete.code === 0) {
126+
// shell.echo(`Deleted ${releaseBranchName} branch.`)
127+
// } else {
128+
// shell.echo(`Error: Could not delete ${releaseBranchName} branch.`)
129+
// console.log(releaseBranchDelete.stderr || releaseBranchDelete.stdout)
130+
// shell.exit(1)
131+
// }

0 commit comments

Comments
 (0)