├── .env ├── env ├── .gitignore ├── README.md ├── package.json └── main.js /.env: -------------------------------------------------------------------------------- 1 | OK=1 2 | -------------------------------------------------------------------------------- /env: -------------------------------------------------------------------------------- 1 | OK=1 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env.local 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Minimal reproduction for initializing Stackblitz projects with dotfiles. 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "scripts": { 4 | "start": "node main.js", 5 | "dev": "node main.js" 6 | }, 7 | "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" 8 | } 9 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | import { readFile } from 'node:fs/promises'; 2 | import { resolve } from 'node:path'; 3 | 4 | const content = {}; 5 | 6 | for (const path of ['env', '.env', '.env.local']) { 7 | try { 8 | content[path] = (await readFile(resolve(path), 'utf-8')).trim(); 9 | } catch (e) { 10 | console.error(`Unable to read path "${path}"`, e); 11 | } 12 | } 13 | 14 | console.log(content); 15 | --------------------------------------------------------------------------------