cc-discipline 2.9.0 → 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +2 -0
- package/init.sh +13 -5
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -131,9 +131,11 @@ Examples:
|
|
|
131
131
|
|
|
132
132
|
// Run the bash script
|
|
133
133
|
const unixScript = toUnixPath(script);
|
|
134
|
+
const pkgVersion = require(path.join(PKG_DIR, 'package.json')).version;
|
|
134
135
|
const env = {
|
|
135
136
|
...process.env,
|
|
136
137
|
CC_DISCIPLINE_PKG_DIR: process.platform === 'win32' ? toUnixPath(PKG_DIR) : PKG_DIR,
|
|
138
|
+
CC_DISCIPLINE_VERSION: pkgVersion,
|
|
137
139
|
};
|
|
138
140
|
|
|
139
141
|
const result = spawnSync(bash, [unixScript, ...scriptArgs], {
|
package/init.sh
CHANGED
|
@@ -5,12 +5,20 @@
|
|
|
5
5
|
# cd your-project && bash /path/to/init.sh --stack "3 4" --name myapp --global
|
|
6
6
|
# Or: curl -sL https://raw.githubusercontent.com/YOU/cc-discipline/main/init.sh | bash
|
|
7
7
|
|
|
8
|
-
set -e
|
|
8
|
+
# On Windows (Git Bash), set -e causes silent failures due to path/command differences.
|
|
9
|
+
# Use explicit error checking for critical operations instead.
|
|
10
|
+
if [[ "$(uname -s)" != MINGW* ]] && [[ "$(uname -s)" != MSYS* ]]; then
|
|
11
|
+
set -e
|
|
12
|
+
fi
|
|
9
13
|
|
|
10
|
-
# ─── Version
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
# ─── Version ───
|
|
15
|
+
# cli.js sets CC_DISCIPLINE_VERSION on Windows where node paths are tricky
|
|
16
|
+
VERSION="${CC_DISCIPLINE_VERSION:-unknown}"
|
|
17
|
+
if [ "$VERSION" = "unknown" ]; then
|
|
18
|
+
_INIT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
19
|
+
if command -v node &>/dev/null && [ -f "$_INIT_DIR/package.json" ]; then
|
|
20
|
+
VERSION=$(node -p "require('$_INIT_DIR/package.json').version" 2>/dev/null) || true
|
|
21
|
+
fi
|
|
14
22
|
fi
|
|
15
23
|
VERSION="${VERSION:-unknown}"
|
|
16
24
|
|