english-lang 0.2.1 → 0.2.2
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/dist/cli/engc.js +28 -21
- package/package.json +1 -1
package/dist/cli/engc.js
CHANGED
|
@@ -78,7 +78,7 @@ screen HomeScreen:
|
|
|
78
78
|
button "Reset"
|
|
79
79
|
`;
|
|
80
80
|
// ── Dev ───────────────────────────────────────────────────────
|
|
81
|
-
function devProject(projectDir) {
|
|
81
|
+
function devProject(projectDir = process.cwd()) {
|
|
82
82
|
const screensDir = path.join(projectDir, 'screens');
|
|
83
83
|
const rnDir = path.join(projectDir, 'rn');
|
|
84
84
|
const rnSrcDir = path.join(rnDir, 'src');
|
|
@@ -120,12 +120,11 @@ function initProject(name) {
|
|
|
120
120
|
console.error(`[engc] Directory already exists: ${projectDir}`);
|
|
121
121
|
process.exit(1);
|
|
122
122
|
}
|
|
123
|
-
console.log(`[engc] Creating project ${name}
|
|
124
|
-
// Create folder
|
|
123
|
+
console.log(`[engc] Creating project ${name} ...\n`);
|
|
124
|
+
// Create screens folder
|
|
125
125
|
const screensDir = path.join(projectDir, 'screens');
|
|
126
126
|
const rnSrcDir = path.join(projectDir, 'rn', 'src');
|
|
127
127
|
fs.mkdirSync(screensDir, { recursive: true });
|
|
128
|
-
fs.mkdirSync(rnSrcDir, { recursive: true });
|
|
129
128
|
// Write starter .eng file
|
|
130
129
|
fs.writeFileSync(path.join(screensDir, 'HomeScreen.eng'), STARTER_ENG, 'utf8');
|
|
131
130
|
console.log('[engc] Created screens/HomeScreen.eng');
|
|
@@ -144,29 +143,37 @@ function initProject(name) {
|
|
|
144
143
|
},
|
|
145
144
|
};
|
|
146
145
|
fs.writeFileSync(path.join(projectDir, 'package.json'), JSON.stringify(pkg, null, 2) + '\n', 'utf8');
|
|
147
|
-
console.log('[engc] Created package.json');
|
|
148
|
-
// Scaffold React Native app
|
|
149
|
-
console.log('[engc] Scaffolding React Native app in rn/
|
|
146
|
+
console.log('[engc] Created package.json\n');
|
|
147
|
+
// Scaffold latest React Native app
|
|
148
|
+
console.log('[engc] Scaffolding latest React Native app in rn/ ...');
|
|
150
149
|
try {
|
|
151
|
-
childProcess.execSync('npx @react-native-community/cli init rn
|
|
150
|
+
childProcess.execSync('npx @react-native-community/cli@latest init rn', { cwd: projectDir, stdio: 'inherit' });
|
|
152
151
|
}
|
|
153
152
|
catch {
|
|
154
|
-
console.error('[engc] Failed to scaffold React Native app.
|
|
153
|
+
console.error('[engc] Failed to scaffold React Native app.');
|
|
155
154
|
process.exit(1);
|
|
156
155
|
}
|
|
157
|
-
//
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
156
|
+
// Pod install for iOS
|
|
157
|
+
const iosDir = path.join(projectDir, 'rn', 'ios');
|
|
158
|
+
if (fs.existsSync(iosDir)) {
|
|
159
|
+
console.log('\n[engc] Installing iOS CocoaPods ...');
|
|
160
|
+
try {
|
|
161
|
+
childProcess.execSync('bundle install && bundle exec pod install', {
|
|
162
|
+
cwd: iosDir,
|
|
163
|
+
stdio: 'inherit',
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
console.warn('[engc] Pod install failed — run it manually: cd rn/ios && pod install');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Compile starter screens into rn/src/
|
|
171
|
+
fs.mkdirSync(rnSrcDir, { recursive: true });
|
|
172
|
+
console.log('\n[engc] Compiling starter screens ...');
|
|
162
173
|
compileDir(screensDir, rnSrcDir);
|
|
163
|
-
console.log(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
cd ${name}
|
|
167
|
-
npm run dev ← starts Metro + watches .eng files
|
|
168
|
-
cd rn && npx react-native run-ios
|
|
169
|
-
`);
|
|
174
|
+
console.log('\n[engc] All done! Starting Metro + eng watcher ...\n');
|
|
175
|
+
// Auto-start dev mode immediately
|
|
176
|
+
devProject(projectDir);
|
|
170
177
|
}
|
|
171
178
|
// ── Compile helpers ───────────────────────────────────────────
|
|
172
179
|
function compileFile(inputPath, outDir) {
|