@reactful/create 0.0.91 → 0.0.92

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.
@@ -0,0 +1,22 @@
1
+ {
2
+ "type": "module",
3
+ "name": "template",
4
+ "module": "index.ts",
5
+ "scripts": {
6
+ "start": "bun --hot run index.ts",
7
+ "build": "rm -rf tsconfig.tsbuildinfo; bunx tsc -p tsconfig.json",
8
+ "clear": "rm -rf node_modules package-lock.json bun.lockb; bun i; bun run build"
9
+ },
10
+ "dependencies": {
11
+ "react": "^18.2.0",
12
+ "react-dom": "^18.2.0",
13
+ "@reactful/extensions": "latest",
14
+ "@reactful/server": "latest",
15
+ "@reactful/web": "latest"
16
+ },
17
+ "devDependencies": {
18
+ "bun-types": "^1.0.20",
19
+ "typescript": "^5.3.3",
20
+ "@types/react": "^18.2.57"
21
+ }
22
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "exclude": ["node_modules"],
3
+ "compilerOptions": {
4
+ "rootDir": ".",
5
+ "jsx": "react",
6
+ "target": "esnext",
7
+ "module": "esnext",
8
+ "types": ["bun-types"],
9
+ "moduleDetection": "auto",
10
+ "moduleResolution": "bundler",
11
+ "noEmit": true,
12
+ "strict": false,
13
+ "allowJs": true,
14
+ "sourceMap": true,
15
+ "composite": true,
16
+ "declaration": true,
17
+ "skipLibCheck": true,
18
+ "noImplicitAny": false,
19
+ "esModuleInterop": true,
20
+ "downlevelIteration": true,
21
+ "allowSyntheticDefaultImports": true,
22
+ "forceConsistentCasingInFileNames": true
23
+ }
24
+ }
package/index.js CHANGED
@@ -36,8 +36,8 @@ inquirer.prompt(questions).then(async function (answers) {
36
36
 
37
37
  const destination = path.join(process.cwd(), answers.project)
38
38
 
39
- await downloadRepo(`commons`, destination)
40
- await downloadRepo(`templates/${answers.template}`, destination)
39
+ await download(`commons`, destination)
40
+ await download(`templates/${answers.template}`, destination)
41
41
 
42
42
  console.log('- templating project...')
43
43
  renamingJSON(destination, answers.project)
@@ -59,8 +59,27 @@ function renamingJSON(directory, projectName) {
59
59
  fs.writeFileSync(url, JSON.stringify(obj, null, 3))
60
60
  }
61
61
 
62
- const downloadRepo = async (subfolder, destination) =>
63
- downloadGitHub('jsenaribeiro', 'reactful', subfolder, destination)
62
+ const download = async (subfolder, destination) =>
63
+ downloadNPM('@reactful/create', '')
64
+
65
+ async function downloadNPM(packageName, subdirectory, outputFile) {
66
+ try {
67
+ // Analisa o nome do pacote
68
+ const pkg = npmPackageArg.resolve(packageName);
69
+
70
+ // Baixa o pacote para um diretório temporário
71
+ const downloadResult = await npmDownload(pkg, { dir: 'temp' });
72
+
73
+ // Move o arquivo desejado para o diretório de saída
74
+ const sourceFile = path.join(downloadResult, subdirectory, outputFile);
75
+ const destFile = path.join(__dirname, outputFile); // Altere para o diretório de saída desejado
76
+ fs.renameSync(sourceFile, destFile);
77
+
78
+ console.log(`Arquivo baixado com sucesso: ${destFile}`);
79
+ } catch (error) {
80
+ console.error('Erro:', error);
81
+ }
82
+ }
64
83
 
65
84
  async function downloadGitHub(user, repository, subdir, destination) {
66
85
  console.log(`- downloading ${subdir}...`)
@@ -80,7 +99,7 @@ async function downloadGitHub(user, repository, subdir, destination) {
80
99
  if (item.type === 'dir' && item.name) {
81
100
  const from = `${subdir}/${item.name}`
82
101
  const goto = `${destination}/${item.name}`
83
- await downloadRepo(from, goto); continue
102
+ await download(from, goto); continue
84
103
  }
85
104
 
86
105
  if (item.type != 'file') continue
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@reactful/create",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "description": "reactful scafold tool",
7
7
  "author": "jonathan de sena ribeiro <jsenaribeiro@gmail.com>",
8
- "files": [ "index.js", "package.json" ],
8
+ "files": [ "index.js", "package.json", "templates", "commons"],
9
9
  "bin": { "@reactful/create": "index.js" },
10
10
  "scripts": { "deploy": "npm publish --access public" },
11
11
  "license": "MIT",
Binary file
Binary file
Binary file