Skip to content

Commit 2f2aa92

Browse files
authored
fix: fix template cli (#167)
* feat: add create-island add create-island cli in menorepo #165 * feat(cli): fix problems Remove invalid print and replace npm #165 * fix: fix the cli fix the shims in windows bug #165
1 parent 0ecf56a commit 2f2aa92

File tree

16 files changed

+1852
-1817
lines changed

16 files changed

+1852
-1817
lines changed

.npmrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
registry=https://registry.npmjs.org/
2-
strict-peer-dependencies=false
1+
registry=https://registry.npmmirror.com
2+
strict-peer-dependencies=false

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@commitlint/cli": "^17.1.2",
4242
"@commitlint/config-conventional": "^17.1.0",
4343
"@islandjs/plugin-check-links": "workspace:*",
44+
"@islandjs/create-island": "workspace:*",
4445
"@playwright/test": "^1.26.1",
4546
"@types/babel__core": "^7.1.19",
4647
"@types/babel__helper-plugin-utils": "^7.10.0",

packages/create-island/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"create-island": "./bin/index.js"
1212
},
1313
"files": [
14-
"template-*",
15-
"index.js",
14+
"template",
15+
"bin",
1616
"dist"
1717
],
1818
"exports": {
@@ -46,7 +46,6 @@
4646
"devDependencies": {
4747
"@types/prompts": "^2.4.2",
4848
"@types/minimist": "^1.2.2",
49-
"download-git-repo": "^3.0.2",
5049
"execa": "5",
5150
"kolorist": "^1.7.0",
5251
"minimist": "^1.2.7",

packages/create-island/src/index.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import minimist from 'minimist';
88
import prompts from 'prompts';
99
import execa from 'execa';
1010
import { cyan, blue, yellow, bold, dim, green } from 'kolorist';
11+
import { fileURLToPath } from 'node:url';
1112
// eslint-disable-next-line @typescript-eslint/no-var-requires
1213
const { version } = require('../package.json');
1314

@@ -62,14 +63,16 @@ async function init() {
6263

6364
console.log(dim(' Scaffolding project in ') + targetDir + dim(' ...'));
6465

65-
const templateDir = path.join(__dirname, 'template');
66+
const templateDir = path.resolve(
67+
fileURLToPath(import.meta.url),
68+
'../..',
69+
'template'
70+
);
6671

6772
const write = (file: string, content?: string) => {
6873
const targetPath = path.join(root, renameFiles[file] ?? file);
69-
if (content) {
70-
if (content) fs.writeFileSync(targetPath, content);
71-
else copy(path.join(templateDir, file), targetPath);
72-
}
74+
if (content) fs.writeFileSync(targetPath, content);
75+
else copy(path.join(templateDir, file), targetPath);
7376
};
7477
const files = fs.readdirSync(templateDir);
7578
for (const file of files.filter((f) => f !== 'package.json')) {

packages/create-island/tsup.config.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default defineConfig([
1111
minify: process.env.NODE_ENV === 'production',
1212
skipNodeModulesBundle: true,
1313
outDir: 'dist',
14-
clean: true,
15-
shims: true
14+
clean: true
1615
}
1716
]);

0 commit comments

Comments
 (0)